Hi,

Suppose I have

x = parse(text = "
{y=50+50+50#'asfasf'
}
")

now x is an expression with some src attributes.

> x
expression({y=50+50+50#'asfasf'
})
attr(,"srcfile")
<text>
attr(,"wholeSrcref")

{y=50+50+50#'asfasf'
}

My question is, how can I get my string back (the string passed to
parse() as the text argument)?

> as.character(x)
[1] "{"

as.character() only returns "{".

> as.character(expression({1}))
[1] "{"
> as.character(expression("1","2+3"))
[1] "1"   "2+3"


Thanks a lot!

Regards,
Yihui
--
Yihui Xie <xieyi...@gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA

______________________________________________
R-help@r-project.org 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.

Reply via email to