[R] logical 'or' on list of vectors

Tim Bergsma timb at metrumrg.com
Fri Jun 8 14:57:05 CEST 2007


Suppose I have a list of logicals, such as returned by lapply:

Theoph$Dose[1] <- NA
Theoph$Time[2] <- NA
Theoph$conc[3] <- NA
lapply(Theoph,is.na)

Is there a direct way to execute logical "or" across all vectors?  The 
following gives the desired result, but seems unnecessarily complex.

as.logical(apply(do.call("rbind",lapply(Theoph,is.na)),2,"sum"))

Regards,

Tim



More information about the R-help mailing list