How to call environment objects from names in vectors

Viewed 149

There are the names of the objects (data_frames) in the specified environment.

ls()
[1] "a"         "b"

I have assigned the names of the objects to a vector, e.g. n_obj <- c('a', 'b')

How to call my objects using the vector of the names n_obj? n_obj[1] return logical a string 'a', but I need to run 'a' as my saved dataframe 'a' in the environment.

1 Answers

I'd use the get function

get(n_obj[1])
Related