[R] Error after performing anosim function with vegan

David L Carlson dcarlson at tamu.edu
Wed May 20 16:54:08 CEST 2015

We are not going to be able to help much without the data. You say it is "more or less" the same as the example data so maybe it is "less" similar than you think. 

Another possibility is that you keep using fix() for some reason that you have not explained. That function calls edit() which can strip attributes and that can create problems with some data.frames and matrices as the manual page warns:

"Editing an R object may change it in ways other than are obvious: see the comment under edit. See edit.data.frame for changes that can occur when editing a data frame or matrix."

If you just want to look at the data use, View() not fix().

David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352

-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Brenzo
Sent: Wednesday, May 20, 2015 3:59 AM
To: r-help at r-project.org
Subject: [R] Error after performing anosim function with vegan


so I'm relatively new in R, but normally i don't have big problems by using

But today i struggle a lot with an error message that occurred the first

Error in sort.int(x, na.last = na.last, decreasing = decreasing, ...) :
  'x' must be atomic

I'm using just a normal anosim function and 2 weeks ago it was working fine
with the same files and the same script. So maybe some of you can help me.

Here is the total script:

> data <-read.csv("H:\\PhD\\Ergebnisse Versuch Norwegen\\T-RFLP\\nirK
> Adonis2.csv")
> fix (data)
> data1 <- (data [,-1])
> fix (data1)
> cca.env<- read.csv ("H:\\PhD\\Ergebnisse Versuch
> Norwegen\\T-RFLP\\env2.csv",
+ header= TRUE, )
> fix(cca.env)
> du<- vegdist(data)
> fix(du)
> attach(cca.env)
> dune.ano <- anosim(du, Sample)
> summary(dune.ano)

anosim(dat = du, grouping = Sample) 
Dissimilarity: bray 

ANOSIM statistic R:  
      Significance: 0.001 

Permutation: free
Number of permutations: 999

Error in sort.int(x, na.last = na.last, decreasing = decreasing, ...) :
  'x' must be atomic

it is more or less exactly the same matrix than in the example from R:

> data(dune)
> fix(dune)
> data(dune.env)
> fix(dune.env)
> dune.dist <- vegdist(dune)
> attach(dune.env)
> dune.ano <- anosim(dune.dist, Management)
> summary(dune.ano)

anosim(dat = dune.dist, grouping = Management) 
Dissimilarity: bray 

ANOSIM statistic R: 0.2579 
      Significance: 0.008 

Permutation: free
Number of permutations: 999

Upper quantiles of permutations (null model):
  90%   95% 97.5%   99% 
0.115 0.151 0.192 0.250 

Dissimilarity ranks between and within classes:
        0%   25%    50%     75%  100%   N
Between  4 58.50 104.00 145.500 188.0 147
BF       5 15.25  25.50  41.250  57.0   3
HF       1  7.25  46.25  68.125  89.5  10
NM       6 64.75 124.50 156.250 181.0  15
SF       3 32.75  53.50  99.250 184.0  15

Greetings Kristof

View this message in context: http://r.789695.n4.nabble.com/Error-after-performing-anosim-function-with-vegan-tp4707444.html
Sent from the R help mailing list archive at Nabble.com.

R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
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