Dear All, It's Eszter from Hungary, a total beginner with R. My problem is the following: I have a dataset with binary values as a comma separated textfile. The samples are in the coloumns and the species are in the rows. I have to transpose it for the further PCoA analysis. There is no problem with reading the dataset. When I transpose the dataset, the original values become strings (instead of 0,1,0,0,1 I have "0","1","0","0","1"). The distance matrix cannot be counted from the transposed dataset, I have 2 error messages: <Warning in vegdist(tdf1, method = "jaccard", binary = FALSE, diag = FALSE, : results may be meaningless because input data have negative entries> <Error in rowSums(x, prod(dn), p, na.rm) : 'x' must be numeric> I do not understand the first, since I have only 1 and 0 in the dataset. I guess I have the second because of the strings instead of values in the dataset. Could you please help me solving these problems? I could not find anything about these in the manuals. Thank you, cheers: Eszter p.s. This is a new problem, last week I worked with a similar dataset and I did not get any error message like these. _____________________________________________________________________ Men?? cseng??hangok (MP3 is!) ??s sz??nes k??pek a mobilodra. N??lunk szinte mindent megtal??lsz, KLIKK IDE! www.7777oplogo.hu
Examples of the code you used would have helped i.e. We don't know how you transposed your matrix. Did you use t()? In any event, as.integer() may be what you need. Francisco>From: Illyes Eszter <illyese at freemail.hu> >To: r-help at stat.math.ethz.ch >Subject: [R] how to convert strings back to values? >Date: Wed, 9 Nov 2005 21:55:44 +0100 (CET) > >Dear All, > >It's Eszter from Hungary, a total beginner with R. My problem is the >following: > >I have a dataset with binary values as a comma separated textfile. The >samples are in the coloumns and the species are in the rows. > >I have to transpose it for the further PCoA analysis. There is no >problem with reading the dataset. > >When I transpose the dataset, the original values become strings >(instead of 0,1,0,0,1 I have "0","1","0","0","1"). The distance matrix >cannot be counted from the transposed dataset, I have 2 error >messages: > ><Warning in vegdist(tdf1, method = "jaccard", binary = FALSE, diag >FALSE, : results may be meaningless because input data have >negative entries> > ><Error in rowSums(x, prod(dn), p, na.rm) : 'x' must be numeric> > >I do not understand the first, since I have only 1 and 0 in the dataset. I >guess I have the second because of the strings instead of values in the >dataset. > >Could you please help me solving these problems? I could not find >anything about these in the manuals. > >Thank you, cheers: > >Eszter > >p.s. This is a new problem, last week I worked with a similar dataset >and I did not get any error message like these. > > > >_____________________________________________________________________ >Men侕 cseng侕hangok (MP3 is!) 侀s sz來nes k侀pek a mobilodra. >N佱lunk szinte mindent megtal佱lsz, KLIKK IDE! www.7777oplogo.hu > >______________________________________________ >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
Problems like these could be caused by improperly spaced columns. Try table(tdf1). If you see only "0" and "1", then you should be fine. However I suspect that you might see things like " 0", "0", " 1", "1" which means that there is a an extra space between the delimiters. Report back what you get and we can work around a solution if need be. Regards, Adai On Wed, 2005-11-09 at 21:55 +0100, Illyes Eszter wrote:> Dear All, > > It's Eszter from Hungary, a total beginner with R. My problem is the > following: > > I have a dataset with binary values as a comma separated textfile. The > samples are in the coloumns and the species are in the rows. > > I have to transpose it for the further PCoA analysis. There is no > problem with reading the dataset. > > When I transpose the dataset, the original values become strings > (instead of 0,1,0,0,1 I have "0","1","0","0","1"). The distance matrix > cannot be counted from the transposed dataset, I have 2 error > messages: > > <Warning in vegdist(tdf1, method = "jaccard", binary = FALSE, diag = > FALSE, : results may be meaningless because input data have > negative entries> > > <Error in rowSums(x, prod(dn), p, na.rm) : 'x' must be numeric> > > I do not understand the first, since I have only 1 and 0 in the dataset. I > guess I have the second because of the strings instead of values in the > dataset. > > Could you please help me solving these problems? I could not find > anything about these in the manuals. > > Thank you, cheers: > > Eszter > > p.s. This is a new problem, last week I worked with a similar dataset > and I did not get any error message like these. > > > > _____________________________________________________________________ > Men csenghangok (MP3 is!) s sznes kpek a mobilodra. > Nlunk szinte mindent megtallsz, KLIKK IDE! www.7777oplogo.hu > > ______________________________________________ > 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 >