Since you pass your entire data.frame to metaMDS(), your first error probably comes from the fact that you have included ID as one of the variables. You should look at the results of
str(dat) You can drop cases with missing values using > dat2 <- na.omit(dat) > metaMDS(dat2[,-1]) would run the analysis on all but the first column (ID) with all the cases containing complete data. But that assumes that sex and exposure are not factors. Or you could use one of the distance functions in dist() which adjust for missing values. However dist() does not have an option to use Bray-Curtis (the default in metaMDS()). Bray-Curtis is designed for comparing species counts or proportions so it is not clear that it is an appropriate dissimilarity measure for your data. Further, your data seem contain a mixture of measurement scales and/or magnitudes so some variable standardization or transformations are probably necessary before you can get any useful results from MDS. ------------------------------------- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77840-4352 -----Original Message----- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Elizabeth Beck Sent: Wednesday, May 8, 2013 3:39 PM To: r-help@r-project.org Subject: [R] NMDS with missing data? Hi, I'm trying to run NMDS (non-metric multidimensional scaling) with R vegan (metaMDS) but I have a few NAs in my data set. I've tried to run it 2 ways. The first way with my entire data set which includes variables such as ID, sex, exposure, treatment, sodium, potassium, chloride.... mydata.mds<-metaMDS(dat) I get the following error: in if (any(autotransform, noshare > 0, wascores) && any(comm < 0)) { : missing value where TRUE/FALSE needed In addition: Warning messages: 1: In Ops.factor(left, right) : < not meaningful for factors 2: In Ops.factor(left, right) : < not meaningful for factors 3: In Ops.factor(left, right) : < not meaningful for factors 4: In Ops.factor(left, right) : < not meaningful for factors 5: In Ops.factor(left, right) : < not meaningful for factors The second way with only those last biochemical variables (29 in total). mydata.mds<-metaMDS(measurements) I get this error: Error in if (any(autotransform, noshare > 0, wascores) && any(comm < 0)) { : missing value where TRUE/FALSE needed My go to "na.rm=TRUE" does nothing. Any ideas on how to account for NAs and if so which of the above options I should be using? Thanks! Elizabeth [[alternative HTML version deleted]] ______________________________________________ R-help@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. ______________________________________________ R-help@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.