r - How to find an object within multiple rdata files -
i trying find way can search folder containing many rdata , rda files find specific object have forgotten in rda file exists.
thank you.
you can load .rdata file (is same rda file?) environment , test if name present function:
hasgot=function(f,name){ e=new.env() load(f,env=e) name %in% ls(env=e,all.names=true) }
the following variation might faster:
hasgot=function(f,name){ e=new.env() load(f,env=e) !is.null(e[[name]]) }
usage hasgot("my.rdata","foo")
see if foo
in my.rdata
. not vectorised on either argument, feed 1 thing @ time.
a full solution problem involve wrapping in list.files
, loop.
Comments
Post a Comment