I have some data from a toxicity assay. My response variable is Plutei
, which is the number of normal-shaped larvae (6 replicates), collected:
- from 2 different species
- in 5 different times of the year
- in 3 different sites.
I've treated this larvae with:
- 3 different metals
- each one with 6 different concentrations (to analyse the toxicity).
I want to evaluate the significance of each factor (and their interaction) in the Plutei
response that I measured, and I wanted to do it with the adonis
function in the vegan
package, version 2.2-1.
I've created a data frame like this:
Time Species Site Metal Concentration Plutei Replicates
T1 Paracentrotus Antignano Zn 60 78 1
T1 Paracentrotus Antignano Zn 60 78 2
T1 Paracentrotus Antignano Zn 60 77 3
T1 Paracentrotus Antignano Zn 60 80 4
T1 Paracentrotus Antignano Zn 60 80 5
T1 Paracentrotus Antignano Zn 60 79 6
T1 Paracentrotus Antignano Zn 70 70 1
T1 Paracentrotus Antignano Zn 70 69 2
T1 Paracentrotus Antignano Zn 70 70 3
T1 Paracentrotus Antignano Zn 70 71 4
This is str(mydata)
:
str(mydata) 'data.frame': 3241 obs. of 7 variables:
$ Time : Factor w/ 6 levels "T1","T2","T3",..: 6 1 1
$ Species : Factor w/ 3 levels "Arbacia","Paracentrotus",..: 3 2
$ Site : Factor w/ 4 levels "Antignano","Chioma",..: 4 1
$ Metal : Factor w/ 4 levels "Cd","Cu","Metal",..: 3 4
$ Concentration: Factor w/ 23 levels "100","100/70",..: 23 15 1
$ Plutei : Factor w/ 90 levels "0","1","10","11",..: 90 77 77 76
$ Repl : Factor w/ 7 levels "1","2","3","4",..: 7 1 2 3 4 5 6 1 2 3 ...
When I try to run the adonis
function,
perm <- adonis(Plutei ~ Time * Species * Site * Metal, data = mydata, permutations = 999)
I get this message:
Error in rowSums(x, na.rm = TRUE) :
'x' must be an array of at least two dimensions
What am I doing wrong?