knitr::opts_chunk$set(echo = FALSE, message = FALSE) knitr::read_chunk('../graminoidRemovals/loadData.R')
#load packages library("tidyr") library("plyr") library("DBI")# also needs RMySQL installed library("dplyr") library("ggplot2") #make database connection con <- dbConnect(RMySQL::MySQL(), group = "seedclim")
#merge cover and subturf subturf_cover_thin <- full_join(my.GR.data, subturf.GR) subturf_cover_thin$problems[is.na(subturf_cover_thin$cover)] <- "no cover" subturf_cover_thin$problems[is.na(subturf_cover_thin$subTurf)] <- "no subturf" subturf_cover_thin$problems[is.na(subturf_cover_thin$problems)] <- "ok" subturf_cover_thin$problems <- as.factor(subturf_cover_thin$problems)
plyr::d_ply(subturf_cover_thin, .(turfID), function(df){ print( ggplot(df, aes(x = factor(Year), y = species, fill = cover, colour = problems, size = problems)) + geom_tile() + facet_wrap(~turfID, scales = "free_y") + #ggtitle(paste(df$turfID[1], "subturf map")) + scale_color_manual(values = c("red", "black", "grey70"), limits = levels(subturf_cover_thin$problems)) + scale_size_manual(values = c(1.2, 1.2, 0.4), limits = levels(subturf_cover_thin$problems)) + scale_fill_distiller(type = "seq", palette = "Greens", direction = 1) + guides(colour = guide_legend(override.aes = list(fill = "white"))) + theme_bw() ) cat("\n") })
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.