determining name of object loaded in R
Posted
by andrewj
on Stack Overflow
See other posts from Stack Overflow
or by andrewj
Published on 2010-03-26T02:15:08Z
Indexed on
2010/03/26
2:23 UTC
Read the original article
Hit count: 305
r
Imagine you have an object foo
that you saved as saved.file.rda
as follows:
foo <- 'a'
save(foo, file='saved.file.rda')
Suppose you load saved.file.rda
into an environment with multiple objects but forgot the name of the object that is in saved.file.rda
. Is there a way in R to determine that name?
You can do it the following way, which seems a little clunky:
bar <- load('saved.file.rda')
eval(parse(text=bar)) # this will pull up the object that was in saved.file.rda
However, is there a better way of doing this?
© Stack Overflow or respective owner