VOOZH about

URL: https://www.geeksforgeeks.org/r-language/how-to-find-nth-smallest-value-in-vector-in-r/

⇱ How to find Nth smallest value in vector in R ? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to find Nth smallest value in vector in R ?

Last Updated : 23 Jul, 2025

In this article, we will discuss how to find the Nth smallest in vector in the R programming language.

Steps -

  • Create vector
  • Take input from the user using the function readline().
  • Convert data from string to int using the function as.integer().
  • In this step, we are finding nth largest number using

Syntax:

sort(vector name ) [n value])

Parameter:

  • Vector name is the vector which we created.
  • N value is which largest number you want to print.

Example 1:

Output:

[1] 1

Example 2:

Output:

[1] 39898

Comment

Explore