Difference between list(1:5) and list(1,2 ...5) in R.

0 votes
What is the difference between list(1:5) and list(1,2 ...5) in R?
Oct 14 in Data Analytics by anonymous
• 3,290 points
32 views

1 answer to this question.

0 votes

It's very simple. list(1:4) creates a single element(vector) whereas list(1,2,3,4) creates multiple elements(vector)

> l
[[1]]
[1] 1 2 3 4 5

> l1
[[1]]
[1] 1

[[2]]
[1] 2

[[3]]
[1] 3

[[4]]
[1] 4

[[5]]
[1] 5

list(1:4) is a atomic element whreas list(1,2,3,4) is not atomic.

answered Oct 14 by rajeev

Related Questions In Data Analytics

0 votes
1 answer
0 votes
1 answer

Difference between List(list1,list2) and c(list1,list2) in R

Hi Deepa, It's quite simple, let me explain ...READ MORE

answered Jun 26 in Data Analytics by Cherukuri
• 31,840 points
125 views
0 votes
1 answer

Difference between [[1]] and [1] in R Programming

Hey Latha, The difference between them is that ...READ MORE

answered Jun 28 in Data Analytics by anonymous
• 31,840 points
43 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 in Data Analytics by Cherukuri
• 31,840 points
99 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
116 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
161 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
87 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
106 views
0 votes
1 answer

R programming: Finding the difference between 2 vectors

Try this function, it worked for me: f ...READ MORE

answered Dec 27, 2018 in Data Analytics by Sophie may
• 9,870 points
48 views