reverse a list or vector in R

0 votes
I want to check if a list is a palindrome. How to reverse a list or vector in R?
Oct 14, 2019 in Data Analytics by ch
• 3,380 points
96 views

1 answer to this question.

0 votes

@ch,

Use rev function to reverse R objects such as vector or list.

> l = c(1:5)
> rev.default(l)
[1] 5 4 3 2 1
> rev(l)
[1] 5 4 3 2 1
answered Oct 14, 2019 by Cherukuri
• 32,440 points

Related Questions In Data Analytics

0 votes
1 answer
0 votes
1 answer

How to convert a list to data frame in R?

Let's assume your list of lists is ...READ MORE

answered Apr 12, 2018 in Data Analytics by nirvana
• 3,060 points

edited Apr 12, 2018 by nirvana 7,801 views
+1 vote
1 answer

How to convert a list of dataframes in to a single dataframe using R?

You can use the plyr function: data <- ...READ MORE

answered Apr 13, 2018 in Data Analytics by Sahiti
• 6,290 points
329 views
0 votes
1 answer

R function for finding the index of an element in a vector?

Yes, we can find the index of ...READ MORE

answered Apr 13, 2018 in Data Analytics by zombie
• 3,750 points
7,246 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
322 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
269 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
114 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
163 views
0 votes
1 answer

Search elements in a vector or list

There are multiple functions and operators that can ...READ MORE

answered Aug 21, 2019 in Data Analytics by Cherukuri
• 32,440 points
31 views
0 votes
1 answer

Slicing a list using an index vector in r

Use index within [] and provide an ...READ MORE

answered Nov 2, 2019 in Data Analytics by Cherukuri
• 32,440 points
252 views