search for: tp3777699p3778318

Displaying 1 result from an estimated 1 matches for "tp3777699p3778318".

2011 Aug 30
4
weird apply() behavior
Hi, I had a weird results from using apply(). Here is an simple example: > y<-data.frame(list(a=c(1,NA),b=c('2k','0'))) > y ??? a???? b 1? 1?? 2k 2 NA?? 0 > apply(y,1,function(x){x<-unlist(x); if (!is.na(x[2]) & x[2]=='2k' & !is.na(x[1]) & x[1]=='1') 1 else 0} ) This should print "1 0" as output, as demonstrated by: >