[R] missing values

From: elyakhlifi mustapha <elyakhlifi_mustapha_at_yahoo.fr>
Date: Wed, 02 May 2007 09:38:49 +0000 (GMT)


hello,
I need your help for this example

> for(k in LR) {

+ donGeno[[k]] <- as.numeric(levels(factor(subset(don2, Id_Essai == 1006961 & Id_Cara == LC[1] & Id_Rep == k, select = Id_Geno)[,1]))) + print(donGeno[[k]])}

 [1] 65125 65126 65127 65128 65129 65130 65131 65132 65133 65134 65135 65136 65137 65138 65139 65140 65141 65142 65143 65144 65171
 [1] 65126 65127 65128 65129 65130 65131 65132 65133 65134 65135 65136 65137 65138 65139 65140 65141 65142 65143 65144 65171
 [1] 65125 65126 65127 65128 65129 65130 65131 65132 65133 65134 65135 65136 65137 65138 65139 65140 65141 65142 65143 65144 65171

there are a missing value for the vector donGeno[[2]] in fact there aren't the value 65125 and I wanna cut this value in the others vectors and I tried to do this as follow

C <- vector()
for(k in LR) {
C[k] <- length(donGeno[[k]])
}
print(C)
na=match(rep(0,length(C)-sum(match(C,C[1],nomatch=0))),match(C,C[1],nomatch=0)) #print(na)
if(na==length(C)){
pos=match(0,match(donGeno[[na-1]],donGeno[[na]],nomatch=0)) for(k in 1:(na-1)) {
donGeno[[k]] <- donGeno[[k]][1:(na-1)]
}
}
else{
pos=match(0,match(donGeno[[na+1]],donGeno[[na]],nomatch=0)) for(k in 1:(.....))
}

but I wonder if there's better from this script....?       


        [[alternative HTML version deleted]]



R-help_at_stat.math.ethz.ch 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. Received on Wed 02 May 2007 - 09:44:21 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 02 May 2007 - 13:31:53 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.