R vegdist does not compute distances for all my sites
0
0
Entering edit mode
2.7 years ago
DNAngel ▴ 250

I'm trying to create some MDS plots for my data. I'm using vegan package's vegdist which does not produce any errors but when I view my resulting matrix there are empty values everywhere in the lower diagonal where only the upper diagonal should be empty.

my code:

data <- read.csv("nematoda.csv",header=TRUE)   # 180 samples with 22 values, 6 of which are env variables
data <- data[apply(data[,-1:-6],1,function(x) !all(x==0)),] # to get rid of sites with no species information

# Transform data into relative abundances
data.total <- decostand(data[,7:length(data)], method="total")

# Distance with Bray-Curtis
data.bray <- vegdist(data.total, method="bray")

data.bray

             1          2          3          5          7          8         10         11         12         13
2   0.00000000                                                                                                   
3   0.00000000 0.00000000                                                                                        
5   0.41421356 0.41421356 0.41421356                                                                             
7   0.00000000 0.00000000 0.00000000 0.41421356                                                                  
8   0.00000000 0.00000000 0.00000000 0.41421356 0.00000000                                                       
10  0.00000000 0.00000000 0.00000000 0.41421356 0.00000000 0.00000000                                            
            14         15         16         17         18         20         21         22         23         24
2                                                                                                                
3                                                                                                                
5                                                                                                                
7                                                                                                                
8                                                                                                                
10                                                                                                               
            25         27         28         29         30         31         32         33         34         36
2                                                                                                                
3                                                                                                                
5                                                                                                                
7                                                                                                                
8                                                                                                                
10                                                                                                               
            37         38         40         42         44         45         46         47         48         49
2                                                                                                                
3                                                                                                                
5                                                                                                                
7                                                                                                                
8                                                                                                                
10                                                                                                               
            50         51         52         53         55         56         57         58         60         61
2                                                                                                                
3                                                                                                                
5                                                                                                                
7                                                                                                                
8                                                                                                                
10                                                                                                               
            62         63         64         65         66         67         68         69         70         71
2                                                                                                                
3                                                                                                                
5                                                                                                                
7                                                                                                                
8                                                                                                                
10                                                                                                               
            72         73         75         76         77         78         79         80         81         82
2                                                                                                                
3                                                                                                                
5                                                                                                                
7                                                                                                                
8                                                                                                                
10                                                                                                               
            83         84         85         86         87         88         89         90         91         93
2                                                                                                                
3                                                                                                                
5                                                                                                                
7                                                                                                                
8                                                                                                                
10                                                                                                               
            94         95         96         97         98         99        100        101        102        103
2                                                                                                                
3                                                                                                                
5                                                                                                                
7                                                                                                                
8                                                                                                                
10                                                                                                               
           104        106        107        108        109        110        111        112        115        117
2                                                                                                                
3                                                                                                                
5                                                                                                                
7                                                                                                                
8                                                                                                                
10                                                                                                               
           118        119        120        121        122        124        125        126        127        128
2                                                                                                                
3                                                                                                                
5                                                                                                                
7                                                                                                                
8                                                                                                                
10                                                                                                               
           129        130        131        132        133        134        135        136        137        138
2                                                                                                                
3                                                                                                                
5                                                                                                                
7                                                                                                                
8                                                                                                                
10                                                                                                               
           139        140        141        142        143        144        145        147        148        149
2                                                                                                                
3                                                                                                                
5                                                                                                                
7                                                                                                                
8                                                                                                                
10                                                                                                               
           150        151        152        153        154        155        156        157        158        159
2                                                                                                                
3                                                                                                                
5                                                                                                                
7                                                                                                                
8                                                                                                                
10                                                                                                               
           160        161        162        163        164        165        166        167        168        169
2                                                                                                                
3                                                                                                                
5                                                                                                                
7                                                                                                                
8                                                                                                                
10                                                                                                               
           170        171        172        173        174        175        176        177        179
2                                                                                                     
3                                                                                                     
5                                                                                                     
7                                                                                                     
8                                                                                                     
10                                                                                                    
 [ reached getOption("max.print") -- omitted 153 rows ]

I've tried different transformations, but all the same. When I used sample datasets and even a friend's dataframe from a different project - with the exact same code I see their whole table...not sure why mine is causing an issue. A lot of my species abundance values are 0 though however so would this be causing the incomplete distance matrix?

vegan vegdist R • 524 views
ADD COMMENT

Login before adding your answer.

Traffic: 2169 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6