>>>>> "Lorenz" == Lorenz Gygax <lgygax at
access.unizh.ch> writes:
Lorenz> Dear all, Many thanks to all who always so quickly respond with
Lorenz> helpful hints!
Lorenz> Currently I am working with R 0.63.1 on SuSE 5.2 which I
Lorenz> installed this morning within about half an hour: my deepest
Lorenz> compliments to the developpers! (I had still 0.62.2 before.)
Lorenz> This time I am trying the following:
> xy <- list (a= c (1, 2, NA), b= c (2, 3))
> list.name <- "xy"
> get (list.name)$a [is.na (get (list.name)$a)] <- 0
Error: couldn't find function "get<-"
> xy
$a
[1] 1 2 0
$b
[1] 2 3
Lorenz> So obvisouly R *does* what I would like it to do.
But it shouldn't and this is the real bug here!
Lorenz> How can I get
Lorenz> it to do it without the error? The problem is that I need to do
Lorenz> this within a function.
One way (maybe the most elegant?) :
xy <- list (a= c (1, 2, NA), b= c (2, 3)); list.name <- "xy"
A <- .Alias(get(list.name))
A$a[is.na(A$a)] <- 0
xy $ a # -> 1 2 0
##-- would this be a convincing example for .Alias() ??
--
Martin
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._