[R] NAs are not allowed in subscripted assignments

Rune Schjellerup Philosof rphilosof at health.sdu.dk
Thu Jan 8 16:14:59 CET 2009


Browse[1]> j <- c(1,2,NA)
Browse[1]> j[j==1][-1]
[1] NA
Browse[1]> j[j==1][-2]
[1] 1
Browse[1]> j[j==1][-2] <- 2
Error during wrapup: NAs are not allowed in subscripted assignments

As far as I can see, I have no NA in the lhs (not after the second
subscript anyway).
Besides, I have a single value on the rhs, so it should be allowed to
have NAs in the lhs, according to help(Extract).

What am I missing?
I can see no ambiguite as to what the result of those commands should be
(j == c(2,2,NA)).

-- 
Med venlig hilsen
Rune Schjellerup Philosof
Videnskabelig Assistent, Statistik, SDU

Telefon:  6550 3607
Email:    rphilosof at health.sdu.dk
Adresse: J.B. Winsløwsvej 9, 5000 Odense C



More information about the R-help mailing list