jim holtman wrote:
try this:
b <- c(1, 0, 1, 0, 1, 0, 1, 0, 1, 0)
p <- c(1, 3, 5, 7)
b[p] <- ifelse(b[p] == 0, 1, 0)
I'll have to look up the ifelse operator, looks like
the ternary operator used in C
b[p] = b[p]==0?1:0
Cool - thanks!
Esmail
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.