"Deepayan Sarkar" <[EMAIL PROTECTED]> writes:
> Hi,
>
> consider this:
>
> --------------
>
> estr <- c("2^4", "alpha[1]")
> eexp <- expression(2^4, alpha[1])
>
>
> ## Is it possible to get 'eexp' starting from 'estr'? The closest I could
> ## get was:
>
> do.call(expression, lapply(estr, as.name))
>
> ## but it is not quite the same; e.g. the following behave differently:
Er, how about
> estr <- c("2^4", "alpha[1]")
> parse(text=estr)
expression(2^4, alpha[1])
or (brain teaser alert!)
> parse(text=deparse(parse(text=estr)))[[1]]
expression(2^4, alpha[1])
which is _not_ quite the same thing.
--
O__ ---- Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.