Skip to content
Prev 246539 / 398502 Next

convert expressions to characters

Hi,

Suppose I have

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

now x is an expression with some src attributes.
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)?
[1] "{"

as.character() only returns "{".
[1] "{"
[1] "1"   "2+3"


Thanks a lot!

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