Hi: I have made a lot of progress reading and manipulating large data files, thanks to the help of several of you. I am now stuck with writing the final file with the following error (see also the full transcript below): Error in as.matrix.data.frame(x) : length of dimnames[2] not equal to array extent I do not know what it means and could not find how to get around that in the manual nor in the R search page. Any idea? Thanks, jp -----------------------------> frame1 <- read.table("/Users/gattuso/zRdata/coca/oceanic.txt", >header=TRUE,sep=",") > frame2 <- read.table("/Users/gattuso/zRdata/coca/cellids.txt", >header=TRUE,sep=",") > frame1$celltype <- frame2[match(frame1$ID,frame2$ID),2] > frame1$cellid <- frame2[match(frame1$ID,frame2$ID),3] > frame1$zone <- frame2[match(frame1$ID,frame2$ID),6] > frame1$area <- frame2[match(frame1$ID,frame2$ID),7] > frame1$perimeter <- frame2[match(frame1$ID,frame2$ID),8] > write.table(frame1, file = >"/Users/gattuso/zRdata/coca/oceanictest.txt", sep = ",",eol = "\n")Error in as.matrix.data.frame(x) : length of dimnames[2] not equal to array extent -- ____________________________________________________________________ Jean-Pierre Gattuso Laboratoire d'Oc?anographie de Villefranche, UMR 7093 CNRS-UPMC B. P. 28, F-06234 Villefranche-sur-mer Cedex - France Voice: +33 (0)493763859 - Fax: +33 (0)493763834 <mailto:gattuso at obs-vlfr.fr> - http://www.obs-vlfr.fr/~gattuso -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help 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-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Fri, 18 Jan 2002, Jean-Pierre Gattuso wrote: <snip>> Error in as.matrix.data.frame(x) : length of dimnames[2] not > equal to array extent ><snip>> Any idea?My first guess would be that frame1 no longer has all its columns the same length. You might need match(,all=TRUE) or something. If this isn't the case you can do debug(as.matrix.data.frame) and then see what is getting passed to the function [use undebug(as.matrix.data.frame) to turn off debugging] -thomas Thomas Lumley Asst. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help 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-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi, I guess the length of frame1 colmun ID is not the same length as frame2's ID because your frame1 table will be created by those assignments. /D Jean-Pierre Gattuso wrote:> > Hi: > > I have made a lot of progress reading and manipulating large data > files, thanks to the help of several of you. I am now stuck with > writing the final file with the following error (see also the full > transcript below): > > Error in as.matrix.data.frame(x) : length of dimnames[2] not > equal to array extent > > I do not know what it means and could not find how to get around that > in the manual nor in the R search page. > > Any idea? > > Thanks, > jp > > ----------------------------- > > frame1 <- read.table("/Users/gattuso/zRdata/coca/oceanic.txt", > >header=TRUE,sep=",") > > frame2 <- read.table("/Users/gattuso/zRdata/coca/cellids.txt", > >header=TRUE,sep=",") > > frame1$celltype <- frame2[match(frame1$ID,frame2$ID),2] > > frame1$cellid <- frame2[match(frame1$ID,frame2$ID),3] > > frame1$zone <- frame2[match(frame1$ID,frame2$ID),6] > > frame1$area <- frame2[match(frame1$ID,frame2$ID),7] > > frame1$perimeter <- frame2[match(frame1$ID,frame2$ID),8] > > write.table(frame1, file > >"/Users/gattuso/zRdata/coca/oceanictest.txt", sep = ",",eol = "\n") > Error in as.matrix.data.frame(x) : length of dimnames[2] not equal to > array extent > > -- > ____________________________________________________________________ > Jean-Pierre Gattuso > Laboratoire d'Oc?anographie de Villefranche, UMR 7093 CNRS-UPMC > B. P. 28, F-06234 Villefranche-sur-mer Cedex - France > Voice: +33 (0)493763859 - Fax: +33 (0)493763834 > <mailto:gattuso at obs-vlfr.fr> - http://www.obs-vlfr.fr/~gattuso > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > r-help 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-help-request at stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help 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-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._