ruk·si

📊 R
Lists

Updated at 2017-10-13 17:55

Lists are like vectors but can hold different types of values.

x <- list(1:5, "okay", TRUE)
x
x[[1]]

You can assign named values to lists.

x <- list(1:5, "okay", TRUE)
x[["my_value"]] <- 177 # or x$my_value <- 177
x$my_value
# [1] 177

Lists can be recursive.

x <- list(list(list(list())))
str(x)
is.recursive(x)
# [1] TRUE

Sources

  • Google Developers R Programming Videos
  • Try R