[R] Help needed with eval parse
huze|@@kh@||| @end|ng |rom um|ch@edu
Wed Sep 18 14:43:23 CEST 2019
I have been running a script which produces objects based on the
column names of a data.frame. The column names are of the form CB_1-1,
CB_1-2, etc. Now this calculation was rather long and memory
intensive, so I would rather not have to do it again after fixing the
column names using "make.names". As a consequence, I am left with a
bunch of R objects with `-` in the name.
Accessing them is proving challenging and any help would be appreciated.
`cb_1-2` <- "hello world"
t <- "cb_1-2"
t <- as.name(t)
t <- eval(parse(text = t))
Error in eval(parse(text = t)) : object 'cb_1' not found
More information about the R-help