I don´t know if it is a bug, but what's wrong in the folloing (R version 1.1.1, August 15, 2000, under windows 98):> x<-matrix(nrow=10, ncol=2) > for (i in 1:10)+ { + x[i][1]<-i + x[i][2]<-i^2 + } Warning messages: 1: number of items to replace is not a multiple of replacement length 2: number of items to replace is not a multiple of replacement length 3: number of items to replace is not a multiple of replacement length 4: number of items to replace is not a multiple of replacement length 5: number of items to replace is not a multiple of replacement length 6: number of items to replace is not a multiple of replacement length 7: number of items to replace is not a multiple of replacement length 8: number of items to replace is not a multiple of replacement length 9: number of items to replace is not a multiple of replacement length 10: number of items to replace is not a multiple of replacement length Thanks Armando Ferreira ---------------------------------------------------------------------------- ------------- Armando Mateus Ferreira Escuela Técnica Superior de Inginieros Agrónomos y Montes Universidad de Córdoba-España Avda. Menendez Pidal, 14080 Córdoba td2mafea@uco.es Escola Superior Agrária 6000 Castelo Branco-Portugal armando@esa.ipcb.pt -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
td2mafea@uco.es writes:> I don´t know if it is a bug, but what's wrong in the folloing (R version > 1.1.1, August 15, 2000, under windows 98): > > x<-matrix(nrow=10, ncol=2) > > for (i in 1:10) > + { > + x[i][1]<-i > + x[i][2]<-i^2 > + } > Warning messages: > 1: number of items to replace is not a multiple of replacement length > 2: number of items to replace is not a multiple of replacement lengthNot a bug. You mean x[i,1] etc. Notice that single-indexing a matrix ignores dimensions:> x<-matrix(1:20,nrow=10, ncol=2) > x[1][1] 1> x[12][1] 12 -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._