[R] I need help

From: elyakhlifi mustapha <elyakhlifi_mustapha_at_yahoo.fr>
Date: Wed, 02 May 2007 12:11:51 +0000 (GMT)


hello,
I need help because I don't understand the syntaxe "else" how can I write it for example I writed a script to cut missings values and I have errors

> if(na==length(C)){

+               pos=match(0,match(donGeno[[na-1]],donGeno[[na]],nomatch=0))
+               for(k in 1:(na-1)) {
+                                              if(pos==1) {donGeno[[k]] <- donGeno[[k]][2:C[k]]}
+        if(pos==C[k]){donGeno[[k]] <- donGeno[[k]][1:(C[k]-1)]}
+        else{donGeno[[k]] <- c(donGeno[[k]][1:(pos-1)],donGeno[[k]][(pos+1):C(k)])}
+             }
+                }

> if(na==1){
+ pos=match(0,match(donGeno[[na+1]],donGeno[[na]],nomatch=0))
+ for(k in 2:length(C)){
+ if(pos==1) {donGeno[[k]] <- donGeno[[k]][2:C[k]]}
+ if(pos==C[k]){donGeno[[k]] <- donGeno[[k]][1:(C[k]-1)]}
+ else{donGeno[[k]] <- c(donGeno[[k]][1:(pos-1)],donGeno[[k]][(pos+1):C(k)])}
+      }
+       }

> else{for(k in 1:(na-1)){

Erreur : erreur de syntaxe dans "else"
> if(pos==1) {donGeno[[k]] <- donGeno[[k]][2:C[k]]}
> if(pos==C[k]){donGeno[[k]] <- donGeno[[k]][1:(C[k]-1)]}

> else{donGeno[[k]] <- c(donGeno[[k]][1:(pos-1)],donGeno[[k]][(pos+1):C(k)])}
Erreur : erreur de syntaxe dans " else"
> }

Erreur : erreur de syntaxe dans " }"
> for(k in 1:(na-1)){
+    if(pos==1) {donGeno[[k]] <- donGeno[[k]][2:C[k]]}
+   if(pos==C[k]){donGeno[[k]] <- donGeno[[k]][1:(C[k]-1)]}
+   else{donGeno[[k]] <- c(donGeno[[k]][1:(pos-1)],donGeno[[k]][(pos+1):C(k)])}
+      }
Erreur dans C(k) : objet non interprétable comme un facteur

> }
Erreur : erreur de syntaxe dans " }"

Have you got some ideas?       


        [[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 - 12:21:27 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.