[R] Odp: counting columns that fulfill specific criteria

pguilha paul.guilhamon at gmail.com
Fri Jun 24 16:51:27 CEST 2011


Thanks for your reply, but that is not quite what I am looking for...I do not
want to add up all the values in the row, I want to get the number of
columns in each row that meet the criteria and then get that as a
percentage....

my understanding is that the rowSums function adds up the values does it
not? I tried your code anyways and it did not work:

Error in abs(pwdiff) >= t : 
  comparison (5) is possible only for atomic and list types

and when specifying the columns
(perc[x]<-rowSums(pwdiff[,abs(pwdiff[x,])>=thr], na.rm=T)/ncol(pwdiff)), I
get the following error:

Error in rowSums(pwdiff[, abs(pwdiff[x, ]) >= thr], na.rm = T) : 
  'x' must be an array of at least two dimensions
In addition: There were 30 warnings (use warnings() to see them)
> warnings()
Warning messages:
1: In perc[x] <- rowSums(pwdiff[, abs(pwdiff[x, ]) >= thr],  ... :
  number of items to replace is not a multiple of replacement length
...


Ive been trying to sort this out for the past three days and cannot get it
to work for some reason...I can do it SO easily in excel with a simple
macro, but doing that on a 480000x780 table inevitably crashes the
computer...

Any more help you can provide would be great, thanks!




--
View this message in context: http://r.789695.n4.nabble.com/counting-columns-that-fulfill-specific-criteria-tp3622265p3622711.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list