Data Frames

It's tempting to think of data.frames as glorified matrices with better dimension names (i.e. names() and row.names() rather than dimnames()[[1]] and dimnames()[[2]] respectively) and which we can access by field name without knowing which column it is. Actually, data.frames are lists where every list item is required to be exactly the same length.

The distinction becomes important when we want to perform some operations on the data frame, especially mathematical operations. For example, if our data on taxon abudance are in a data.frame called taxon and we want the mean abundance of all species in our plots we cannot do

mean(taxon)
and get an answer. What we will get is
[1] NA Warning message: In mean.default(taxon) : argument is not numeric or logical: returning NA
because data.frames are not numerical, even if all the data in the data.frame IS numerical. Instead we have to do
mean(as.matrix(taxon))
[1] 0.05693787
So, you have two options.