Displaying 1 result from an estimated 1 matches for "vecfoo".
Did you mean:
getfoo
2009 Jun 18
3
How to parse and eval a collection of items
...eone recommend a better function, or simpler
way, to do so than the following?
Suppose my scalars' names are foo1, foo2, foo3, foo1high, foo2high,
foo3lo2, etc. Then I can do:
>ls(pat='foo')->thels
>mapply(function(x) eval(as.name(thels[x])),seq(1:length(thels)))->vecfoo
I was hoping for some way to avoid creating a function and an *apply
call. Conceptually, eval(as.name(c(thels))) which of course doesn't work.
thanks
Carl