Analyze the relative abundance of a bunch of traits
pcks <- c("magrittr", "plyr", "ggplot2")
a <- sapply(pcks, require, character = TRUE)
There is a data frame that looks like this:
load("../data/trait.dataframe.rda")
str(trait.dataframe)
## 'data.frame': 40258 obs. of 6 variables:
## $ Person : int 1 1 1 1 1 1 1 1 1 1 ...
## $ Transect: Factor w/ 3 levels "ax","ay","fx": 1 1 1 1 1 1 1 1 1 1 ...
## $ Location: int 1 2 3 4 5 6 7 8 9 10 ...
## $ Trait : Factor w/ 29 levels "Carbon_Source_General",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ Variable: chr "heterotrophic" "heterotrophic" "heterotrophic" "heterotrophic" ...
## $ Value : num 0.195 0.805 0.743 0.902 0.316 ...
I am not sure what its provenance is. I assume the number under Value
represents the total relative abundance of that particular trait at a location, but honestly I have no idea - I’ve looked through all of my code and nowhere found code that I’ve written to create it, though it looks like something I would have created.
Below, a whole bunch of plots of the different traits across the different locations across the different transects:
traits <- levels(trait.dataframe$Trait)
require(ggthemes)
for(t in traits){
cat(paste0("### ", t, "\r\r"))
p1 <- ggplot(trait.dataframe %>% subset(Trait == t),
aes(Location, Value, col = Variable)) + facet_wrap(.~Transect) + geom_point() + theme_few()
p2 <- ggplot(trait.dataframe %>% subset(Trait == t),
aes(Variable, Value, col = Variable)) + facet_wrap(.~Transect) + geom_boxplot() + theme_few()
p3 <- ggplot(trait.dataframe %>% subset(Trait == t),
aes(Variable, Value, col = Variable)) + facet_wrap(.~Transect) + geom_boxplot() + theme_few() + scale_y_continuous(trans='log10')
print(p1)
print(p2)
print(p3)
cat("\r\r")
}