R : Copyright 1999, The R Development Core Team
Version 0.63.3 in progress (January 26, 1999)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type "?license" or "?licence" for distribution details.
R is a collaborative project with many contributors.
Type "?contributors" for a list.
Type "demo()" for some demos, "help()" for on-line help, or
"help.start()" for a HTML browser interface to help.
Type "q()" to quit R.
> #### eval / parse / deparse etc
>
> ##- From: Peter Dalgaard BSA
> ##- Subject: Re: source() / eval() bug ??? (PR#96)
> ##- Date: 20 Jan 1999 14:56:24 +0100
> e1 <- parse(text='c(F=(f <- .3), "Tail area" = 2 * if(f < 1) 30 else 90)')[[1]]
> e1
c(F = (f <- 0.3), "Tail area" = 2 * if (f < 1) 30 else 90)
> str(eval(e1))
Named num [1:2] 0.3 60
- attr(*, "names")= chr [1:2] "F" "Tail area"
> mode(e1)
[1] "call"
>
> ( e2 <- quote(c(a=1,b=2)) )
c(a = 1, b = 2)
> names(e2)[2] <- "a b c"
> e2
c("a b c" = 1, b = 2)
> parse(text=deparse(e2))
expression(c("a b c" = 1, b = 2))
>
> ##- From: Peter Dalgaard BSA
> ##- To: r-core
> ##- Date: 22 Jan 1999 11:47
> ##- ...
> ##- This is what didn't work before:
>
> ( e3 <- quote(c(F=1,"tail area"=pf(1,1,1))) )
c(F = 1, "tail area" = pf(1, 1, 1))
> eval(e3)
F tail area
1.0 0.5
> names(e3)
[1] "" "F" "tail area"
>
> names(e3)[2] <- "Variance ratio"
> e3
c("Variance ratio" = 1, "tail area" = pf(1, 1, 1))
> eval(e3)
Variance ratio tail area
1.0 0.5
>