[Rd] parse(text=...) and the srcfile attribute
deepayan.sarkar at gmail.com
Fri Jul 13 03:52:50 CEST 2007
I'm trying to understand whether the new source file references can
help me with something I want to do. Let's say I have
foo <- parse(text = "
a <- 1; b <- 2**2
a + b
I now wish to recover the sources for the parsed expressions. I can
get them one at a time:
b <- 2^2
> as.character(attr(foo, "srcref")[])
 "b <- 2**2"
Is there a better way? Perhaps like the print method
> as.character(foo, useSource = TRUE)
could give all the sources at once?
More information about the R-devel