NewField4R <- read.csv("~/Desktop/R stuff/NewField4R.csv") groundshelter<-NewField4R$X.Ground.shelter plantshelter<-NewField4R$X.Plant.shelter verticalshelter<-NewField4R$X.Vertical.shelter fd<-rbind(groundshelter,plantshelter,verticalshelter) dimnames(fd)<-list(c("groundshelter","plantshelter", "verticalshelter"), rep(c("G. mutilata","G. oceanica","H. frenatus","L. lugubris"), 2)) chisq.test(fd) barplot(fd, beside=TRUE) #High disturbance G.mutilata vs intermediate G.mutilata vs low G.mutilata gm<-fd[,c(1,5,9)] chisq.test(gm) barplot(gm, beside = TRUE) #High disturbance G.oceanica vs intermediate vs low G.oceanica go<-fd[,c(2,6,10)] chisq.test(go) barplot(go, beside = TRUE) #High disturbance H. frenatus vs intermediate vs low H. frenatus hf<-fd[,c(3,7,11)] chisq.test(hf) barplot(hf, beside = TRUE) #High disturbance L. lugubris vs intermediate vs low L. lugubris ll<-fd[,c(4,8,12)] chisq.test(ll) barplot(ll, beside=TRUE) fisher.test(fd) Plotfielddata2 <- read.csv("~/Desktop/R Stuff/Plotfielddata2.csv") ggplot(data=Plotfielddata2, aes(x=Species, y=Count))+ geom_bar(aes(fill=Substrate), stat = "identity", position = "dodge")+ facet_wrap(~System)