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
1,174 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
• 33,030 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,660 points
8,809 views
+1 vote
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 7,071 views
0 votes
1 answer

Counting the number of elements with the values of x in a vector

You may simply use the table() method: > ...READ MORE

answered Jun 14, 2022 in Data Analytics by Sohail
• 3,040 points
532 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
2,187 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
1,834 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, 2020 by Gitika 1,096 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
1,223 views
+1 vote
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
• 33,030 points
4,935 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 29, 2019 in Data Analytics by Cherukuri
• 33,030 points
47,857 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP