i'm new on R so my question will be really simple ... I want to sums to columns let's say the columns "apinten" et "apmod". I want R to ignore Na if there is Na in only one of the two columns, but I want him to report "Na" if the two columns are Na ... For the moment I did it :
etude1<-within(etude1,{mvpascore<-rowSums(cbind(apinten,apmod), na.rm = T, dims = 1)})
and it
etude1<-within(etude1,{mvpascore<-apply(cbind(apinten,apmod), 1, sum, na.rm = TRUE)})
With these commands, if only one is missing R report me only the value of the other one in the new columns, but if both columns apinten and apmod are Na, R report me the value "0" in the news columns ... 0 is a value and I don't want it ...
Thank you very much by advance :) Cyril
Aucun commentaire:
Enregistrer un commentaire