On 09/12/2007 3:04 PM, Rina Oldager Miehs wrote: > Hey > > do anyone know why this error occurs?? > >> for(i in 1:n_trait){ > + for( j in 1:n_trait){ > + rG[i,j] <- (G_o[i,j]/(sqrt(G_o[i,i]%*%G_o[j,j])) > + rP[i,j] <- (P_o[i,j]/(sqrt(P_o[i,i]%*%P_o[j,j])) > Error: unexpected symbol in: > " rG[i,j] <- (G_o[i,j]/(sqrt(G_o[i,i]%*%G_o[j,j])) > rP"
Your parentheses don't match on the rG line. You have 3 lefts and 2 rights. Duncan Murdoch >> rE[i,j] <- (R_o[i,j]/(sqrt(R_o[i,i]%*%R_o[j,j])) > + } > Error: unexpected '}' in: > " rE[i,j] <- (R_o[i,j]/(sqrt(R_o[i,i]%*%R_o[j,j])) > }" >> h2[i] <- (G_o[i,i]/P_o[i,i]) >> } > Error: unexpected '}' in "}" > > If i make parentes around each of the commands this comes instead: > >> for(i in 1:n_trait){ > + for( j in 1:n_trait){ > + (rG[i,j] <- (G_o[i,j]/(sqrt(G_o[i,i]%*%G_o[j,j]))) > + (rP[i,j] <- (P_o[i,j]/(sqrt(P_o[i,i]%*%P_o[j,j]))) > + (rE[i,j] <- (R_o[i,j]/(sqrt(R_o[i,i]%*%R_o[j,j]))) > + } > Error: unexpected '}' in: > " (rE[i,j] <- (R_o[i,j]/(sqrt(R_o[i,i]%*%R_o[j,j]))) > }" >> h2[i] <- (G_o[i,i]/P_o[i,i]) >> } > Error: unexpected '}' in "}" > > I dont understand what i am wrigthing wrong because i have a for command > rigth before this one and that works... >> for (i in 1:n_trait){ > + for ( j in 1:n_trait){ > + R_o[i,j] = P_o[i,j]-G_o[i,j] > + } > + } > > Is it because it is matrices?? > > Cincerely Rina > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org 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. ______________________________________________ R-help@r-project.org 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.