Re: [R] when use which()

2009-11-13 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of > soeren.vo...@eawag.ch > Sent: Friday, November 13, 2009 12:24 PM > To: r-help@r-project.org > Subject: [R] when use which() > > Hello: > &g

[R] when use which()

2009-11-13 Thread soeren . vogel
Hello: # some code to assign with and without "which" q <- 1:20; q[c(9, 12, 14)] <- NA r <- 1:20; r[c(8:9, 12:15)] <- NA s <- 1:20; s[c(8:9, 12:15)] <- NA r[q < 16] <- 0 s[which(q < 16)] <- 0 r;s # both: 0 0 0 0 0 0 0 0 NA 0 0 NA 0 NA 0 16 17 18 19 20 r <- 1:20; r[c(8:9, 12:15)] <- NA