6 pts total

bovids <- read.table("http://hompal-stats.wabarr.com/datasets/bovid_occurrences.txt", header=TRUE, sep="\t")
head(bovids)
##          taxon  site count
## 1      Gazella site1   184
## 2 Connochaetes site1   185
## 3  Tragelaphus site1    91
## 4    Aepyceros site1   155
## 5      Gazella site2   291
## 6 Connochaetes site2   281

Problem 1 - 2 pts

library(tidyr)
spread_bovids <- spread(bovids, key=site, value=count)

#convert the taxon column to row.names instead, as these will be preserved in the matrix
#that we later use for the analysis
row.names(spread_bovids) <- spread_bovids$taxon
spread_bovids<-spread_bovids[,2:9]
spread_bovids
##              site1 site2 site3 site4 site5 site6 site7 site8
## Aepyceros      155   219   214   183   295   330   185   369
## Connochaetes   185   281   297   276   136   159    86   172
## Gazella        184   291   313   295    95    98    61   114
## Tragelaphus     91   145   145   155   229   260   137   295

Problem 2 - 2pts

library(ggplot2)
ggplot(aes(x=taxon, y=count, fill=taxon), data=bovids) + 
  geom_bar(stat = "identity") + 
  facet_wrap(~site) + 
  theme_bw(30) + 
  theme(axis.text.x = element_text(angle = 45, hjust = 1))