[R] how to convert strings back to values?

Adaikalavan Ramasamy ramasamy at cancer.org.uk
Thu Nov 10 03:56:58 CET 2005


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Å‘ 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
>




More information about the R-help mailing list