On 12/07/2007 10:10 PM, Deepayan Sarkar wrote:
> On 7/12/07, Gabor Grothendieck <[EMAIL PROTECTED]> wrote:
>> You can do this:
>>
>>> [EMAIL PROTECTED]
>> [1] "\na <- 1; b <- 2**2\na + b\n"
>>
>>> # or this
>>> as.character(foo)
>> [1] "a <- 1" "b <- 2^2" "a + b"
>
> Neither of which is what I w
On 7/12/07, Gabor Grothendieck <[EMAIL PROTECTED]> wrote:
> You can do this:
>
> > [EMAIL PROTECTED]
> [1] "\na <- 1; b <- 2**2\na + b\n"
>
> > # or this
> > as.character(foo)
> [1] "a <- 1" "b <- 2^2" "a + b"
Neither of which is what I want. I want
> sapply(attr(foo, "srcref"), as.character)
[
You can do this:
> [EMAIL PROTECTED]
[1] "\na <- 1; b <- 2**2\na + b\n"
> # or this
> as.character(foo)
[1] "a <- 1" "b <- 2^2" "a + b"
On 7/12/07, Deepayan Sarkar <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm trying to understand whether the new source file references can
> help me with something
Hi,
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:
> foo[[2]]
b <- 2^2
> as.cha