The list is a datatype in R which can able to keep many values of different data type. A list can able to keep the values, strings, matrix, and even a function inside it.
This R program helps you to create a list of multiple datatype values. In R, we have a function called list() for doing this functionality. list() function create a list in R that can able to hold values that are of different types.
The syntax of the list() is
In this R program, we directly give the values to a built-in function list(). First, we are keeping the values in a list called datalist. Then call the function list() for making the values list with different types. Finally, print the variable datalist that contains the lists.
STEP 1: Assign variables datalist with a list of values
STEP 2: Call the list() function
STEP 3: print the variable datalist variable
For getting a better understanding of this R program, please refer to our page that explains the Lists
datalist = list("Java", "PHP", c(2, 4, 6, 8), TRUE, 20.19, 62.54) print("Data of the list:") print(datalist)
 "Data of the list:" []  "Java" []  "PHP" []  2 4 6 8 []  TRUE []  20.19 [] 62.54