[R] NMDS QUESTION

Berend Hasselman bhh at xs4all.nl
Sun Sep 1 09:03:23 CEST 2013


On 01-09-2013, at 00:30, Simona Augyte <simona.augyte at uconn.edu> wrote:

> I'm trying to run a very simple non-metric multidimensional scaling code on
> a 8x5 character matrix.
> gr T C M B
> arcor 6 4 6 5
> corfo 24 21 23 24
> corma 25 15 26 17
> crust 3 2 6 5
> fil 15 12 15 15
> fol 11 9 6 8
> leat 10 11 13 13
> seag 2 2 2 2
> 
> My code is as follows;
> coma<-read.csv("coma.csv",header=TRUE)
> coma.x<-as.matrix(coma)
> coma.dist <- dist(coma.x) # right here I get a warning message -> In
> dist(coma.x) : NAs introduced by coercion
> 
> WHAT DOES THAT MEAN??? the table has values and there are not NAs. Could
> this be a by product of the way I inserted the data?
> 

Yes.
Your table contains characters and not numbers.

Tell read.csv that the first column contains row names (assuming that that is indeed the case).

coma<- read.csv(text="
gr T C M B
arcor 6 4 6 5
corfo 24 21 23 24
corma 25 15 26 17
crust 3 2 6 5
fil 15 12 15 15
fol 11 9 6 8
leat 10 11 13 13
seag 2 2 2 2
",sep="",row.names=1,header=TRUE)

coma
str(coma)
dist(coma)     

Berend


> Please help.
> 
> -- 
> 
> Simona Augyte, MS
> PhD student
> Ecology and Evolutionary Biology
> University of Connecticut
> cell 707-832-7007
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list