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?
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework