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
397 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,010 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
7,735 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 3,442 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 in Data Analytics by Sohail
• 2,960 points
26 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
1,581 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
993 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 456 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
627 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,010 points
3,446 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,010 points
29,474 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP