function to sort elements in a list

0 votes
I'm new to programming. Can anyone help me to create a function to sort elements in a list in R?
Oct 10, 2019 in Data Analytics by ch
• 3,450 points
363 views

1 answer to this question.

0 votes

@ch,

Using sort function.

sort(l,decreasing = T)

> l = list(1:5)
> sort(l[[1]])
[1] 1 2 3 4 5
> sort(l[[1]],decreasing = T)
[1] 5 4 3 2 1
answered Oct 14, 2019 by Cherukuri
• 33,030 points

Related Questions In Data Analytics

0 votes
1 answer
0 votes
0 answers

R function rep() in Python (replicates elements of a list/vector)

Each element of a vector is duplicated ...READ MORE

Jun 24, 2022 in Data Analytics by Sohail
• 3,040 points
1,013 views
+1 vote
2 answers

Custom Function to replace missing values in a vector with the mean of values

Try this. lapply(a,function(x){ifelse(is.na(x),mean(a,na.rm = TRUE ...READ MORE

answered Aug 14, 2019 in Data Analytics by anonymous
1,616 views
0 votes
1 answer
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,993 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,605 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 892 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
994 views
0 votes
1 answer

How to add elements into a list in R?

hey, Add elements into list as below. list = ...READ MORE

answered Sep 30, 2019 in Data Analytics by anonymous
• 33,030 points
484 views
+1 vote
2 answers

How to sort a data frame by columns in R?

You can use dplyr function arrange() like ...READ MORE

answered Aug 21, 2019 in Data Analytics by anonymous
• 33,030 points
1,416 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