library("tidyverse") library("knitr")
This vignette documents the raw data import, calculation of mean lesion values and exports the new data to "data/lesion_counts.rda" for further use in visualisation and analysis.
In the first step, the data is imported, the "m" from the distance
column is dropped and the column is converted to numeric.
A new column, SpEv
(Spread Event), is created for each location and replicated event at that location. Another new column, degrees
, is added for each transect to indicate the direction in degrees based on J. Fanning's best information.
Lastly the mean lesions counted per plant within the pot, m_lesions
is calculated for each of the transects at each distance, 0, 10, 25, 50 and 75 metres from the plots.
After the data are updated, a column for precipitation type, ptype
, is added and the spread events, SpEv
, are renamed for clarity and ordered as factors for data visualisation.
lesion_counts <- read_csv( system.file( "extdata", "lesion_counts.csv", package = "ChickpeaAscoDispersal", mustWork = TRUE ) ) %>% mutate(site = str_remove(site, " SPA")) %>% mutate(distance = as.numeric(str_replace(distance, " m", ""))) %>% unite(SpEv, c(site, rep), remove = FALSE) %>% mutate( degrees = case_when( site == "Curyo" & transect == 1 ~ 290, site == "Curyo" & transect == 2 ~ 300, site == "Curyo" & transect == 3 ~ 310, site == "Curyo" & transect == 4 ~ 320, site == "Curyo" & transect == 5 ~ 330, site == "Curyo" & transect == 6 ~ 340, site == "Curyo" & transect == 7 ~ 350, site == "Curyo" & transect == 8 ~ 360, site == "Curyo" & transect == 9 ~ 10, site == "Curyo" & transect == 10 ~ 20, site == "Horsham" & transect == 1 ~ 45, site == "Horsham" & transect == 2 ~ 55, site == "Horsham" & transect == 3 ~ 65, site == "Horsham" & transect == 4 ~ 75, site == "Horsham" & transect == 5 ~ 85, site == "Horsham" & transect == 6 ~ 95, site == "Horsham" & transect == 7 ~ 105, site == "Horsham" & transect == 8 ~ 115, site == "Horsham" & transect == 9 ~ 125, site == "Horsham" & transect == 10 ~ 135, site == "pbc" & transect == 1 ~ 45, site == "pbc" & transect == 2 ~ 55, site == "pbc" & transect == 3 ~ 65, site == "pbc" & transect == 4 ~ 75, site == "pbc" & transect == 5 ~ 85, site == "pbc" & transect == 6 ~ 95, site == "pbc" & transect == 7 ~ 105, site == "pbc" & transect == 8 ~ 115, site == "pbc" & transect == 9 ~ 125, site == "pbc" & transect == 10 ~ 135 ) ) %>% mutate( ptype = case_when( SpEv == "pbc_1" ~ "irrigation", SpEv == "pbc_2" ~ "irrigation", SpEv == "pbc_3" ~ "mixed", SpEv == "Horsham_1" ~ "rainfall", SpEv == "Horsham_2" ~ "rainfall", SpEv == "Curyo_1" ~ "rainfall" ) ) %>% mutate( site = case_when( site == "pbc" ~ "Horsham irrigated", site == "Horsham" ~ "Horsham dryland", site == "Curyo" ~ "Curyo" ) ) %>% mutate( SpEv = case_when( SpEv == "pbc_1" ~ "Horsham Irrg 1", SpEv == "pbc_2" ~ "Horsham Irrg 2", SpEv == "pbc_3" ~ "Horsham Mixd 1", SpEv == "Horsham_1" ~ "Horsham Rain 1", SpEv == "Horsham_2" ~ "Horsham Rain 2", SpEv == "Curyo_1" ~ "Curyo Rain 1" ) ) %>% mutate_at(vars(SpEv, site, rep), factor) %>% mutate(m_lesions = rowMeans(select(., counts_p1:counts_p5), na.rm = TRUE)) %>% select(-dist_stat) %>% arrange(SpEv, transect, distance) kable(lesion_counts)
Save lesion count data for use in visualisation and modelling. This only needs to be done once.
save(lesion_counts, file = "../data/lesion_counts.rda")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.