[R] NMDS QUESTION

arun smartpink111 at yahoo.com
Sun Sep 1 08:41:25 CEST 2013


HI,
coma<- read.table(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="",header=TRUE)

 coma.x<- as.matrix(coma)

str(coma.x)
# chr [1:8, 1:5] "arcor" "corfo" "corma" "crust" "fil" "fol" ...
# - attr(*, "dimnames")=List of 2
#  ..$ : NULL
#  ..$ : chr [1:5] "gr" "T" "C" "M" ...


coma.dist<- dist(coma.x)
#Warning message:
#In dist(coma.x) : NAs introduced by coercion


?dist() #documentation
# dist(x, method = "euclidean", diag = FALSE, upper = FALSE, p = 2)
# x: a numeric matrix, data frame or ‘"dist"’ object.



 coma.x<- as.matrix(coma[,-1]) #####
 str(coma.x)
# int [1:8, 1:4] 6 24 25 3 15 11 10 2 4 21 ...
# - attr(*, "dimnames")=List of 2
 # ..$ : NULL
 # ..$ : chr [1:4] "T" "C" "M" "B"


 coma.dist<- dist(coma.x)
A.K.



----- Original Message -----
From: Simona Augyte <simona.augyte at uconn.edu>
To: r-help at r-project.org
Cc: 
Sent: Saturday, August 31, 2013 6:30 PM
Subject: [R] NMDS QUESTION

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?

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