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, 2019 in Data Analytics by kavya
44 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, 2019 by anonymous
• 32,460 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,560 points
3,128 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 Sep 17, 2019 in Data Analytics by rahul

edited Sep 17, 2019 521 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 Abhi
• 3,680 points
146 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,720 points
712 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,720 points
375 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,720 points

edited Jun 9 by Gitika 156 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,720 points
230 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, 2019 in Data Analytics by anonymous
• 32,460 points
260 views
0 votes
1 answer

What is the difference between list and vector in R?

The difference are - A list holds different ...READ MORE

answered Oct 28, 2019 in Data Analytics by Cherukuri
• 32,460 points
7,622 views