-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.R
45 lines (32 loc) · 1012 Bytes
/
main.R
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
usePackage <- function(p)
{
if (!is.element(p, installed.packages()[,1]))
install.packages(p, dep = TRUE)
require(p, character.only = TRUE)
}
usePackage("tidyverse")
usePackage("magrittr")
# From XLSX/CSV -----------------------------------------------------------
data <- read_csv(file = "sampling.csv")
data$prod_stage %<>% factor(levels = c("Placement", "Farm", "Abattoir", "Retail"))
# ggplot(data = data, aes(prod_stage, pathogen, fill = did_sample)) +
# geom_tile(colour = "white") +
# facet_grid(year~commodity) +
# scale_fill_gradient(low = "white", high = "sky blue")
ggplot(data = data, aes(year, pathogen, fill = did_sample)) +
geom_tile(colour = "white") +
facet_grid(prod_stage~commodity)
# For numeric scale
# + scale_fill_gradient(low = "white", high = "sky blue")
ggsave(
"cipars_sampling_regime.png",
plot = last_plot(),
device = "png",
path = NULL,
scale = 1,
width = 25,
height = 25,
units = "cm",
dpi = 300,
limitsize = TRUE
)