nth maximum and nth smallest number in vector

0 votes
How to find nth maximum and nth smallest number in vector in r?
Aug 18 in Data Analytics by kavya
16 views

1 answer to this question.

0 votes
Hi,

You can use nth() function to find nth max or min element.

syntax nth(data,position)

Ex: nth(c(1:5),3) -> 3.

Or sort the elements in an ascending or descending order and then use sort() or order() to fetch the nth max/min element.
answered Aug 19 by anonymous
• 25,900 points

Related Questions In Data Analytics

0 votes
1 answer

Finding the nth highest value in a vector or a data-frame column

sort(x,T)[n] Here, 'x' is the data-frame/vector and 'n' ...READ MORE

answered May 31, 2018 in Data Analytics by Bharani
• 4,550 points
191 views
0 votes
2 answers
0 votes
1 answer

Define a matrix, vector and determinent in rmarkdown html document

Hi Riya, I have given some examples below ...READ MORE

answered 5 days ago in Data Analytics by rahul

edited 5 days ago 18 views
0 votes
2 answers

"Train" and "Test" sets in Data Science

Normally to perform supervised learning you need ...READ MORE

answered Aug 2, 2018 in Data Analytics by Anmol
• 3,620 points
43 views
0 votes
1 answer

By using dpylr package sum of multiple columns

Basically here we are making an equation ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,700 points
97 views
0 votes
1 answer

How to convert a text mining termDocumentMatrix into excel or csv in R?

By assuming that all the values are ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,700 points
118 views
0 votes
1 answer

In a dpylr pipline how to use sample and seq?

For avoiding rowwise(), I prefer to use ...READ MORE

answered Apr 6, 2018 in Data Analytics by DeepCoder786
• 1,700 points
76 views
0 votes
1 answer

How to create a list of Data frames?

Basically all we have to do is ...READ MORE

answered Apr 9, 2018 in Data Analytics by DeepCoder786
• 1,700 points
70 views
0 votes
2 answers

How to count the number of elements with the values in a vector?

Use dplyr function group_by(). > n = as.data.frame(num) > ...READ MORE

answered Aug 21 in Data Analytics by anonymous
• 25,900 points
98 views
0 votes
2 answers

How can we count TRUE values in a logical vector?

Hi, You can get a count of all ...READ MORE

answered Aug 20 in Data Analytics by anonymous
• 25,900 points
1,508 views