[R] NAs - NAs are not allowed in subscripted assignments

Carl Witthoft carl at witthoft.com
Thu Jul 24 23:26:01 CEST 2008


This may not  be exactly what the OP wanted, but it may be easier
to plow the original vectors a and b thru something like

 > alogic <-rle(!is.na(as.logical(a)))

which returns a bunch of lengths and strings of TRUEs and FALSEs .

Then play with alogic and blogic (created similarly to alogic), 
comparing to or multiplying them by a and b, and so on.



More information about the R-help mailing list