Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Problem 3 #
- dat3 = read.csv("http://course1.winona.edu/bdeppa/DSCI%20415/Data/Dune%20with%20Environmentals.csv")
- attach(dat3)
- install.packages("tidyr")
- library(vegan)
- library(proxy)
- library(dplyr)
- library(tidyr)
- library(MASS)
- names(dat3)
- dim(dat3)
- spec.mat = dat3 %>% select(Achimill:Callcusp)
- rowS = rowSums(spec.mat)
- spec.count = colSums(spec.mat)
- site.dist = dist(spec.mat,method="Bray")
- site.iso = isoMDS(site.dist,k=2)
- plot(site.iso$points,type = "n")
- text(site.iso$points,as.character(Site),col=as.numeric(Moisture)+1) #not sure about moisture
- colSums(spec.mat)
- ##how can we make bubble for different managment sites or use
- tspec.mat = t(spec.mat)
- spec.dist = dist(tspec.mat,method = "Bray")
- spec.iso = isoMDS(spec.dist,k=2)
- plot(spec.iso$points,type="n")
- text(spec.iso$points,as.character(row.names(tspec.mat)),col=as.numeric(Moisture)+1,cex=.7)
- ##tried to do bubbles, gave up, gg rip
- install.packages("plotly")
- library(plotly)
- p <- plot_ly(dat3, x = spec.iso$points[,1], y = spec.iso$points[,2], text = as.character(row.names(tspec.mat)),col=as.numeric(dat3$Moisture), type = 'scatter', mode = 'markers',
- marker = list(size = as.numeric(dat3$Management)*5, opacity = 0.5)) %>%
- layout(title = 'Gender Gap in Earnings per University',
- xaxis = list(showgrid = FALSE),
- yaxis = list(showgrid = FALSE))
- p
- detach(dat3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement