How to Apply the objects() & ls() Functions in R (Example Code)
In this article you’ll learn how to apply the ls() and objects() functions in the R programming language.
Introduction of Example Data
data(iris) # Create some example data |
data(iris) # Create some example data
vec <- 1:5 |
vec <- 1:5
my_list <- list(1, 2, 3) |
my_list <- list(1, 2, 3)
Example: Print Names of Objects in Environment Using objects() & ls() Functions
objects() # Using objects() function # [1] "iris" "vec" "my_list" |
objects() # Using objects() function # [1] "iris" "vec" "my_list"
ls() # Using ls() function # [1] "iris" "vec" "my_list" |
ls() # Using ls() function # [1] "iris" "vec" "my_list"