a1 <- "qss(x1,lambda=100)"
> parse(text=a1)[[1]][[2]]
x1
This will not work for length(a) != 1, so you have to explicitly map
over your list, e.g.
a <- paste("qss(",paste("x",1:6,sep = "") ,", lambda =100)", sep = "")
> dput( lapply(a,function(x)parse(text=x)[[1]][[2]]) )
list(x1, x2, x3, x4, x5,
one way seems to be the following:
a <- paste("qss(",paste("x",1:6,sep = "") ,", lambda =100)", sep = "")
all.vars(parse(text = a))
I hope it helps.
Best,
Dimitris
roger koenker wrote:
I have a vector of character strings that look like R expressions:
> a <- paste("qss(",paste("x",1:6,sep
unlist(lapply(parse(text=a), function(x) deparse(x[[2]])))
seems to do the job.
Patrick Burns
patr...@burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of "The R Inferno" and "A Guide for the Unwilling S User")
roger koenker wrote:
I have a vector of character strings that lo
I have a vector of character strings that look like R expressions:
> a <- paste("qss(",paste("x",1:6,sep = "") ,", lambda =100)", sep =
"")
> a
[1] "qss(x1, lambda =100)" "qss(x2, lambda =100)" "qss(x3, lambda =100)"
[4] "qss(x4, lambda =100)" "qss(x5, lambda =100)" "qss(x6, lambda =100)"
Tha
4 matches
Mail list logo