w3resource

R Programming: Create a list of heterogeneous data, which include character, numeric and logical vectors

R Programming: Basic Exercise-24 with Solution

Write a R program to create a list of heterogeneous data, which include character, numeric and logical vectors. Print the lists.

Sample Solution :

R Programming Code :

my_list = list(Chr="Python", nums = 1:15, flag=TRUE)
print(my_list)

Sample Output:

$Chr
[1] "Python"

$nums
 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15

$flag
[1] TRUE                         

R Programming Code Editor:



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

Previous: Write a R program to compute sum, mean and product of a given vector elements.
Next: Write a R program to create a Dataframes which contain details of 5 employees and display the details.

Test your Programming skills with w3resource's quiz.

What is the difficulty level of this exercise?



Follow us on Facebook and Twitter for latest update.