List in R

List in R

List is data structure in R with elements which can be of different types.

1. Creating List – with different types elements

diffTypeList <- list(1, “Introduction to R”, TRUE)

2. You can access single element double square brackets[[]]  

Example :
print(diffTypeList[[1]])            // Output [1] 1

3. You can modify by accessing element using double square brackets[[]]  

diffTypeList[[1]] <- 100

Leave a Reply