[R] "get" problem

Liviu Andronic landronimirc at gmail.com
Wed Feb 24 22:36:45 CET 2010


On 2/24/10, Georg Ehret <georgehret at gmail.com> wrote:
>    I do not understand why this does not work...:
>
Previously I ran into this and I am also curious why it doesn't work,
but you can work around so:
> x <- NULL
> x$a <- 1:10
> x$b <- 11:20
> x
$a
 [1]  1  2  3  4  5  6  7  8  9 10

$b
 [1] 11 12 13 14 15 16 17 18 19 20

> get("x")[ "a"]
$a
 [1]  1  2  3  4  5  6  7  8  9 10

> get("x")[ "b"]
$b
 [1] 11 12 13 14 15 16 17 18 19 20

> t <- "a"
> get("x")[ t]
$a
 [1]  1  2  3  4  5  6  7  8  9 10


Liviu



More information about the R-help mailing list