Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

R Programming: Create a list containing strings, numbers, vectors and a logical values

R Programming: List Exercise-1 with Solution

Write a R program to create a list containing strings, numbers, vectors and a logical values.

Sample Solution :

R Programming Code :

list_data = list("Python", "PHP", c(5, 7, 9, 11), TRUE, 125.17, 75.83)
print("Data of the list:")
print(list_data)

Sample Output:

[1] "Data of the list:"
[[1]]
[1] "Python"

[[2]]
[1] "PHP"

[[3]]
[1]  5  7  9 11

[[4]]
[1] TRUE

[[5]]
[1] 125.17

[[6]]
[1] 75.83                         

R Programming Code Editor:



Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: R Programming Exercises Home.
Next: Write a R program to list containing a vector, a matrix and a list and give names to the elements in the list.

Test your Programming skills with w3resource's quiz.

What is the difficulty level of this exercise?