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@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.