Hi,

I have a list called "spec" in which a variable "foundOK" indicates whether or 
not the given element contains data and must be processed. I have to split the 
list and process only the good elements, and do something different later on 
with the bad elements. The code below works. However, is there a way to do the 
same thing using split(), which IMO would be more elegant?

  foundOK <- which(lapply(spec, function(f) f$foundOK) == TRUE)
  foundFail <- which(lapply(spec, function(f) f$foundOK) == FALSE)
  resFOK <- spec[foundOK]
  resFFail <- spec[foundFail]

Best,
-Michael

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to