Jim,

The next step for understanding what happens is to subset a complicated
expression
 and see what its sub-pieces are doing.
Since
  apply(a[!is.na(a)],2,sum)
doesn't work, start by looking at each of the arguments to apply.
You already verified that
  !is.na(a)
gives what you want.  Now take the next step and see that
  a[!is.na(a)]
doesn't give what you want.

Looking at nested sets of sub-expressions is the key to learning R.

Rich

        [[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