-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathcoverSubturfProblems.Rmd
64 lines (49 loc) · 1.63 KB
/
coverSubturfProblems.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
title: "Subturf Maps"
author: "Francesca"
date: "`r format(Sys.time(), '%d %B %Y')`"
output: pdf_document
classoption: a4paper
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(echo = FALSE, message = FALSE)
knitr::read_chunk('../graminoidRemovals/loadData.R')
```
```{r importChunk}
#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")
```
```{r my.GR.data.import}
```
```{r subturf.GR.import}
```
```{r}
#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)
```
```{r, fig.height=11, fig.width = 7}
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")
})
```