Updated: 07 January, 2020
This document evaluates willow height measurement data from project inception through 2019. Data include those archived on the “Digital Collections of Colorado” (DCC) library site and more recent (2015-2019) data.
DCC links:
Plant level fall current annual growth and height on experimental plots in Yellowstone’s Northern Range, 2002 - 2015: http://hdl.handle.net/10217/173649
Plant level fall current annual growth and height on observation plots in Yellowstone’s Northern Range, 2008 - 2015: http://hdl.handle.net/10217/173657
read_sheets <- function(file){
xlsx_file <- file
xlsx_file %>%
excel_sheets() %>%
set_names() %>%
map_df(read_excel, path = xlsx_file, .id = 'sheet_name', trim_ws = TRUE, skip = 1, col_types = "text", range = "A2:DW700") %>%
mutate(file_name = file) %>%
select(file_name, sheet_name, everything())
}
##
read_sheets_prod <- function(file){
xlsx_file <- file
xlsx_file %>%
excel_sheets() %>%
set_names() %>%
map_df(read_excel, path = xlsx_file, .id = 'sheet_name', trim_ws = TRUE, skip = 1, col_types = "text", range = "A2:DW700") %>%
mutate(file_name = file) %>%
select(file_name, sheet_name, everything())
}
read_sheets_prod18 <- function(file){
xlsx_file <- file
xlsx_file %>%
excel_sheets() %>%
set_names() %>%
# map_df(read_excel, path = xlsx_file, .id = 'sheet_name', trim_ws = TRUE, skip = 1, col_types = "text", range = "A2:Dw136") %>%
map_df(read_excel, path = xlsx_file, .id = 'sheet_name', trim_ws = TRUE, skip = 1, col_types = "text", range = "A2:DW700") %>%
mutate(file_name = file) %>%
select(file_name, sheet_name, everything())
}
read_sheets_util <- function(file){
xlsx_file <- file
xlsx_file %>%
excel_sheets() %>%
set_names() %>%
map_df(read_excel, path = xlsx_file, .id = 'sheet_name', trim_ws = TRUE, skip = 1, col_types = "text", range = "A2:DW700") %>%
mutate(file_name = file) %>%
select(file_name, sheet_name, everything())
}
## read xlsx then csv cache
read_then_csv <- function(sheet, path) {
pathbase <- path %>%
basename() %>%
tools::file_path_sans_ext()
path %>%
read_excel(sheet = sheet) %>%
write_csv(paste0(pathbase, "-", sheet, ".csv"))
}
## plotting
ggTile_yr_season_site2 <- function(df){
df %>%
group_by(yr, season, site2) %>%
summarise(n= n()) %>%
ggplot(aes(yr, site2)) +
geom_tile(aes(fill = n), color = 'white') +
viridis::scale_fill_viridis(option = "B") +
facet_wrap(~season) +
theme(axis.text.x = element_text(angle = 55, hjust = 1, size = 7)) +
theme(axis.text.y = element_text(size = 7)) +
facet_wrap(~season)}
ggTile_yr_season_site <- function(df){
df %>%
group_by(yr, season, site) %>%
summarise(n= n()) %>%
ggplot(aes(yr, site)) +
geom_tile(aes(fill = n), color = 'white') +
viridis::scale_fill_viridis(option = "D") +
theme(axis.text.x = element_text(angle = 55, hjust = 1, size = 7)) +
theme(axis.text.y = element_text(size = 7)) +
facet_wrap(~season)}
##
ggTile_yr_season_plot <- function(df){
df %>%
group_by(yr, plot, season, site) %>%
summarise(n= n()) %>%
ggplot(aes(plot, site)) +
geom_tile(aes(fill = n), color = 'white') +
viridis::scale_fill_viridis(option = "B") +
facet_wrap(~season) +
theme(axis.text.x = element_text(angle = 55, hjust = 1, size = 9)) +
theme(axis.text.y = element_text(size = 8)) +
facet_wrap(yr~season)
}
#
##
ggTile_yr_season_plot_alt1 <- function(df){
df %>%
group_by(yr, plot, season, site) %>%
summarise(n= n()) %>%
ggplot(aes(yr, site)) +
geom_tile(aes(fill = n), color = 'white') +
viridis::scale_fill_viridis(option = "A") +
# facet_wrap(~season) +
facet_grid(season~plot) +
theme(axis.text.x = element_text(angle = 55, hjust = 1, size = 9)) +
theme(axis.text.y = element_text(size = 8))
}
### ggpoint
ggPoint_yr_site_season_plot <- function(df){
df %>%
ggplot(aes(yr, pl_ht_cm)) +
geom_point(aes(color = plot, shape = plot)) +
facet_wrap(~site, ncol = 4) +
theme(axis.text.x = element_text(angle = 90, hjust = 1, size = 9)) +
theme(axis.text.y = element_text(size = 8)) +
viridis::scale_color_viridis(discrete = TRUE, option = "C") +
labs(y = "Height (cm)")
}
### ggqc
### gt table summary
tbqc_exp <- function(df){
df %>%
filter(plot != "obs") %>%
group_by(site,yr, season, plot) %>%
summarise(n = count(), ht_mean = mean(pl_ht_cm, na.rm = TRUE), ht_sd = sd(pl_ht_cm, na.rm = TRUE)) %>%
gt()
}
tbqc_obs <- function(df){
df %>%
filter(plot == "obs") %>%
group_by(site,yr, season, plot) %>%
summarise(n = count(), ht_mean = mean(pl_ht_cm, na.rm = TRUE), ht_sd = sd(pl_ht_cm, na.rm = TRUE)) %>%
gt()
}
### Table funcs
gt_tally_site_plot_yr_season <- function(df){
df %>%
group_by(yr, plot, season, site) %>%
tally() %>%
gt::gt() %>%
tab_header(title = "tally")
}
## gt field names
names.gt <- function(df){
df %>%
names() %>% enframe %>% gt::gt() %>%
tab_header(title = "field names")
}
names.dt <- function(df){
df %>%
names() %>% enframe %>%
DT::datatable(caption = "field names")
}
## wilid_full spp lookup
lu_wilid_full_spp <- read_csv("./data/lu_wilid_full_spp.csv")
## bv occ
lu_site_beav <- read_csv("./data/lu_site_site2_beav.csv")
### try to add spp info to the 18 and 19
wilid.spp.lu2 <- read_csv("./data/wilid_spp._lu_v2.csv") %>%
select(c(species, wilid_full)) %>%
distinct()
## change ref system to start with lu
lu.wilid.spp.v2 <- read_csv("./data/wilid_spp._lu_v2.csv") %>%
select(c(species, wilid_full)) %>%
distinct()
# lu.wilid.spp.v2 %>%
# tabyl(wilid_full)
plot.lu <- read_csv("./data/plot_lookup_master.csv",col_types = "ccccc")
## read in lu
lu_spp_site2 <- read_csv("./data/lu_spp_site2.csv")
## revised 20180228
# w_ht <- read_excel("data/Select_files/willow_height/WillowHt_2001_2017_Final.xlsx")
# dataframe comparisons
# setdiff(bigFrame, smallFrame) # dplyr solution for comparison
# comp <- setdiff(w_ht,w_ht2)
# Using functions in "comparison" package
# comparison <- compare(w_ht,w_ht2,allowAll=TRUE)
## Continuing with the file downloaded from the GDr 20180321
w_ht <- read_excel("./data/raw/ht/2016_2017_Data_Entry_Format_WillowHt_2001_2015.xlsx")
w_ht %>%
# distinct(season)
mutate(year = as.character(year)) %>%
group_by(site, season, year) %>%
tally() %>%
ggplot(aes(year, site)) +
geom_tile(aes(fill = n)) +
facet_wrap(~season) +
labs(caption = "data/raw/ht/2016_2017_Data_Entry_Format_WillowHt_2001_2015.xlsx") +
theme(axis.text.x = element_text(angle = 55, hjust = 1))
w_ht01_17 <- read_excel("data/raw/ht/WillowHt_2001_2017_QAQCd_Version.xlsx")
w_ht <- bind_rows(w_ht, w_ht01_17) %>%
# select(-c(ID, exp, dam, browse)) %>%
filter(plantht != "NA") %>%
rename(pl_ht_cm = plantht) %>%
mutate(pl_ht_cm = as.numeric(pl_ht_cm)) %>%
distinct()
### these files have no species id
Interogating other raw files looking for spring data
w_ht01_17 %>%
group_by(year, season, site) %>%
tally() %>%
ggplot(aes(as.character(year), season)) +
geom_tile(aes(fill = n)) +
labs(caption = "WillowHt_2001_2017_QAQCd_Version.xlsx")
> Still missing spring data…
## MORE SPRING DATA?!
## the experimental
nsf.ht.spr <- read_delim("./data/NSF_DataArchive20180208/Plant_level_spring_current_annual_growth_and_height_on_experimental_plot/willows-plantCAGspring2003-2015.txt", delim = " ")
nsf.ht.spr.obs <- read_delim("./data/NSF_DataArchive20180208/Plant_level_spring_current_annual_growth_and_height_on_observation_plot/OBS-plantCAGspring2009-2013.txt", delim = " ", col_types = "cccccddcccc")
# clean. rename
nsf.ht.spr <- nsf.ht.spr %>%
select(year, site, plot, species, willid, plantht) %>%
rename(yr = year, wilid = willid, pl_ht_cm = plantht) %>%
mutate(season = "spring")
nsf.ht.spr.obs <- nsf.ht.spr.obs %>%
select(year, site, plot, species, willid, plantht) %>%
rename(yr = year, wilid = willid, pl_ht_cm = plantht)
# clean. na
nsf.ht.spr <- nsf.ht.spr %>%
filter(!is.na(pl_ht_cm)) %>%
mutate(season = "spring") %>%
mutate(yr = as.character(yr)) %>%
mutate(wilid = as.character(wilid))
nsf.ht.spr.obs <- nsf.ht.spr.obs %>%
filter(!is.na(pl_ht_cm)) %>%
mutate(season = "spring") %>%
mutate(plot = "obs")
## combine obs and exp for spring
nsf.ht.spr <- bind_rows(nsf.ht.spr,nsf.ht.spr.obs)
# clean
nsf.ht.spr <- nsf.ht.spr %>%
mutate(plot = if_else(is.na(site),"obs",plot)) %>%
filter(!is.na(plot))
nsf.ht.spr %>%
# distinct(site)
visdat::vis_miss() +
labs(caption = "nsf.ht.spr")
nsf.ht.spr %>%
mutate(site2 = paste0(site,"-",plot)) %>%
ggTile_yr_season_site2() +
labs(caption = "nsf.ht.spr")
# nsf.ht.spr %>%
# mutate(site2 = paste0(site,"-",plot)) %>%
# group_by(site2, yr) %>%
# tally() %>%
# ungroup() %>%
# ggplot(aes(yr, site2)) +
# geom_tile(aes(fill = n)) +
# labs(title = "Spring DCC combined obs and exp files", caption = "nsf.ht.spr")
## Fa raw DCC
nsf.ht.fa.exp <- read_delim("./data/NSF_DataArchive20180208/Plant_level_fall_current_annual_growth_and_height_on_experimental_plot/willows-plantCAGfall2002-2015.txt", delim = " ") %>%
select(year, site, plot, species, willid, height) %>%
rename(yr = year, wilid = willid, pl_ht_cm = height) %>%
mutate(season = "fall")
nsf.ht.fa.obs <- read_delim("./data/NSF_DataArchive20180208/Plant_level_fall_current_annual_growth_and_height_on_observation_plot/OBS_shootCAGfall08-15.txt", delim = " ") %>%
select(year, site, plot, species, willid, height) %>%
rename(yr = year, wilid = willid, pl_ht_cm = height) %>%
mutate(season = "fall")
## combine raw dcc exp and obs
nsf.ht.fa.expobs <- bind_rows(nsf.ht.fa.exp, nsf.ht.fa.obs) %>%
distinct() %>%
mutate(yr = as.character(yr), wilid = as.character(wilid))
## dcc combined
dcc.ht.fa.spr <- bind_rows(nsf.ht.fa.expobs, nsf.ht.spr) %>%
mutate(wilid = as.character(wilid)) %>%
distinct()
dcc.ht.fa.spr %>%
mutate(site2 = paste0(site,"-",plot)) %>%
ggTile_yr_season_site2() +
labs(caption = "dcc.ht.fa.spr")
# clean. na
dcc.ht.fa.spr <- dcc.ht.fa.spr %>%
filter(!is.na(pl_ht_cm))
##
dcc.ht.fa.spr <- dcc.ht.fa.spr %>%
mutate(plot = if_else(is.na(plot),"obs",plot)) %>%
mutate(wilid_full = paste0(site,"-",plot, "-", wilid))
dcc.ht.fa.spr %>%
visdat::vis_miss()
dcc.ht.fa.spr %>%
visdat::vis_guess()
# dcc.ht.fa.spr %>%
# # filter(is.na(species)) %>%
# filter(yr != "910" & yr != "189" & yr !='36415' & yr != "355" & yr != "379") %>%
# distinct(yr, season) %>%
# gt()
## lu export
# dcc.wilid.spp.lu <- dcc.ht.fa.spr %>%
# distinct(site, plot, species, wilid, wilid_full)
#
# dcc.wilid.spp.lu %>%
# datatable()
## export
# dcc.wilid.spp.lu %>%
# write_csv("./data/dcc_wilid_spp_lu.csv")
### Pre-process data
#
# * Type conversions (e.g., ID's, treatment codes to character)
# * Identify then filter NA/missing for "plantht"
# * Create fields defining treatment classes and incorporate into siteid ("siteid2", as defined in the water table dataset)
# * Create field combining willowid (not unique across all records) with site2
#
# # RETURN HERE FOR FOR MORE QA QC
#
# # convert willow id, dam, browse, exp to character instead of integer
# w_ht <- w_ht %>%
# mutate(willid = as.character(willid)) %>%
# mutate(exp = as.character(exp)) %>%
# mutate(dam = as.character(dam)) %>%
# mutate(browse = as.character(browse))
#
# # create table of just the missing/NA for inspection
# w_ht %>%
# filter(plantht == "na" | plantht == "missing" | plantht == "NA") %>%
# datatable(caption = "Records with missing/NA/na for plantht.")
#
# ## filter out "NA", "na" and "missing"; convert "plantht" to numeric; create treatment classes in incorporate into new ID fields for summarization
# # w_ht <- w_ht %>%
# # filter(plantht != "na" & plantht != "missing" & plantht != "NA") %>%
# # mutate(plantht = as.numeric(plantht)) %>%
# # mutate(treat = case_when(dam == 1 & browse == 0 ~ "DX",
# # dam == 1 & browse == 1 ~ "DC",
# # dam == 0 & browse == 0 ~ "CX",
# # dam == 0 & browse == 1 ~ "CC",
# # dam == 2 & browse == 1 ~ "OBS")) %>%
# # mutate(site2 = paste(site, treat, sep = '-')) %>%
# # mutate(willid.site2 = paste(willid, site2, sep = '-'))
# # Note that this doesn't correctly parse the exp and obs sites, as TH pointed out.
# # So instead see the following modified code:
###
### w_ht issue
w_ht <- w_ht %>%
filter(pl_ht_cm != "na" & pl_ht_cm != "missing" & pl_ht_cm != "NA") %>%
mutate(pl_ht_cm = as.numeric(pl_ht_cm)) %>%
rename(wilid = willid) %>%
mutate(wilid_full = paste0(wilid,"=", site))
## don't think I need this bc use of lu
w_ht <- w_ht %>%
# # rename(pl_ht_cm = plantht) %>%
mutate(plot = case_when(dam == 1 & browse == 0 ~ "dx",
dam == 1 & browse == 1 ~ "dc",
dam == 0 & browse == 0 ~ "cx",
dam == 0 & browse == 1 & exp == 1 ~ "cc",
dam == 0 & browse == 1 & exp != 1 ~ "obs",
dam == 0 & browse == 1 ~ "cc",
dam == 2 & browse == 1 ~ "obs",
TRUE ~ "oth")) %>%
mutate(site2 = paste0(site, plot, sep = '-'))
# not sure on the interpretation of the "2"
# w_ht %>% distinct(dam) # Three values: 0,1,2. Expected only 0,1.
# added the site2 field to match that used in well data
# Tip: if you are testing a scalar, use if(). Testing a vector against a single condition, dplyr::if_else. Testing a vector against multiple conditions, use case_when.
w_ht <- w_ht %>%
mutate_if(.predicate = is.character,.funs=tolower)
w_ht <- w_ht %>%
mutate(site = case_when(site == "halibuff"~"hailbuf",
TRUE ~ site))
w_ht %>%
visdat::vis_dat()
# w_ht %>%
# distinct(site) %>%
# View()
WillowHt_2001_2015.csv
th.01.15 <- read_csv("./data/Yell_data_from_Hobbs_drive/Master data file/WillowHt_2001_2015.csv")
th.01.15 <- th.01.15 %>%
mutate(plot = case_when(dam == 0 & browse == 0 ~ "cx",
dam == 1 & browse == 0 ~ "dx",
dam == 0 & browse == 1 ~ "cc",
dam == 1 & browse == 1 ~ "dc",
TRUE ~ "obs"
)) %>%
select(-c(ID,exp,dam,browse)) %>%
rename(yr = year) %>%
mutate(yr = as.character(yr)) %>%
rename(wilid = willid) %>%
rename(pl_ht_cm = plantht)
th.01.15 %>%
ggTile_yr_season_site() +
labs(title = "2001-2015 data from TH file", caption = "WillowHt_2001_2015.csv")
No spring data here, except for 2001.
## see if there is data in the sprcag*.csv files
# updated as of 20191203
files_util_01_15 <- fs::dir_ls("./data/Yell_data_from_Hobbs_drive/Utilization all years", recurse = FALSE, glob = "*.csv")
sprcag.files <- enframe(files_util_01_15) %>%
rename(path = name) %>%
select(-value) %>%
separate(data = ., col = path, into = c("f1","f2","f3","f4","sprcag_file"), sep = "/", remove = FALSE) %>%
select(-starts_with("f"))
sprcag.files %>%
gt()
| path | sprcag_file |
|---|---|
| ./data/Yell_data_from_Hobbs_drive/Utilization all years/sprcag10.csv | sprcag10.csv |
| ./data/Yell_data_from_Hobbs_drive/Utilization all years/sprcag11.csv | sprcag11.csv |
| ./data/Yell_data_from_Hobbs_drive/Utilization all years/sprcag12.csv | sprcag12.csv |
| ./data/Yell_data_from_Hobbs_drive/Utilization all years/sprcag13.csv | sprcag13.csv |
| ./data/Yell_data_from_Hobbs_drive/Utilization all years/sprcag14.csv | sprcag14.csv |
| ./data/Yell_data_from_Hobbs_drive/Utilization all years/sprcag15.csv | sprcag15.csv |
| ./data/Yell_data_from_Hobbs_drive/Utilization all years/sprcag3.csv | sprcag3.csv |
| ./data/Yell_data_from_Hobbs_drive/Utilization all years/sprcag4.csv | sprcag4.csv |
| ./data/Yell_data_from_Hobbs_drive/Utilization all years/sprcag5.csv | sprcag5.csv |
| ./data/Yell_data_from_Hobbs_drive/Utilization all years/sprcag6.csv | sprcag6.csv |
| ./data/Yell_data_from_Hobbs_drive/Utilization all years/sprcag8.csv | sprcag8.csv |
| ./data/Yell_data_from_Hobbs_drive/Utilization all years/sprcag9.csv | sprcag9.csv |
sprcag.files <- files_util_01_15 %>%
map_df(~read_csv(., col_types = cols(.default = "c")))
sprcag.files.ht <- sprcag.files %>%
mutate(season = "spring") %>%
rename(wilid = willid) %>%
rename(yr = year) %>%
rename(pl_ht_cm = plantht) %>%
select(yr,season, site,plot,wilid,pl_ht_cm) %>%
mutate(pl_ht_cm = as.numeric(pl_ht_cm)) %>%
filter(!is.na(pl_ht_cm)) %>%
distinct()
sprcag.files.ht %>%
visdat::vis_dat()
sprcag.files.ht %>%
mutate(yr = as.integer(yr)) %>%
ggTile_yr_season_site() +
labs(title = "Combined 'sprcag*.csv' files")
> Note missing data
Observation sites?
files_prod_01_15 <- fs::dir_ls("./data/Yell_data_from_Hobbs_drive/Production all years", recurse = FALSE, glob = "*.csv")
# regex
# files_util_01_15 <- fs::dir_ls("./data/Yell_data_from_Hobbs_drive/Utilization all years", regexp = "\\.csv$")
prod.files <- files_prod_01_15 %>%
map_df(~read_csv(., col_types = cols(.default = "c")))
prod.files %>%
glimpse()
## Observations: 186,703
## Variables: 33
## $ year <chr> "2001", "2001", "2001", "2001", "2001", "2001", "2001", ...
## $ site <chr> "eb1", "eb1", "eb1", "eb1", "eb1", "eb1", "eb1", "eb1", ...
## $ plot <chr> "dx", "dx", "dx", "dx", "dx", "dx", "dx", "dx", "dx", "d...
## $ species <chr> "boothi", "boothi", "boothi", "geyer", "geyer", "geyer",...
## $ willid <chr> "1", "1", "1", "2", "2", "2", "3", "3", "3", "4", "4", "...
## $ height <chr> "46", "46", "46", "155", "155", "155", "64", "64", "64",...
## $ heightprev <chr> "35", "35", "35", "55", "55", "55", "45", "45", "45", "6...
## $ longdiam <chr> "83", "83", "83", "145", "145", "145", "79", "79", "79",...
## $ perpdiam <chr> "38", "38", "38", "130", "130", "130", "70", "70", "70",...
## $ totstems <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ newdead <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ newlive <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ newst1 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ newst2 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ newst3 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ newst4 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ newst5 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ newst6 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ newst7 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ newst8 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ newst9 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ newst10 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ newst11 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ stid <chr> "1", "454", "455", "2", "436", "437", "3", "438", "439",...
## $ lendiam <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ notes <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ live <chr> "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "...
## $ newstembd <chr> "10.5", "6.19", "2.79", "11.23", "11.36", "10.31", "6.3"...
## $ bigshtbd <chr> "2.5", "2.12", "2.49", "3.31", "4.21", "3.45", "1.73", "...
## $ bigshtlen <chr> "19", "21", "21.5", "58.5", "72", "64.5", "7.5", "9", "3...
## $ scheme <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ remain <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ shtmeas <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
prod.files.ht <- prod.files %>%
mutate(season = "fall") %>%
rename(wilid = willid) %>%
rename(yr = year) %>%
rename(pl_ht_cm = height) %>%
select(yr,season, site,plot,wilid,pl_ht_cm) %>%
mutate(pl_ht_cm = as.numeric(pl_ht_cm)) %>%
filter(!is.na(pl_ht_cm)) %>%
distinct()
prod.files.ht %>%
visdat::vis_dat()
prod.sprcag.ht <- bind_rows(prod.files.ht,sprcag.files.ht)
prod.sprcag.ht %>%
mutate(site2 = paste0(site,"-", plot)) %>%
ggTile_yr_season_site2() +
labs(subtitle = "Spring and Fall Data from sprcag*.csv and prod*.csv files", caption = "prod.sprcag.ht")
prod.sprcag.ht %>%
mutate(site2 = paste0(site,"-", plot)) %>%
ggTile_yr_season_site()
Note: where are the obs sites?
Error in files with eb4-cc?
p16.raw <- read_excel("./data/raw/production/2016_Raw_Production_20180421.xlsx", col_types = "text") %>%
janitor::clean_names()
p16.raw <- p16.raw %>%
rename(wilid = wildid) %>%
rename(species = spp) %>%
rename(pl_ht_cm = height_cm) %>%
# rename(live_dead = live) %>%
mutate(season = "spring") %>%
mutate(yr = as.character("2019"))
# some cleaning
p16.raw <- p16.raw %>%
mutate(plot = if_else(is.na(plot),"obs",plot)) %>%
mutate(site2 = paste0(site, "-", "plot")) %>%
filter(wilid != "?") %>%
mutate(wilid = str_remove(.$wilid, ".0"))
p16.ht <- p16.raw %>%
select(c(site, site2, plot, species, wilid, pl_ht_cm, site)) %>%
mutate(wilid_full = paste0(site,"-",plot,"-",wilid))
p16.ht %>%
visdat::vis_miss()
# p16.ht <- p16.ht %>%
# left_join(., lu.wilid.spp.v2, by = "wilid_full") %>%
# mutate(species = case_when(is.na(species.x)~species.y,
# is.na(species.y)~species.x,
# TRUE ~ "NA")) %>%
# select(-c(species.x, species.y))
p16.ht <-
p16.ht %>%
# filter(!is.na(pl_ht_cm)) %>%
filter(!is.na(wilid))
p16.ht %>%
visdat::vis_dat()
# u16.ht %>%
# filter(is.na(species))
p16.ht <- p16.ht %>%
select(-c(species)) %>%
mutate(yr = as.character("2016")) %>%
mutate(season = "fall") %>%
distinct()
p16.ht %>%
ggTile_yr_season_site() +
labs(caption = "p16.ht")
The following show what I know now: NO SPRING DATA FOR 2016
# 2016 utilization
u16.raw <- read_excel("./data/raw/utilization/Raw_2016_Utilization/2016_Raw_Utilization.xlsx", col_types = "text") %>%
janitor::clean_names()
u16.raw <- u16.raw %>%
rename(wilid = wildid) %>%
mutate(wilid = as.numeric(wilid)) %>%
mutate(wilid = as.character(wilid)) %>%
rename(species = spp) %>%
rename(pl_ht_cm = ht_cm) %>%
rename(live_dead = live) %>%
mutate(season = "spring") %>%
mutate(yr = as.character(2016))
# some cleaning
u16.raw <- u16.raw %>%
mutate(site = if_else(site == "elk5 ?", "elk5",site)) %>%
mutate(plot = if_else(is.na(plot),"obs",plot)) %>%
mutate(site = if_else(site == "xtal","crystal",site)) %>%
mutate(site2 = paste0(site, "-", "plot"))
u16.raw <- u16.raw %>%
mutate(pl_ht_cm = as.numeric(pl_ht_cm))
# u16.raw %>%
# distinct(site, plot) %>%
# datatable()
u16.ht <- u16.raw %>%
select(c(yr, season, site, plot, wilid, pl_ht_cm)) %>%
distinct() %>%
filter(is.na(pl_ht_cm))
u16.ht %>%
visdat::vis_dat()
ht_lm_entry <- read_csv("./data/raw/ht/2016_2017_Data_Entry_Format_WillowHt_2001_2015.csv")
ht_lm_entry <- ht_lm_entry %>%
janitor::clean_names() %>%
select(-id) %>%
rename(wilid = willid) %>%
mutate(plot = case_when(dam == "1" & browse == "1" ~ "dc",
dam == "1" & browse == "0" ~ "dx",
dam == "0" & browse == "1" ~ "cc",
dam == "0" & browse == "0" ~ "cx",
TRUE ~ "obs"))
ht_lm_entry <- ht_lm_entry %>%
rename(yr = year) %>%
rename(pl_ht_cm = plantht) %>%
mutate_if(.predicate = is.numeric,.funs = as.character) %>%
mutate(pl_ht_cm = as.numeric(pl_ht_cm))
ht_lm_entry %>%
mutate(site2 = paste0(site,"-",plot)) %>%
group_by(yr, season, site2) %>%
tally() %>%
filter(yr == "2017") %>%
filter(season != "fall") %>%
ggplot(aes(yr, site2)) +
geom_tile(aes(fill = n)) +
labs(caption = "Only 2017 data")
## only 2017 spring data
ht_lm_entry_17 <- ht_lm_entry %>%
filter(yr == '2017')
p17.raw <- read_excel("./data/raw/production/2017_Raw_Production_20180423.xlsx", col_types = "text") %>%
janitor::clean_names()
p17.raw %>% glimpse()
## Observations: 1,122
## Variables: 79
## $ date <chr> "8152017", "8152017", "8152017", "8152017...
## $ technician <chr> "tg sb ak hh", "tg sb ak hh", "tg sb ak h...
## $ site <chr> "wb", "wb", "wb", "wb", "wb", "wb", "wb",...
## $ plot <chr> "cx", "cx", "cx", "cx", "cx", "cx", "cx",...
## $ spp <chr> "beb", "beb", "beb", "beb", "beb", "beb",...
## $ wildid <chr> "257", "257", "257", "260", "260", "260",...
## $ sapsucker_wells_y_n <chr> "y", "y", "y", "y", "y", "y", "y", "y", "...
## $ cytospora_fungus_y_n <chr> "y", "y", "y", "y", "y", "y", "y", "y", "...
## $ height_cm <chr> "227", "227", "227", "402", "402", "402",...
## $ long_diameter_cm <chr> "115", "115", "115", "360", "360", "360",...
## $ perp_diameter_cm <chr> "65", "65", "65", "290", "290", "290", "1...
## $ number_new_dead_stems <chr> "0", "0", "0", "0", "0", "0", "0", "0", "...
## $ number_of_new_stems <chr> "3", "3", "3", "0", "0", "0", "0", "0", "...
## $ new_stem_length <chr> "43", "43", "43", NA, NA, NA, NA, NA, NA,...
## $ stem_id <chr> "11704", "25813", "5609", "262", "260", "...
## $ live <chr> "live", "live", "live", "live", "live", "...
## $ meas_extent <chr> NA, "no todos", NA, "band", "band", "band...
## $ notes <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ check_meas <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, "chec...
## $ stem_basal_mm <chr> "206", "18.5", "13.9", "37.20000000000000...
## $ biggest_shoot_diameter_mm <chr> "na", "na", "na", "na", "na", "na", "na",...
## $ long_shoot_length_cm <chr> "12", "15", NA, "15", "21", "82", "10", "...
## $ br_scheme <chr> "0", "0", "0", "0", "0", "0", "0", "0", "...
## $ ub_scheme <chr> "25", "20", "1", "70", "30", "100", "40",...
## $ sht_len_1 <chr> "2", "1", "1", "3", "1", "3", "2", "2", "...
## $ sht_len_2 <chr> "1", "3", "1", "3", "2", "4", "2", "2", "...
## $ sht_len_3 <chr> "1", "1", "2", "2", "5", "7", "2", "2", "...
## $ sht_len_4 <chr> "1", "1", "1", "4", "3", "4", "4", "2", "...
## $ sht_len_5 <chr> "1", "1", "1", "1", "1", "2", "3", "2", "...
## $ sht_len_6 <chr> "2", "1", "1", "5", "3", "2", "3", "3", "...
## $ sht_len_7 <chr> "1", "1", "1", "1", "1", "4", "2", "4", "...
## $ sht_len_8 <chr> "2", "1", "1", "2", "2", "4", "1", "2", "...
## $ sht_len_9 <chr> "1", "2", "1", "2", "2", NA, "4", "6", "1...
## $ sht_len_10 <chr> "3", "1", "1", "6", "5", NA, "3", "6", "1...
## $ sht_len_11 <chr> "3", "1", "1", "3", "11", NA, NA, "1", "2...
## $ sht_len_12 <chr> "7", "1", "1", "3", "2", NA, NA, "3", "3"...
## $ sht_len_13 <chr> "6", "1", "2", "1", "11", NA, NA, NA, "2"...
## $ sht_len_14 <chr> NA, "4", "1", "2", "3", NA, NA, NA, "2", ...
## $ sht_len_15 <chr> NA, "14", "1", NA, "1", NA, NA, NA, "3", ...
## $ sht_len_16 <chr> NA, "6", "1", NA, "2", NA, NA, NA, NA, NA...
## $ sht_len_17 <chr> NA, "2", "1", NA, "3", NA, NA, NA, NA, NA...
## $ sht_len_18 <chr> NA, "2", "1", NA, "4", NA, NA, NA, NA, NA...
## $ sht_len_19 <chr> NA, NA, "5", NA, "3", NA, NA, NA, NA, NA,...
## $ sht_len_20 <chr> NA, NA, "1", NA, "2", NA, NA, NA, NA, NA,...
## $ sht_len_21 <chr> NA, NA, "1", NA, "3", NA, NA, NA, NA, NA,...
## $ sht_len_22 <chr> NA, NA, "1", NA, "2", NA, NA, NA, NA, NA,...
## $ sht_len_23 <chr> NA, NA, "2", NA, "2", NA, NA, NA, NA, NA,...
## $ sht_len_24 <chr> NA, NA, "1", NA, "1", NA, NA, NA, NA, NA,...
## $ sht_len_25 <chr> NA, NA, "1", NA, "2", NA, NA, NA, NA, NA,...
## $ sht_len_26 <chr> NA, NA, "1", NA, "1", NA, NA, NA, NA, NA,...
## $ sht_len_27 <chr> NA, NA, "2", NA, "7", NA, NA, NA, NA, NA,...
## $ sht_len_28 <chr> NA, NA, "1", NA, "3", NA, NA, NA, NA, NA,...
## $ sht_len_29 <chr> NA, NA, "1", NA, "3", NA, NA, NA, NA, NA,...
## $ sht_len_30 <chr> NA, NA, "1", NA, "1", NA, NA, NA, NA, NA,...
## $ sht_len_31 <chr> NA, NA, "1", NA, "1", NA, NA, NA, NA, NA,...
## $ sht_len_32 <chr> NA, NA, "1", NA, "2", NA, NA, NA, NA, NA,...
## $ sht_len_33 <chr> NA, NA, "1", NA, "3", NA, NA, NA, NA, NA,...
## $ sht_len_34 <chr> NA, NA, "1", NA, "1", NA, NA, NA, NA, NA,...
## $ sht_len_35 <chr> NA, NA, "1", NA, "1", NA, NA, NA, NA, NA,...
## $ sht_len_36 <chr> NA, NA, "1", NA, NA, NA, NA, NA, NA, NA, ...
## $ sht_len_37 <chr> NA, NA, "1", NA, NA, NA, NA, NA, NA, NA, ...
## $ sht_len_38 <chr> NA, NA, "2", NA, NA, NA, NA, NA, NA, NA, ...
## $ sht_len_39 <chr> NA, NA, "2", NA, NA, NA, NA, NA, NA, NA, ...
## $ sht_len_40 <chr> NA, NA, "2", NA, NA, NA, NA, NA, NA, NA, ...
## $ sht_len_41 <chr> NA, NA, "2", NA, NA, NA, NA, NA, NA, NA, ...
## $ sht_len_42 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ sht_len_43 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ sht_len_44 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ sht_len_45 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ sht_len_46 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ sht_len_47 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ sht_len_48 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ sht_len_49 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ sht_len_50 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ sht_len_51 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ sht_len_52 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ sht_len_53 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ unbrowse_remainder <chr> "13", "8", NA, "38", "18", "82", "7", "7"...
## $ browse_remainder <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
p17.raw %>% distinct(plot)
## # A tibble: 9 x 1
## plot
## <chr>
## 1 cx
## 2 dx
## 3 cc
## 4 dc
## 5 1
## 6 <NA>
## 7 4
## 8 5
## 9 6
## bad plot data entry
p17.raw <- p17.raw %>%
# distinct(plot)
mutate(plot = case_when(is.na(plot)~"obs",
plot == "1" ~ "obs",
plot == "4" ~ "obs",
plot == "5" ~ "obs",
plot == "6" ~ "obs",
TRUE ~ plot))
p17.raw %>%
tabyl(site, plot) %>%
gt() %>%
tab_header(title = "Count of observations in 2017 raw production data")
| Count of observations in 2017 raw production data | |||||
|---|---|---|---|---|---|
| site | cc | cx | dc | dx | obs |
| crescent | 0 | 0 | 0 | 0 | 16 |
| eb1 | 36 | 28 | 57 | 60 | 0 |
| eb2 | 18 | 37 | 0 | 45 | 0 |
| elk | 49 | 78 | 38 | 70 | 9 |
| elk1 | 0 | 0 | 0 | 0 | 18 |
| elk2 | 0 | 0 | 0 | 0 | 16 |
| elk3 | 0 | 0 | 0 | 0 | 9 |
| elk4 | 0 | 0 | 0 | 0 | 15 |
| elk5 | 0 | 0 | 0 | 0 | 16 |
| ghole | 0 | 0 | 0 | 0 | 18 |
| glen | 0 | 0 | 0 | 0 | 16 |
| halibuff | 0 | 0 | 0 | 0 | 6 |
| lb | 0 | 0 | 0 | 0 | 53 |
| lb1 | 0 | 0 | 0 | 0 | 13 |
| lb2 | 0 | 0 | 0 | 0 | 22 |
| lb3 | 0 | 0 | 0 | 0 | 19 |
| lostc | 0 | 0 | 0 | 0 | 17 |
| lostl | 0 | 0 | 0 | 0 | 15 |
| oxbow | 0 | 0 | 0 | 0 | 15 |
| rose | 0 | 0 | 0 | 0 | 12 |
| slide | 0 | 0 | 0 | 0 | 8 |
| wb | 69 | 71 | 71 | 67 | 14 |
| wn | 0 | 1 | 0 | 0 | 0 |
p17.raw <- p17.raw %>%
rename(wilid = wildid) %>%
rename(species = spp) %>%
rename(pl_ht_cm = height_cm) %>%
rename(live_dead = live) %>%
mutate(season = "fall") %>%
mutate(yr = "2017") %>%
mutate(yr = as.character(yr))
# some cleaning
p17.raw <- p17.raw %>%
# mutate(site = if_else(site == "elk5 ?", "elk5",site)) %>%
mutate(plot = if_else(is.na(plot),"obs",plot)) %>%
mutate(site2 = paste0(site, "-", plot))
p17.ht <- p17.raw %>%
select(c(yr, season, site, site2, plot, species, wilid, pl_ht_cm)) %>%
mutate(wilid_full = paste0(site,"-",plot,"-",wilid))
# './data/2016_2017_Data_Entry_Format_WillowHt_2001_2015.csv'
# p17.ht <- p17.ht %>%
# left_join(., lu.wilid.spp.v2, by = "wilid_full") %>%
# mutate(species = case_when(is.na(species.x)~species.y,
# is.na(species.y)~species.x,
# TRUE ~ "NA")) %>%
# select(-c(species.x, species.y))
p17.ht <- p17.ht %>%
filter(!is.na(pl_ht_cm)) %>%
mutate(pl_ht_cm = as.numeric(pl_ht_cm))
p17.ht %>%
visdat::vis_dat()
p17.ht %>%
tabyl(site2,plot) %>%
gt() %>%
tab_header(title = "2017 Fall Count by Site2 and Plot")
| 2017 Fall Count by Site2 and Plot | |||||
|---|---|---|---|---|---|
| site2 | cc | cx | dc | dx | obs |
| crescent-obs | 0 | 0 | 0 | 0 | 16 |
| eb1-cc | 34 | 0 | 0 | 0 | 0 |
| eb1-cx | 0 | 28 | 0 | 0 | 0 |
| eb1-dc | 0 | 0 | 53 | 0 | 0 |
| eb1-dx | 0 | 0 | 0 | 59 | 0 |
| eb2-cc | 18 | 0 | 0 | 0 | 0 |
| eb2-cx | 0 | 37 | 0 | 0 | 0 |
| eb2-dx | 0 | 0 | 0 | 45 | 0 |
| elk-cc | 45 | 0 | 0 | 0 | 0 |
| elk-cx | 0 | 77 | 0 | 0 | 0 |
| elk-dc | 0 | 0 | 37 | 0 | 0 |
| elk-dx | 0 | 0 | 0 | 70 | 0 |
| elk-obs | 0 | 0 | 0 | 0 | 9 |
| elk1-obs | 0 | 0 | 0 | 0 | 4 |
| elk2-obs | 0 | 0 | 0 | 0 | 13 |
| elk3-obs | 0 | 0 | 0 | 0 | 5 |
| elk4-obs | 0 | 0 | 0 | 0 | 15 |
| elk5-obs | 0 | 0 | 0 | 0 | 16 |
| ghole-obs | 0 | 0 | 0 | 0 | 18 |
| glen-obs | 0 | 0 | 0 | 0 | 16 |
| halibuff-obs | 0 | 0 | 0 | 0 | 6 |
| lb-obs | 0 | 0 | 0 | 0 | 53 |
| lb1-obs | 0 | 0 | 0 | 0 | 13 |
| lb2-obs | 0 | 0 | 0 | 0 | 22 |
| lb3-obs | 0 | 0 | 0 | 0 | 16 |
| lostc-obs | 0 | 0 | 0 | 0 | 17 |
| lostl-obs | 0 | 0 | 0 | 0 | 15 |
| oxbow-obs | 0 | 0 | 0 | 0 | 15 |
| rose-obs | 0 | 0 | 0 | 0 | 12 |
| slide-obs | 0 | 0 | 0 | 0 | 8 |
| wb-cc | 69 | 0 | 0 | 0 | 0 |
| wb-cx | 0 | 71 | 0 | 0 | 0 |
| wb-dc | 0 | 0 | 71 | 0 | 0 |
| wb-dx | 0 | 0 | 0 | 67 | 0 |
| wb-obs | 0 | 0 | 0 | 0 | 14 |
| wn-cx | 0 | 1 | 0 | 0 | 0 |
p17.ht <- p17.ht %>%
mutate(site = case_when(site == "wn" ~ "wb",
TRUE ~ site))
p17.ht %>%
distinct(site2, plot, wilid) %>%
datatable()
p17.ht %>% distinct(wilid_full) %>% datatable()
## issue with obs plots having
p17.ht %>%
ggTile_yr_season_site2() +
labs(caption = "p17.ht")
# 2017 utilization
u17.raw <- read_excel("./data/raw/utilization/Raw_2017_Utilization/2017_Raw_Utilization.xlsx", col_types = "text") %>%
janitor::clean_names()
u17.raw <- u17.raw %>%
rename(wilid = wildid) %>%
rename(species = spp) %>%
rename(pl_ht_cm = ht_cm) %>%
rename(live_dead = live) %>%
mutate(season = "spring") %>%
mutate(yr = as.character("2017"))
# some cleaning
u17.raw <- u17.raw %>%
mutate(site = if_else(site == "elk5 ?", "elk5",site)) %>%
mutate(plot = if_else(is.na(plot),"obs",plot)) %>%
mutate(site2 = paste0(site, "-", plot))
#
u17.raw <- u17.raw %>%
filter(!is.na(pl_ht_cm)) %>%
select(c(yr, site, site2, plot, wilid, season, yr, pl_ht_cm)) %>%
mutate(wilid_full = paste0(site,"-",plot,"-",wilid)) %>%
mutate(pl_ht_cm = as.numeric(pl_ht_cm)) %>%
filter(pl_ht_cm < 800)
### summarizing by wilid
u17.ht <- u17.raw %>%
distinct()
# select(-live_dead) %>%
# u17.ht <- u17.raw %>%
# group_by(yr, site, site2, season, plot, wilid, wilid_full) %>%
# summarise(pl_ht_cm = max(pl_ht_cm)) %>%
# ungroup()
u17.ht %>%
visdat::vis_miss() +
labs(caption = "missing data, raw 2017 data")
u17.ht %>%
visdat::vis_dat() +
labs(caption = "u17.ht")
u17.ht <- u17.ht %>%
mutate(plot = case_when(site2 == "elk4-35" ~"obs",
TRUE ~ plot)) %>%
mutate(plot = case_when(site2 == "elk3-35" ~"obs",
TRUE ~ plot)) %>%
mutate(site2 = paste0(site,"-",plot)) %>%
mutate(wilid_full = paste0(site2,"-",wilid))
u17.ht %>%
ggTile_yr_season_site2()
u17.ht
gg.u17 <- u17.ht %>%
ggplot(aes(x = site2, y = pl_ht_cm)) +
geom_point(aes(color = plot)) +
coord_flip()
plotly::ggplotly(gg.u17)
## issue with obs plots having
u17.ht %>%
ggTile_yr_season_site2() +
labs(caption = "u17.ht - Spring 2017")
# updated as of 20191203
files2018 <- fs::dir_ls("./data/raw/production/Raw_2018_Production", recurse = FALSE, glob = "*.xlsx")
## csv cache
# path <- readxl_example("datasets.xlsx")
# path %>%
# excel_sheets() %>%
# set_names() %>%
# map(read_then_csv, path = path)
#### running the above function on 2018 data
# p18 <- files2018 %>%
# map_df(~ read_sheets(.))
p18 <- files2018 %>%
map_df(~ read_sheets_prod18(.))
p18 <- p18 %>%
janitor::clean_names() %>%
mutate(yr = 2018) %>%
mutate(yr = as.character(yr)) %>%
mutate(season = "fall")
## list of input raw files and tabs
p18 %>%
glimpse()
## Observations: 23,034
## Variables: 142
## $ file_name <chr> "./data/raw/production/Raw_2018_Production/cr...
## $ sheet_name <chr> "Sheet1", "Sheet1", "Sheet1", "Sheet1", "Shee...
## $ date <chr> "20180813", "20180813", "20180813", "20180813...
## $ tech_initial <chr> "LM", "LM", "LM", "LM", "LM", "LM", "HH", "HH...
## $ site <chr> "cresc", "cresc", "cresc", "cresc", "cresc", ...
## $ plot <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ spp <chr> "geyer", "geyer", "geyer", "geyer", "geyer", ...
## $ wilid <chr> "86", "86", "86", "86", "86", "86", "89", "89...
## $ stid <chr> "86", "86", "87", "87", "88", "88", "89", "89...
## $ yr_added <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ pl_ht_cm <chr> "108", "108", "108", "108", "108", "108", "68...
## $ live_status <chr> "dead", "dead", "live", "live", "live", "live...
## $ meas_extent <chr> "band", "band", "band", "band", "todos", "tod...
## $ tag_type <chr> "Silv.Rnd", "Silv.Rnd", "dogtag", "dogtag", "...
## $ notes_util_2018 <chr> "retag fall 2018, no tag only band. 2 live st...
## $ notes_prod_2018 <chr> "Silv.Rnd tag reads 87, dead stem basal: 1.4c...
## $ lrg_shoot_dia_cm <chr> "1.8", "1.8", "1.8", "1.8", "1.8", "1", "1", ...
## $ stem_basal_diam_cm <chr> "0.8", "0.8", "1.6", "1.6", "1.8", "1.8", "0....
## $ long_new_stem_len_cm <chr> "12", "12", "12", "12", "12", "12", "NA", "NA...
## $ number_live_stems_2yr <chr> "38", "38", "38", "38", "38", "38", "28", "28...
## $ number_new_dead_stems <chr> "0", "0", "0", "0", "0", "0", "0", "0", "0", ...
## $ number_new_stems_1yr <chr> "1", "1", "1", "1", "1", "1", "0", "0", "0", ...
## $ number_new_beav_cut <chr> "0", "0", "0", "0", "0", "0", "0", "0", "0", ...
## $ long_diam_cm <chr> "145", "145", "145", "145", "145", "145", "78...
## $ perp_diam_cm <chr> "86", "86", "86", "86", "86", "86", "53", "53...
## $ sapsucker_wells_y_n <chr> "N", "N", "Y", "Y", "Y", "Y", "N", "N", "Y", ...
## $ fungi_y_n <chr> "N", "N", "N", "N", "N", "N", "Y", "Y", "Y", ...
## $ sl <chr> "NA", "49", "NA", "41", "NA", "17", "NA", "9"...
## $ scheme <chr> "1", "2", "1", "7", "1", "3", "1", "1", "1", ...
## $ len_dia <chr> "D", "L", "D", "L", "D", "L", "D", "L", "D", ...
## $ rem <chr> "0", "1", "0", "6", "0", "1", "0", "0", "0", ...
## $ x1a <chr> "0.1", "0", "0.1", "0", "0.1", "0", "0.1", "0...
## $ x1b <chr> "0.2", "31", "0.2", "3", "0.3", "4", "0.2", "...
## $ x2a <chr> "0.2", "0", NA, "0", "0.1", "0", "0.2", "0", ...
## $ x2b <chr> "999", "12", NA, "3", "0.2", "1", "0.3", "7",...
## $ x3a <chr> "0.2", "0", NA, "0", NA, "0", NA, "0", NA, "0...
## $ x3b <chr> "999", "2", NA, "11", NA, "2", NA, "1", NA, "...
## $ x4a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x4b <chr> NA, "8", NA, "2", NA, "9", NA, "1", NA, "2", ...
## $ x5a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x5b <chr> NA, "25", NA, "8", NA, "5", NA, "1", NA, "5",...
## $ x6a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x6b <chr> NA, "5", NA, "1", NA, "3", NA, "2", NA, "2", ...
## $ x7a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x7b <chr> NA, "2", NA, "1", NA, "5", NA, "3", NA, "1", ...
## $ x8a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x8b <chr> NA, "2", NA, "1", NA, "2", NA, "6", NA, "2", ...
## $ x9a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x9b <chr> NA, "2", NA, "2", NA, "1", NA, "1", NA, NA, N...
## $ x10a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x10b <chr> NA, "5", NA, "3", NA, "2", NA, "6", NA, NA, N...
## $ x11a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x11b <chr> NA, "2", NA, "4", NA, "1", NA, "6", NA, NA, N...
## $ x12a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x12b <chr> NA, "29", NA, "3", NA, "2", NA, "5", NA, NA, ...
## $ x13a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x13b <chr> NA, "30", NA, NA, NA, "1", NA, "9", NA, NA, N...
## $ x14a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x14b <chr> NA, "6", NA, NA, NA, "9", NA, "7", NA, NA, NA...
## $ x15a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x15b <chr> NA, NA, NA, NA, NA, "17", NA, NA, NA, NA, NA,...
## $ x16a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x16b <chr> NA, NA, NA, NA, NA, "2", NA, NA, NA, NA, NA, ...
## $ x17a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x17b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "...
## $ x18a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x18b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "...
## $ x19a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x19b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "...
## $ x20a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x20b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "...
## $ x21a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x21b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "...
## $ x22a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x22b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "...
## $ x23a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x23b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "...
## $ x24a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x24b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "...
## $ x25a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x25b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "...
## $ x26a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x26b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "...
## $ x27a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x27b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "...
## $ x28a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x28b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "...
## $ x29a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x29b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ x30a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x30b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ x31a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x31b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ x32a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x32b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ x33a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x33b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ x34a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x34b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ x35a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x35b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ x36a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x36b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ x37a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x37b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ x38a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x38b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ x39a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x39b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ x40a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x40b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ x41a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x41b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ x42a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x42b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ x43a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x43b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ x44a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x44b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ x45a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x45b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ x46a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x46b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ x47a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x47b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ x48a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x48b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ x49a <chr> NA, "0", NA, "0", NA, "0", NA, "0", NA, "0", ...
## $ x49b <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ date_year_month_day <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ datez_year_month_day <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ date_year_month_date <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ date_year_month_day_2 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ date_year_month_dat <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ x127 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ date_2 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ stid_6 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ stid_49 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ stid_7 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ stid_50 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ yr <chr> "2018", "2018", "2018", "2018", "2018", "2018...
## $ season <chr> "fall", "fall", "fall", "fall", "fall", "fall...
### parsing errors?
p18 %>%
filter(!is.na(stid_50)) %>%
select(c(file_name,sheet_name)) %>%
datatable(caption = "Possible parsing errors")
p18 %>%
filter(!is.na(date_8_13_18_8_14_18_8_15_18)) %>%
select(c(file_name,sheet_name)) %>%
datatable(caption = "Possible parsing errors")
p18 <- p18 %>%
mutate(site = case_when(is.na(site) & wilid == "408" ~ "elk",
TRUE ~ site))
p18 <- p18 %>%
filter(!(is.na(site) & is.na(pl_ht_cm)))
p18 %>%
select(c(file_name, wilid, plot, site, pl_ht_cm)) %>%
tabyl(file_name, site) %>% gt()
# p19 %>%
# names() %>%
# tibble::enframe(name = NULL) %>%
# datatable()
## Select subset and type cast
p18sel <- p18 %>%
select(yr, season, site, plot, wilid, pl_ht_cm) %>%
mutate(pl_ht_cm = as.numeric(pl_ht_cm))
# obs for na
p18sel <- p18sel %>%
mutate(plot = if_else(condition = is.na(plot), true = "obs", plot)) %>%
filter(!is.na(pl_ht_cm))
p18sel %>%
visdat::vis_dat()
# eliminate duplicate rows
p18sel <- p18sel %>%
distinct() %>%
# select(-date) %>%
filter(!is.na(pl_ht_cm)) %>%
filter(!is.na(wilid))
p18sel <- p18sel %>%
filter(!is.na(site))
p18sel %>%
ggTile_yr_season_site() +
labs(caption = "p18sel")
p18sel %>%
ggTile_yr_season_plot() +
labs(caption = "p18sel")
# updated as of 20191203
files2019 <- fs::dir_ls("./data/raw/production/Raw_2019_Production", recurse = FALSE, glob = "*.xlsx")
p19 <- files2019 %>%
map_df(~ read_sheets_prod(.))
p19 <- p19 %>%
janitor::clean_names() %>%
mutate(yr = '2019') %>%
mutate(season = "fall")
p19 %>%
tabyl(wilid, site)
## wilid cresc crystal Crystal eb1 eb2 elk elk1 elk2 elk3 elk4 elk5 ghole glen
## 0316 0 0 0 0 0 0 0 0 0 0 0 0 0
## 1 0 0 0 0 0 0 0 0 0 0 0 0 0
## 10 0 0 0 0 0 0 0 0 0 0 0 0 0
## 101 0 0 0 0 0 0 0 0 0 0 0 0 0
## 104 0 0 0 0 0 0 0 0 0 0 0 0 0
## 1062 0 0 0 0 0 0 0 0 0 0 0 0 0
## 1067 0 0 0 0 0 0 0 0 0 0 0 0 0
## 107 0 0 0 0 0 0 0 0 0 0 0 0 0
## 1070 0 0 0 0 0 0 0 0 0 0 0 0 0
## 1073 0 0 0 0 0 0 0 0 0 0 0 0 0
## 1077 0 0 0 0 0 0 0 0 0 0 0 0 0
## 1080 0 0 0 0 0 0 0 0 0 0 0 0 0
## 1084 0 0 0 0 0 0 0 0 0 0 0 0 0
## 1087 0 0 0 0 0 0 0 0 0 0 0 0 0
## 1091 0 0 0 0 0 0 0 0 0 0 0 0 0
## 1094 0 0 0 0 0 0 0 0 0 0 0 0 0
## 110 0 0 0 0 0 0 0 0 0 0 0 0 0
## 110017 0 0 0 0 0 0 0 0 0 0 0 0 0
## 113 0 0 0 0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
## 2557 0 4 0 0 0 0 0 0 0 0 0 0 0
## 2560 0 5 0 0 0 0 0 0 0 0 0 0 0
## 2563 0 5 0 0 0 0 0 0 0 0 0 0 0
## 2566 0 6 0 0 0 0 0 0 0 0 0 0 0
## 2569 0 6 0 0 0 0 0 0 0 0 0 0 0
## 2572 0 8 0 0 0 0 0 0 0 0 0 0 0
## 2575 0 6 0 0 0 0 0 0 0 0 0 0 0
## 2578 0 6 0 0 0 0 0 0 0 0 0 0 0
## 2581 0 6 0 0 0 0 0 0 0 0 0 0 0
## 2584 0 6 0 0 0 0 0 0 0 0 0 0 0
## 2587 0 6 0 0 0 0 0 0 0 0 0 0 0
## 2630 0 0 0 6 0 0 0 0 0 0 0 0 0
## 2633 0 0 0 4 0 0 0 0 0 0 0 0 0
## 28 0 0 0 8 0 0 0 0 0 0 0 0 0
## 29 0 0 0 10 0 0 0 0 0 0 0 0 0
## 293 0 0 0 0 0 0 0 0 0 0 0 0 0
## 296 0 0 0 0 0 0 0 0 0 0 0 0 0
## 30 0 0 0 10 0 0 0 0 0 0 0 0 0
## 309 0 0 0 0 0 0 0 0 0 0 0 0 0
## 312 0 0 0 0 0 0 0 0 0 0 0 0 0
## 315 0 0 0 0 0 0 0 0 0 0 0 0 0
## 318 0 0 0 0 0 0 0 0 0 0 0 0 0
## 321 0 0 0 0 0 0 0 0 0 0 0 0 0
## 324 0 0 0 0 0 12 0 0 0 0 0 0 0
## 327 0 0 0 0 0 6 0 0 0 0 0 0 0
## 330 0 0 0 0 0 6 0 0 0 0 0 0 0
## 333 0 0 0 0 0 8 0 0 0 0 0 0 0
## 336 0 0 0 0 0 12 0 0 0 0 0 0 0
## 339 0 0 0 0 0 12 0 0 0 0 0 0 0
## 340 0 0 0 0 0 0 0 0 0 0 0 0 0
## 341 0 0 0 0 0 0 0 0 0 0 0 0 0
## 342 0 0 0 0 0 8 0 0 0 0 0 0 0
## 343 0 0 0 0 0 0 0 0 0 0 0 0 0
## 344 0 0 0 0 0 0 6 0 0 0 0 0 0
## 345 0 0 0 0 0 6 8 0 0 0 0 0 0
## 348 0 0 0 0 0 8 0 0 0 0 0 0 0
## 349 0 0 0 0 0 0 0 6 0 0 0 0 0
## 350 0 0 0 0 0 0 0 6 0 0 0 0 0
## 351 0 0 0 0 0 4 0 0 0 0 0 0 0
## 35113 0 0 0 0 0 0 0 4 0 0 0 0 0
## 35213 0 0 0 0 0 0 0 8 0 0 0 0 0
## 353 0 0 0 0 0 0 0 10 0 0 0 0 0
## 354 0 0 0 0 0 6 0 0 6 0 0 0 0
## 355 0 0 0 0 0 0 0 0 2 0 0 0 0
## 357 0 0 0 0 0 10 0 0 2 0 0 0 0
## 358 0 0 0 0 0 0 0 0 6 0 0 0 0
## 359 0 0 0 0 0 0 0 0 0 0 0 0 0
## 360 0 0 0 0 0 8 0 0 0 0 0 0 0
## 361 0 0 0 0 0 0 0 0 0 0 0 0 0
## 362 0 0 0 0 0 0 0 0 0 0 0 0 0
## 363 0 0 0 0 0 12 0 0 0 0 0 0 0
## 364 0 0 0 0 0 0 0 0 0 0 0 0 0
## 36415 0 0 0 0 0 0 0 0 0 0 0 0 0
## 365 0 0 0 0 0 6 0 0 0 0 0 0 0
## 366 0 0 0 0 0 4 0 0 0 0 0 0 0
## 368 0 0 0 0 0 0 0 0 0 0 0 0 0
## 369 0 0 0 0 0 8 0 0 0 0 0 0 0
## 371 0 0 0 0 0 0 0 0 0 0 0 0 0
## 373 0 0 0 0 0 0 0 0 0 0 0 0 0
## 374 0 0 0 0 6 0 0 0 0 0 0 0 0
## 375 0 0 0 0 6 0 0 0 0 0 0 0 0
## 376 0 0 0 0 12 0 0 0 0 0 0 0 0
## 377 0 0 0 0 16 0 0 0 0 0 0 0 0
## 378 0 0 0 0 10 0 0 0 0 0 0 0 0
## 381 0 0 0 6 0 0 0 0 0 0 0 0 0
## 4 0 0 0 0 0 0 0 0 0 0 0 0 0
## 412 0 0 0 0 0 0 0 0 0 0 0 6 0
## 414 0 6 0 0 0 0 0 0 0 0 0 0 0
## 421 0 0 0 0 0 0 0 0 0 0 0 0 0
## 427 0 0 0 0 0 0 0 0 0 0 0 0 0
## 430 0 0 0 0 0 0 0 0 0 0 0 0 0
## 433 0 0 0 0 0 0 0 0 0 0 0 0 0
## 438 0 0 0 0 0 0 0 0 0 0 0 0 0
## 441 0 0 0 0 0 0 0 0 0 0 0 0 0
## 4415 0 0 0 0 0 0 0 0 0 0 0 0 0
## 445 0 0 0 0 0 0 0 0 0 0 0 0 0
## 446 0 0 0 0 0 0 0 0 0 0 0 0 0
## 449 0 0 0 0 0 0 0 0 0 0 0 0 10
## 452 0 0 0 0 0 0 0 0 0 0 0 0 8
## 45517 0 0 0 0 0 0 0 0 0 0 0 0 4
## 457 0 0 0 0 0 0 0 0 0 0 0 0 10
## 459 0 0 0 0 0 0 0 0 0 0 0 0 10
## 465 0 0 0 0 0 0 0 0 0 0 0 0 0
## 466 0 0 0 0 0 0 0 0 0 0 0 0 0
## 47 0 0 0 0 8 0 0 0 0 0 0 0 0
## 48 0 0 0 0 6 0 0 0 0 0 0 0 0
## 49 0 0 0 0 4 0 0 0 0 0 0 0 0
## 493 0 8 0 6 0 0 0 0 0 0 0 0 0
## 499 0 0 0 6 0 0 0 0 0 0 0 0 0
## 50 0 0 0 0 8 0 0 0 0 0 0 0 0
## 501 0 0 0 0 0 0 0 0 0 0 0 0 0
## 504 0 0 0 0 0 0 0 0 0 0 0 0 0
## 507 0 0 0 0 0 0 0 0 0 0 0 0 0
## 51 0 0 0 0 6 0 0 0 0 0 0 0 0
## 510 0 0 0 0 0 0 0 0 0 0 0 0 0
## 513 0 0 0 0 0 0 0 0 0 0 0 0 0
## 516 0 0 0 0 0 0 0 0 0 0 0 0 0
## 519 0 0 0 0 12 10 0 0 0 0 0 0 0
## 52 0 0 0 0 6 0 0 0 0 0 0 0 0
## 522 0 0 0 0 0 8 0 0 0 0 0 0 0
## 525 0 0 0 0 6 6 0 0 0 0 0 0 0
## 528 0 0 0 0 8 10 0 0 0 0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717 0 0 0 0 0 0 0 0 0 0 0 0 0
## 87917 0 0 0 0 0 0 0 0 0 0 0 0 0
## 88 0 0 0 0 0 0 0 0 0 0 0 0 0
## 88317 0 0 0 0 0 0 0 0 0 0 0 0 0
## 88517 0 0 0 0 0 0 0 0 0 0 0 0 0
## 88817 0 0 0 0 0 0 0 0 0 0 0 0 0
## 89 6 0 0 0 0 0 0 0 0 0 0 0 0
## 89017 0 0 0 0 0 0 0 0 0 0 0 0 0
## 89317 0 0 0 0 0 0 0 0 2 0 0 0 0
## 9007 0 6 0 0 0 0 0 0 0 0 0 0 0
## 9009 0 6 0 0 0 0 0 0 0 0 0 0 0
## 902 0 0 0 8 0 0 0 0 0 0 0 0 0
## 904905 0 4 0 0 0 0 0 0 0 0 0 0 0
## 91 0 0 0 0 0 0 0 0 0 0 0 0 0
## 910 0 0 0 0 8 0 0 0 0 0 0 0 0
## 915 0 0 0 0 0 0 0 0 0 0 0 0 0
## 92 8 0 0 0 0 0 0 0 0 0 0 0 0
## 924 0 2 0 0 0 0 0 0 0 0 0 0 0
## 94 0 0 0 0 0 0 0 0 0 0 0 0 0
## 95 12 0 0 0 0 0 0 0 0 0 0 0 0
## 97 0 0 0 0 0 0 0 0 0 0 0 0 0
## 98 8 0 0 0 0 0 0 0 0 0 0 0 0
## NA 0 4 0 0 0 0 0 0 0 0 0 0 0
## see note 0 0 0 0 0 0 0 0 0 0 0 0 0
## <NA> 0 4 14 0 10 8 0 0 0 0 0 0 0
## hailbuff lava lb1 lb2 lb3 lb4 lb5 lb6 lost c lost l oxbow rose wb wb1 wb2 wb4
## 0 0 0 0 6 0 0 0 0 0 0 0 0 0 0 0
## 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 0 0 0 0 0 0 0 0 0 8 0 0 0 0 0 0
## 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0
## 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0
## 0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 0 0 0 0 0 0 0 0 0 0 0 0
## 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0
## 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0
## 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0
## 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 4
## yancy NA_
## 0 0
## 6 0
## 6 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 6 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 10 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 6 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 0
## 0 22028
## Select subset and type cast
p19sel <- p19 %>%
select(file_name, sheet_name, spp, yr, season, site, plot, wilid, pl_ht_cm)
p19sel <- p19sel %>%
mutate(plot = if_else(condition = (is.na(plot)), true = "obs", plot))
p19sel <- p19sel %>%
mutate(plot = case_when(plot == "1" ~ "obs",
plot == "2" ~ "obs",
plot == "3" ~ "obs",
TRUE ~ plot)) %>%
mutate(site = case_when(site == "Crystal" ~ "crystal",
site == "cresc" ~ "crescent",
TRUE ~ site))
# prep species lookup
lu.wilid.spp.v3 <- lu.wilid.spp.v2 %>%
separate(col = wilid_full, into = c("site","plot", "wilid"),sep = "-",remove = FALSE)
## create new spp lu
lu.wilid.spp.v3 <- p19sel %>%
select(file_name, site, yr, plot, wilid, spp) %>%
rename(species = spp) %>%
filter(!is.na(wilid)) %>%
distinct() %>%
mutate(wilid_full = paste0(site,"-",plot,"-", wilid)) %>%
# distinct(site, plot) %>% datatable()
bind_rows(.,lu.wilid.spp.v3) %>%
select(site, wilid, species, wilid_full) %>%
distinct()
lu.wilid.spp.v3 %>%
filter(species == "NA") %>%
gt() %>%
tab_header(title = "missing species attributes", subtitle = "2019 production")
| missing species attributes | |||
|---|---|---|---|
| 2019 production | |||
| site | wilid | species | wilid_full |
| crystal | 844 | NA | crystal-obs-844 |
| crystal | 904905 | NA | crystal-obs-904905 |
| hailbuff | 110017 | NA | hailbuff-obs-110017 |
| wb4 | 824 | NA | wb4-obs-824 |
| wb4 | 825 | NA | wb4-obs-825 |
| wb4 | 756 | NA | wb4-obs-756 |
p19sel <- p19sel %>%
filter(!(is.na(site) & is.na(pl_ht_cm)))
p19sel %>%
# filter(plot == '3') %>%
# datatable()
tabyl(site, plot) %>%
gt()
| site | cc | dc | obs |
|---|---|---|---|
| crescent | 0 | 0 | 42 |
| crystal | 0 | 0 | 298 |
| eb1 | 76 | 124 | 16 |
| eb2 | 76 | 150 | 36 |
| elk | 144 | 124 | 0 |
| elk1 | 0 | 0 | 20 |
| elk2 | 0 | 0 | 40 |
| elk3 | 0 | 0 | 20 |
| elk4 | 0 | 0 | 46 |
| elk5 | 0 | 0 | 36 |
| ghole | 0 | 0 | 18 |
| glen | 0 | 0 | 42 |
| hailbuff | 0 | 0 | 38 |
| lava | 0 | 0 | 24 |
| lb1 | 0 | 0 | 34 |
| lb2 | 0 | 0 | 48 |
| lb3 | 0 | 0 | 40 |
| lb4 | 0 | 0 | 48 |
| lb5 | 0 | 0 | 38 |
| lb6 | 0 | 0 | 38 |
| lost c | 0 | 0 | 36 |
| lost l | 0 | 0 | 32 |
| oxbow | 0 | 0 | 32 |
| rose | 0 | 0 | 24 |
| wb | 152 | 166 | 0 |
| wb1 | 0 | 0 | 42 |
| wb2 | 0 | 0 | 42 |
| wb4 | 0 | 0 | 226 |
| yancy | 0 | 0 | 34 |
# eliminate duplicate rows
p19sel <- p19sel %>%
mutate(pl_ht_cm = as.numeric(pl_ht_cm)) %>%
filter(!is.na(pl_ht_cm)) %>%
select(yr, season, site, plot, wilid, pl_ht_cm) %>%
distinct()
p19sel %>%
ggTile_yr_season_site() +
labs(caption = "p19.sel")
p19sel %>%
ggTile_yr_season_plot() +
labs(caption = "p19.sel")
## combine 18 and 19
p18p19sel <- bind_rows(p18sel, p19sel)
# visdat::vis_miss(p18p19sel)
# make all lower
p18p19sel <- p18p19sel %>%
mutate_if(.predicate = is.character,.funs=tolower)
p18p19sel <- p18p19sel %>%
filter(!is.na(pl_ht_cm))
# remove records that have na for wilid
p18p19sel <- p18p19sel %>%
filter(!is.na(wilid)) %>%
filter(!is.na(pl_ht_cm)) %>%
mutate(site = case_when(is.na(site) & wilid == "408" ~ "elk",
TRUE ~ site)) %>%
# select(-c(file_name, spp, sheet_name, stid)) %>%
mutate(site = case_when(site == "lb41" ~ "lb4",
site == 'lost c' ~ "lostc",
site == "lost l" ~ "lostl",
TRUE ~ site)) %>%
distinct()
## summarize the willow height by wilid and year
# p1819.wilidht <- p18p19sel %>%
# group_by(yr, site, spp, wilid) %>%
# summarise(pl_ht_cm = max(pl_ht_cm)) %>%
# ungroup()
p1819.wilidht <- p18p19sel
# eliminate the na for plant height
p1819.wilidht <- p1819.wilidht %>%
mutate(site2 = paste0(site,"-",plot)) %>%
mutate(wilid_full = paste0(site2,"-",wilid))
## some plots
p1819.wilidht %>% ggTile_yr_season_site() +
labs(caption = "p1819.wilidht")
p1819.wilidht %>% ggTile_yr_season_site2() +
labs(caption = "p1819.wilidht")
p1819.wilidht %>% ggTile_yr_season_plot() +
labs(caption = "p1819.wilidht")
## Additional 18 data?
#
# Here is another file containing data: Exp_2018_Production_Height_20181220.xls
# Seems to befall data, but not just for the exp sites. Not sure if it's comprehensive of what was collected in the Fall of 2018.
ht18fa.add <- read_sheets_prod(file = "./data/raw/production/Exp_2018_Production_Height_20181220.xlsx") %>%
janitor::clean_names()
ht18fa.add <- ht18fa.add %>%
select(c(site,plot,wilid, pl_ht_cm, sheet_name)) %>%
mutate(season = "fall") %>%
mutate(yr = as.character("2018")) %>%
mutate(pl_ht_cm = as.numeric(pl_ht_cm)) %>%
mutate(site2 = paste0(site,"-",plot)) %>%
mutate(wilid_full = paste0(site,"-",plot,"-",wilid)) %>%
filter(!is.na(pl_ht_cm)) %>%
filter(!is.na(site)) %>%
distinct()
### a different height file that has 2018 height data entered.
ht18fa.add %>%
ggTile_yr_season_site2() +
labs(caption = "ht18fa.add")
ht18fa.add %>%
ggTile_yr_season_site() +
labs(caption = "ht18fa.add")
##
p1819.wilidht <- ht18fa.add %>%
select(-c(sheet_name)) %>%
bind_rows(.,p1819.wilidht) %>%
distinct()
# p1819.wilidht %>% ggTile_yr_season_site2()
p1819.wilidht %>% ggTile_yr_season_plot()
Not sure whther these duplicate records in the ht data assembled from the raw production files
# inspect before rowbind
# ht18fa.add %>%
# glimpse()
#
# p1819.wilidht %>%
# glimpse()
p1819.wilidht %>% ggTile_yr_season_plot +
labs(caption = "p1819.wilidht")
ufiles2018 <- fs::dir_ls("./data/raw/utilization/Raw_2018_Utilization", recurse = FALSE, glob = "*.xlsx")
# view(ufiles2018)
## single sheet
# u18 <- ufiles2018 %>%
# map_df( ~ read_excel(path = .x,trim_ws = TRUE, skip = 1, col_types = "text"))
## add code to read multitabs...
# u18 <- ufiles2018 %>%
# map_df(~ read_sheets(.))
u18 <- ufiles2018 %>%
map_df(~ read_sheets_util(.))
# map_df( ~ read_excel(path = .x,trim_ws = TRUE, skip = 1, col_types = "text", range = "A2:DV46"))
# # note use of specific range and skipping of column
u18 <- u18 %>%
janitor::clean_names() %>%
mutate(yr = "2018") %>%
mutate(season = "spring")
u18 <- u18 %>%
mutate(pl_ht_cm = as.numeric(pl_ht_cm))
u18 %>%
tabyl(plot, site) %>%
datatable()
## whack a mole.
# change lb41 to lb4
u18 <- u18 %>%
mutate(site = case_when(site == "lb41" ~ "lb4",
TRUE ~ site))
u18 %>%
names() %>%
tibble::enframe(name = NULL) %>%
gt() %>%
tab_header(title = "variable names")
| variable names |
|---|
| value |
| file_name |
| sheet_name |
| date |
| tech_initial |
| site |
| plot |
| spp |
| wilid |
| stid |
| yr_added |
| pl_ht_cm |
| live_status |
| meas_extent |
| tag_type |
| notes_util_2018 |
| notes_prod_2018 |
| rem |
| sl |
| scheme |
| len_dia |
| x1a |
| x1b |
| x2a |
| x2b |
| x3a |
| x3b |
| x4a |
| x4b |
| x5a |
| x5b |
| x6a |
| x6b |
| x7a |
| x7b |
| x8a |
| x8b |
| x9a |
| x9b |
| x10a |
| x10b |
| x11a |
| x11b |
| x12a |
| x12b |
| x13a |
| x13b |
| x14a |
| x14b |
| x15a |
| x15b |
| x16a |
| x16b |
| x17a |
| x17b |
| x18a |
| x18b |
| x19a |
| x19b |
| x20a |
| x20b |
| x21a |
| x21b |
| x22a |
| x22b |
| x23a |
| x23b |
| x24a |
| x24b |
| x25a |
| x25b |
| x26a |
| x26b |
| x27a |
| x27b |
| x28a |
| x28b |
| x29a |
| x29b |
| x30a |
| x30b |
| x31a |
| x31b |
| x32a |
| x32b |
| x33a |
| x33b |
| x34a |
| x34b |
| x35a |
| x35b |
| x36a |
| x36b |
| x37a |
| x37b |
| x38a |
| x38b |
| x39a |
| x39b |
| x97 |
| x98 |
| x99 |
| x100 |
| x101 |
| x102 |
| x103 |
| x104 |
| x105 |
| x106 |
| x107 |
| x108 |
| x109 |
| x110 |
| x111 |
| x112 |
| x113 |
| x114 |
| x115 |
| x116 |
| x117 |
| x118 |
| x119 |
| x120 |
| x121 |
| x122 |
| x123 |
| x124 |
| x125 |
| x126 |
| x127 |
| tech_initials |
| willid |
| height_cm |
| notes_prod_2017 |
| notes_util_2019 |
| notes_prod_2019 |
| x2017_production_notes |
| x2018_utilization_notes |
| x78 |
| x79 |
| x80 |
| x81 |
| x82 |
| x83 |
| x84 |
| x85 |
| x86 |
| x87 |
| x88 |
| x89 |
| x90 |
| x91 |
| x92 |
| x93 |
| x94 |
| x95 |
| x96 |
| date_year_month_day |
| x40a |
| x40b |
| x41a |
| x41b |
| x42a |
| x42b |
| x43a |
| x43b |
| x44a |
| x44b |
| x45a |
| x45b |
| x46a |
| x46b |
| x47a |
| x47b |
| x48a |
| x48b |
| x49a |
| x49b |
| ht_cm |
| yr |
| season |
## WB?
## BIG fix: pl_ht and pl_ht_cm
## willid and wilid
u18 %>%
select(file_name,contains("cm")) %>%
distinct()
## # A tibble: 381 x 4
## file_name pl_ht_cm height_cm ht_cm
## <chr> <dbl> <chr> <chr>
## 1 ./data/raw/utilization/Raw_2018_Utilization/crescen~ 57 <NA> <NA>
## 2 ./data/raw/utilization/Raw_2018_Utilization/crescen~ NA <NA> <NA>
## 3 ./data/raw/utilization/Raw_2018_Utilization/crescen~ 50 <NA> <NA>
## 4 ./data/raw/utilization/Raw_2018_Utilization/crescen~ 52 <NA> <NA>
## 5 ./data/raw/utilization/Raw_2018_Utilization/eb1_exp~ NA 107 <NA>
## 6 ./data/raw/utilization/Raw_2018_Utilization/eb1_exp~ NA 108 <NA>
## 7 ./data/raw/utilization/Raw_2018_Utilization/eb1_exp~ NA 136 <NA>
## 8 ./data/raw/utilization/Raw_2018_Utilization/eb1_exp~ NA <NA> <NA>
## 9 ./data/raw/utilization/Raw_2018_Utilization/eb1_exp~ NA 129 <NA>
## 10 ./data/raw/utilization/Raw_2018_Utilization/eb1_exp~ NA 615 <NA>
## # ... with 371 more rows
u18 %>%
distinct(site) %>% gt()
| site |
|---|
| cresc |
| NA |
| eb1 |
| eb2 |
| elk |
| elk1 |
| elk2 |
| elk3 |
| elk4 |
| elk5 |
| ghole |
| glen |
| hailbuff |
| lava |
| lb1 |
| lb2 |
| lb3 |
| lb4 |
| lb5 |
| lb6 |
| lost c |
| lost l |
| oxbow |
| rose |
| slide |
| wb |
| wb4 |
| wb2 |
| wb1 |
| yancy |
# u18 %>% names.dt()
## !!!
u18 <- u18 %>%
mutate(height_cm = as.numeric(height_cm)) %>%
mutate(ht_cm = as.numeric(ht_cm))
u18 %>% filter(is.na(pl_ht_cm) & !is.na(height_cm)) %>%
# & is.na(ht_cm))
select(pl_ht_cm, height_cm, ht_cm) %>%
glimpse()
## Observations: 1,548
## Variables: 3
## $ pl_ht_cm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
## $ height_cm <dbl> 107, 107, 107, 107, 107, 107, 108, 108, 108, 108, 108, 10...
## $ ht_cm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N...
u18 <- u18 %>%
mutate(pl_ht_cm = if_else(condition = is.na(pl_ht_cm),true = height_cm,false = pl_ht_cm)) %>%
mutate(pl_ht_cm = if_else(condition = is.na(pl_ht_cm),true = ht_cm, false = pl_ht_cm))
u18 <- u18 %>%
mutate(wilid = case_when(is.na(wilid) ~ willid,
is.na(willid)~ wilid,
TRUE ~ wilid))%>%
filter(!is.na(pl_ht_cm)) %>%
select(-c(height_cm,willid))
### select subset of columns: for height
u18.ht <- u18 %>%
# glimpse()
select(c('file_name','yr','season', 'plot','site','wilid','pl_ht_cm')) %>%
distinct()
### 2018 crescent
u18.ht %>%
filter(!is.na(pl_ht_cm)) %>%
# distinct(site)
filter(site == "cresc") %>%
select(wilid, site, plot, pl_ht_cm)
## # A tibble: 3 x 4
## wilid site plot pl_ht_cm
## <chr> <chr> <chr> <dbl>
## 1 86 cresc obs 57
## 2 92 cresc obs 50
## 3 95 cresc obs 52
# u18.ht %>%
# distinct(pl_ht_cm) %>%
# View() # some rows have na entred as text
# rename, reclass
u18.ht <- u18.ht %>%
mutate(pl_ht_cm = as.numeric(pl_ht_cm)) %>%
mutate(plot = if_else(condition = is.na(plot), true = "obs", plot))
# clean
u18.ht <- u18.ht %>%
distinct()
# more cleaning
u18.ht <- u18.ht %>%
filter(!is.na(pl_ht_cm)) %>%
filter(wilid != "?") %>%
mutate(wilid = str_remove(.$wilid, ".0")) # remove the ".0" part of strings
##########
## Extract per wilid height from population of stid observations
##########
# u18.ht <- u18.ht %>%
# filter(!is.na(pl_ht_cm)) %>%
# group_by(yr, wilid, site, plot, season) %>%
# summarise(pl_ht_cm = max(pl_ht_cm)) %>%
# ungroup()
u18.ht <- u18.ht %>%
filter(!is.na(pl_ht_cm)) %>%
distinct()
u18.ht <- u18.ht %>%
mutate(yr = as.character(yr)) %>%
mutate(wilid = case_when(wilid == "0316" ~ "316",
TRUE ~ wilid))
u18.ht <- u18.ht %>%
filter(!is.na(wilid)) %>%
filter(!wilid == "") %>%
mutate(wilid = str_remove(.$wilid, ".0"))
u18.ht %>% distinct(wilid) %>% datatable()
u18.ht %>%
tabyl(site, plot) %>%
datatable()
## where is wb???
u18.ht %>%
visdat::vis_dat()
u18.ht %>%
ggTile_yr_season_plot()
No ‘cx’ for 2018 spring
#### Diagnostic plots
u18.ht %>%
# visdat::vis_guess() +
# visdat::vis_miss() +
visdat::vis_dat() +
theme_classic() +
labs(title = "2018 Spring Height", subtitle = "Missing map for qa/qc") +
scale_fill_viridis(discrete = TRUE, option = "D") +
coord_flip()
u18.plotly.exp <- u18.ht %>%
filter(plot != "obs") %>%
filter(pl_ht_cm <550) %>%
mutate(yr = as.character(yr)) %>%
ggplot(aes(site, pl_ht_cm)) +
# geom_boxplot(aes(color = site)) +
# geom_boxplot(aes(fill = plot)) +
geom_jitter(alpha = .5, aes(shape = plot, color = plot)) +
labs(y = "Height (cm)", title = "2018 Spring Data")
plotly::ggplotly(u18.plotly.exp)
# plot facet
u18.plotly.exp.bx <- u18.ht %>%
filter(plot != "obs") %>%
filter(pl_ht_cm <550) %>%
mutate(yr = as.character(yr)) %>%
ggplot(aes(plot, pl_ht_cm)) +
# geom_boxplot(aes(color = site)) +
geom_boxplot(aes(fill = plot)) +
geom_jitter(alpha = .8, aes(shape = plot),color = "black") +
facet_wrap(~site) +
labs(y = "Height (cm)", title = "2018 Spring Data")
plotly::ggplotly(u18.plotly.exp.bx)
# text plot
u18.plotly.exp.tx<- u18.ht %>%
filter(plot != "obs") %>%
filter(pl_ht_cm <550) %>%
mutate(yr = as.character(yr)) %>%
ggplot(aes(plot, pl_ht_cm)) +
# geom_boxplot(aes(color = site)) +
# geom_boxplot(aes(fill = plot)) +
# geom_jitter(alpha = .8, aes(shape = plot),color = "black") +
geom_text_repel(aes(label = wilid), size = 2.25) +
geom_point(color = "blue") +
# facet_wrap(~site) +
facet_grid(~site) +
labs(y = "Height (cm)", title = "2018 Spring Data")
u18.plotly.exp.tx
u18.plotly.obs <- u18.ht %>%
filter(plot == "obs") %>%
mutate(yr = as.character(yr)) %>%
ggplot(aes(site, pl_ht_cm)) +
# geom_boxplot(aes(color = site)) +
geom_jitter(alpha = .5, aes(shape = plot, color = plot)) +
labs(y = "Height (cm)", title = "2018 Spring Data")
plotly::ggplotly(u18.plotly.obs)
####
ufiles2019 <- fs::dir_ls("./data/raw/utilization/Raw_2019_Utilization", recurse = FALSE, glob = "*.xlsx")
# u19 <- ufiles2019 %>%
# map_df( ~ read_excel(path = .x,trim_ws = TRUE, skip = 1, col_types = "text"))
## multitab
# u19 <- ufiles2019 %>%
# map_df(~ read_sheets(.))
u19 <- ufiles2019 %>%
map_df(~ read_sheets_util(.))
# map_df( ~ read_excel(path = .x,trim_ws = TRUE, skip = 1, col_types = "text", range = "A2:DV46"))
# # note use of specific range and skipping of column
u19 <- u19 %>%
janitor::clean_names() %>%
mutate(yr = 2019) %>%
mutate(season = "spring")
u19 %>%
names() %>%
tibble::enframe(name = NULL) %>%
datatable(caption = "field names in raw utilization files")
u19 <- u19 %>%
filter(!is.na(pl_ht_cm)) %>%
# mutate(pl_ht_cm = case_when(is.na(height_cm)~ ht_cm,
# is.na(pl_ht_cm)~height_cm,
# TRUE ~ pl_ht_cm)) %>%
mutate(wilid = case_when(is.na(wilid) ~ willid,
is.na(willid)~ wilid,
TRUE ~ wilid))
### select subset of columns: for UTILIZATION
# u19.sel <- u19 %>%
# # glimpse()
# select(c('date','yr','season', 'site','wilid','stid', 'live_status', 'scheme','height_cm','spp','len_dia'), contains("sht"),contains("x"))
### select subset of columns: for height
u19.ht <- u19 %>%
# glimpse()
select(c(file_name, sheet_name, yr, site, season, spp, plot, wilid, stid, pl_ht_cm))
u19.ht <- u19.ht %>%
mutate(site = case_when(is.na(site) & wilid == "408" ~ "elk",
TRUE ~ site)) %>%
mutate(site = case_when(site == "lb41" ~ "lb4",
site == 'lost c' ~ "lostc",
site == "lost l" ~ "lostl",
TRUE ~ site)) %>%
mutate(wilid = case_when(wilid == '0316' ~ "316",
TRUE ~ wilid)) %>%
distinct() %>%
mutate(pl_ht_cm = as.numeric(pl_ht_cm)) %>%
filter(!is.na(pl_ht_cm))
u19.ht %>% ggTile_yr_season_site()
# rename, reclass
u19.ht <- u19.ht %>%
# filter(is.na(site))
# mutate(pl_ht_cm = as.numeric(pl_ht_cm)) %>%
mutate(plot = if_else(condition = is.na(plot), true = "obs", plot))
# clean
u19.ht <- u19.ht %>%
# filter(!(is.na(willid) & is.na(wilid))) %>%
distinct()
# more cleaning
u19.ht <- u19.ht %>%
filter(!is.na(pl_ht_cm)) %>%
filter(wilid != "na")
visdat::vis_miss(u19.ht)
u19 %>%
visdat::vis_miss() +
theme(axis.text.x=element_blank()) +
labs(caption = "Data structure of raw utilization files")
# ##########
# ## calculate the per wilid height from population of stid
# ##########
# u19.ht <- u19.ht %>%
# filter(!is.na(pl_ht_cm)) %>%
# group_by(yr, wilid, site, plot, season) %>%
# summarise(pl_ht_cm = max(pl_ht_cm)) %>%
# ungroup()
# enforce lower case
u19.ht <- u19.ht %>%
mutate_if(.predicate = is.character,.funs=tolower)
u19.ht <- u19.ht %>%
select(-c(file_name, sheet_name, stid)) %>%
distinct()
## spp lu update
# prep species lookup
lu.wilid.spp.v3
## # A tibble: 649 x 4
## site wilid species wilid_full
## <chr> <chr> <chr> <chr>
## 1 crescent 86 geyer crescent-obs-86
## 2 crescent 89 geyer crescent-obs-89
## 3 crescent 92 beb crescent-obs-92
## 4 crescent 95 pseudo crescent-obs-95
## 5 crescent 98 plantifolia crescent-obs-98
## 6 crescent 86 pseudo crescent-obs-86
## 7 crystal 493 boothi crystal-obs-493
## 8 crystal 924 boothi crystal-obs-924
## 9 crystal 844 NA crystal-obs-844
## 10 crystal 848 boothi crystal-obs-848
## # ... with 639 more rows
## create new spp lu
lu.wilid.spp.v3 <- u19.ht %>%
select(site, yr, plot, wilid, spp) %>%
rename(species = spp) %>%
filter(!is.na(wilid)) %>%
distinct() %>%
mutate(wilid_full = paste0(site,"-",plot,"-", wilid)) %>%
# distinct(site, plot) %>% datatable()
bind_rows(.,lu.wilid.spp.v3) %>%
select(site, wilid, species, wilid_full) %>%
distinct()
u19.ht %>%
visdat::vis_miss(cluster = TRUE) +
theme_classic() +
labs(title = "2019 Spring Height", subtitle = "Missing map for qa/qc") +
scale_fill_viridis(discrete = TRUE) +
coord_flip()
# plotly::ggplotly()
u19.ht <- u19.ht %>%
distinct() %>%
mutate(site = case_when(wilid == "415" & is.na(site) ~ "ghole",
wilid == "418" & is.na(site) ~ "ghole",
wilid == "449" & is.na(site) ~ "glen",
wilid == "452" & is.na(site) ~ "glen",
TRUE ~ site))
## adress bad plots
u19.ht <- u19.ht %>%
# distinct(plot)
mutate(plot = case_when(plot == "1" ~ "obs",
plot == "2" ~ "obs",
TRUE ~ plot))
u19.ht %>% ggTile_yr_season_site() + labs(caption = "u19.ht; cleaned sites")
u19.ht %>%
mutate(site2 = paste0(site,"-",plot)) %>%
ggTile_yr_season_site2() +
labs(caption = 'u19.ht; cleaned sites')
u19.ht %>%
gt_tally_site_plot_yr_season()
| tally | |
|---|---|
| site | n |
| 2019 - 3 - spring | |
| crystal | 10 |
| 2019 - cc - spring | |
| eb1 | 11 |
| eb2 | 12 |
| elk | 18 |
| wb | 20 |
| 2019 - dc - spring | |
| eb1 | 15 |
| eb2 | 22 |
| elk | 16 |
| wb | 24 |
| 2019 - obs - spring | |
| cresc | 3 |
| crystal | 36 |
| eb1 | 3 |
| eb2 | 5 |
| elk1 | 3 |
| elk2 | 5 |
| elk3 | 5 |
| elk4 | 5 |
| elk5 | 5 |
| ghole | 6 |
| glen | 6 |
| hailbuff | 4 |
| lava | 5 |
| lb1 | 5 |
| lb2 | 7 |
| lb3 | 6 |
| lb4 | 3 |
| lb5 | 5 |
| lb6 | 3 |
| lostc | 5 |
| lostl | 5 |
| oxbow | 5 |
| rose | 5 |
| wb1 | 5 |
| wb2 | 4 |
| wb4 | 30 |
| yancy | 5 |
u19.ht %>%
mutate(yr = as.character(yr)) %>%
ggPoint_yr_site_season_plot()
### Combine 18 and 19 spring data
# type convert
u19.ht <- u19.ht %>%
mutate(pl_ht_cm = as.numeric(pl_ht_cm)) %>%
mutate(yr = as.character(yr)) %>%
filter(!is.na(pl_ht_cm))
# row bind in 18
u18u19.ht <- bind_rows(u18.ht,u19.ht)
u18u19.ht %>%
filter(wilid == "")
## # A tibble: 1 x 8
## file_name yr season plot site wilid pl_ht_cm spp
## <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <chr>
## 1 ./data/raw/utilization/Raw_2018~ 2018 spring obs lb5 "" 311 <NA>
u18u19.ht <- u18u19.ht %>%
filter(wilid != "")
# plot
u18u19.ht %>%
mutate(site2 = paste0(site,"-",plot)) %>%
ggTile_yr_season_site2(.) +
labs(caption = "u18u19.ht")
u18u19.ht %>%
# filter(!is.na(site)) %>%
# select(wilid) %>%
# datapasta::vector_paste() %>%
filter((wilid %in% c("415", "418", "449", "449", "452")) & is.na(site)) %>%
# filter(wilid %in% c("415", "418", "449", "449", "452")) %>%
distinct(wilid, site, yr) %>%
arrange(wilid)
# u18u19.ht <- u18u19.ht %>%
# filter(!is.na(site))
p1819.wilidht %>% ggPoint_yr_site_season_plot
# fix na for plot
p1819.wilidht <- p1819.wilidht %>%
mutate(plot = if_else(condition = is.na(plot),true = "obs", plot)) %>%
mutate(site2 = paste0(site,"-",plot))
p1819.wilidht <- p1819.wilidht %>%
mutate(season = "fall")
## adress missing sites
# u18u19.ht <- u18u19.ht %>%
# mutate(site = case_when(is.na(site.x) ~ site.y,
# # is.na(site.y) ~ site.x,
# TRUE ~ site.x)) %>%
# select(-c(site.x, site.y)) %>%
# filter(!is.na(site))
u18u19.ht <- u18u19.ht %>%
mutate(plot = if_else(condition = plot == "1",true = "obs","obs")) ## not sure why, but error with plot...
# u18u19.ht %>% visdat::vis_miss()
### Combine spring and fall for 2018 and 2019
##
p1819.wilidht <- p1819.wilidht %>%
mutate(pl_ht_cm = as.numeric(pl_ht_cm))
ht.all18.19 <- bind_rows(p1819.wilidht,u18u19.ht)
## eliminate NA fpr plant ht
ht.all18.19 <- ht.all18.19 %>%
filter(!is.na(pl_ht_cm)) %>%
filter(!is.na(wilid))
## ### 2018 2019
# ### try to add spp info to the 18 and 19
# wilid.spp.lu2 <- read_csv("./data/wilid_spp._lu_v2.csv") %>%
# select(c(species, wilid_full))
## address sites without proper site attribution
ht.all18.19 <- ht.all18.19 %>%
mutate(site = case_when(wilid == "415" & is.na(site) ~ "ghole",
wilid == "418" & is.na(site) ~ "ghole",
wilid == "449" & is.na(site) ~ "glen",
wilid == "452" & is.na(site) ~ "glen",
TRUE ~ site)) %>%
# select(-file_name) %>%
mutate(site = case_when(site == "lb41" ~ "lb4",
site == 'lost c' ~ "lostc",
site == "lost l" ~ "lostl",
TRUE ~ site)) %>%
mutate(site2 = paste0(site,"-", plot)) %>%
mutate(wilid_full = paste0(site2,"-", wilid))
ht.all18.19 <- ht.all18.19 %>%
mutate(wilid = case_when(wilid == "" & site == "lb5" ~ '1070',
TRUE ~ wilid))
ht.all18.19 <- ht.all18.19 %>%
distinct()
ht.all18.19 %>%
visdat::vis_miss()
Missing data: Yancy fall 2018
ht.all18.19 <- ht.all18.19 %>%
mutate(site = case_when(site == 'cresc'~'crescent',
TRUE ~ site))
ht.all18.19 %>%
filter(plot != "obs") %>%
ggTile_yr_season_site2() +
labs(title = "Exp sites", caption = 'ht.all18.19')
ht.all18.19 %>%
filter(!(plot != "obs")) %>%
ggTile_yr_season_site2() +
labs(title = "Obs sites", caption = 'ht.all18.19')
### Bring in 16 17
## 16
p16.ht <- p16.ht %>%
mutate(site2 = paste0(site,"-",plot)) %>%
mutate(yr = as.character("2016")) %>%
mutate(season = "fall")
p16.ht %>%
tabyl(site2) %>%
gt() %>%
tab_header(title = "n distinct fall 2016 site2")
| n distinct fall 2016 site2 | ||
|---|---|---|
| site2 | n | percent |
| crescent-obs | 5 | 0.012755102 |
| eb1-cc | 13 | 0.033163265 |
| eb1-cx | 11 | 0.028061224 |
| eb1-dc | 15 | 0.038265306 |
| eb1-dx | 16 | 0.040816327 |
| eb1-obs | 5 | 0.012755102 |
| eb2-cc | 10 | 0.025510204 |
| eb2-cx | 14 | 0.035714286 |
| eb2-dc | 20 | 0.051020408 |
| eb2-dx | 14 | 0.035714286 |
| eb2-obs | 5 | 0.012755102 |
| elk-cc | 17 | 0.043367347 |
| elk-cx | 18 | 0.045918367 |
| elk-dc | 15 | 0.038265306 |
| elk-dx | 22 | 0.056122449 |
| elk1-obs | 6 | 0.015306122 |
| elk2-obs | 8 | 0.020408163 |
| elk3-obs | 5 | 0.012755102 |
| elk4-obs | 5 | 0.012755102 |
| elk5-obs | 5 | 0.012755102 |
| ghole-obs | 10 | 0.025510204 |
| halibuff-obs | 5 | 0.012755102 |
| lava-obs | 5 | 0.012755102 |
| lb1-obs | 5 | 0.012755102 |
| lb2-obs | 8 | 0.020408163 |
| lb3-obs | 5 | 0.012755102 |
| lostc-obs | 5 | 0.012755102 |
| lostl-obs | 5 | 0.012755102 |
| oxbow-obs | 5 | 0.012755102 |
| rose-obs | 5 | 0.012755102 |
| slide-obs | 6 | 0.015306122 |
| wb-cc | 21 | 0.053571429 |
| wb-cx | 20 | 0.051020408 |
| wb-dc | 21 | 0.053571429 |
| wb-dx | 21 | 0.053571429 |
| wb1-obs | 5 | 0.012755102 |
| wb2-obs | 4 | 0.010204082 |
| xtal-obs | 2 | 0.005102041 |
| yancy-obs | 5 | 0.012755102 |
## corect site id data entry error
p17.ht <- p17.ht %>%
mutate(site = if_else(site == "wn","wb",site)) %>% mutate(site2 = paste0(site,"-",plot)) %>%
mutate(yr = as.character("2017")) %>%
mutate(season = "fall")
####
p16.ht <- p16.ht %>%
mutate(pl_ht_cm = as.numeric(pl_ht_cm))
p17.ht <- p17.ht %>%
select(-species)
p17.ht %>%
tabyl(site2, season) %>%
arrange(site2) %>%
gt() %>%
tab_header(title = "n distinct fall 2017 site2")
| n distinct fall 2017 site2 | |
|---|---|
| site2 | fall |
| crescent-obs | 16 |
| eb1-cc | 34 |
| eb1-cx | 28 |
| eb1-dc | 53 |
| eb1-dx | 59 |
| eb2-cc | 18 |
| eb2-cx | 37 |
| eb2-dx | 45 |
| elk-cc | 45 |
| elk-cx | 77 |
| elk-dc | 37 |
| elk-dx | 70 |
| elk-obs | 9 |
| elk1-obs | 4 |
| elk2-obs | 13 |
| elk3-obs | 5 |
| elk4-obs | 15 |
| elk5-obs | 16 |
| ghole-obs | 18 |
| glen-obs | 16 |
| halibuff-obs | 6 |
| lb-obs | 53 |
| lb1-obs | 13 |
| lb2-obs | 22 |
| lb3-obs | 16 |
| lostc-obs | 17 |
| lostl-obs | 15 |
| oxbow-obs | 15 |
| rose-obs | 12 |
| slide-obs | 8 |
| wb-cc | 69 |
| wb-cx | 72 |
| wb-dc | 71 |
| wb-dx | 67 |
| wb-obs | 14 |
# p17.ht %>%
# filter(wilid == "236") %>% filter(site2 == "wn-cx") ## corected
p16p17 <- bind_rows(p16.ht,p17.ht)
p16p17 %>%
visdat::vis_dat() +
labs(caption = "p16p17")
# !!!
p16p17 <- p16p17 %>%
distinct()
p16p17 %>%
group_by(yr, season, site) %>%
summarise(n= n()) %>%
ggplot(aes(yr, site)) +
geom_tile(aes(fill = n), color = 'black') +
theme(axis.text.x = element_text(angle = 55, hjust = 1, size = 7)) +
theme(axis.text.y = element_text(size = 9)) +
facet_wrap(~season) +
theme(axis.text.x = element_text(angle = 55, hjust = 1, size = 9)) +
theme(axis.text.y = element_text(size = 7)) +
facet_wrap(~season) +
scale_fill_viridis(option = "C") +
labs(caption = "Combined 2016 and 2017 fall height")
## spring 16 17
u16.ht <- u16.ht %>%
mutate(season = "spring") %>%
mutate(yr = as.character("2016")) %>%
mutate(pl_ht_cm = as.numeric(pl_ht_cm))
u17.ht <- u17.ht %>%
mutate(season = "spring") %>%
mutate(yr = as.character("2017"))
| distinct site |
|---|
| site2 |
| wb-cc |
| wb-cx |
| wb-dx |
| wb-dc |
| wb1-obs |
| wb2-obs |
| wb4-obs |
| lostc-obs |
| lostl-obs |
| oxbow-obs |
| rose-obs |
| crescent-obs |
| slide-obs |
| lava-obs |
| lb1-obs |
| lb2-obs |
| lb3-obs |
| lb4-obs |
| halibuff-obs |
| elk-dx |
| elk-dc |
| elk-cx |
| elk-cc |
| elk1-obs |
| elk4-obs |
| elk5-obs |
| elk3-obs |
| elk2-obs |
| eb1-obs |
| eb2-obs |
| eb1-cc |
| yancy-obs |
| eb1-dc |
| eb1-dx |
| eb1-cx |
| eb2-cc |
| eb2-dx |
| eb2-cx |
| eb2-dc |
| glen-obs |
| ghole-obs |
#### bind rows p16, p17, all ht 18 19
# ht.all18.19 %>% distinct(wilid) %>% View()
#### bind rows p16, p17, all ht 18 19
p.16.17.18.19 <- ht.all18.19 %>%
# rename(live_dead = live_status) %>%
mutate(yr = as.character(yr)) %>%
bind_rows(., p16p17) %>%
distinct()
p.16.17.18.19 %>%
visdat::vis_dat()
p.16.17.18.19 %>% ggTile_yr_season_plot_alt1()
## add in the other lewis ht entry file
p.16.17.18.19 <- p.16.17.18.19 %>%
bind_rows(., u17_lmentry) %>%
# select(-live_dead) %>%
distinct()
p.16.17.18.19 %>%
visdat::vis_dat()
# p.16.17.18.19 %>% distinct(wilid) %>% View()
u18u19.ht <- u18u19.ht %>%
mutate(yr = as.character(yr))
ht.all.16.17.18.19 <- p.16.17.18.19 %>%
bind_rows(., u18u19.ht) %>%
# select(-c(file_name,live_status)) %>%
distinct()
u16.ht
## # A tibble: 371 x 6
## yr season site plot wilid pl_ht_cm
## <chr> <chr> <chr> <chr> <chr> <dbl>
## 1 2016 spring elk dx 567 NA
## 2 2016 spring elk dx 570 NA
## 3 2016 spring elk dx 573 NA
## 4 2016 spring elk dx 576 NA
## 5 2016 spring elk dx 579 NA
## 6 2016 spring elk dx 582 NA
## 7 2016 spring elk dx 585 NA
## 8 2016 spring elk dx 588 NA
## 9 2016 spring elk dx 591 NA
## 10 2016 spring elk dx 594 NA
## # ... with 361 more rows
u17.ht
## # A tibble: 387 x 8
## yr site site2 plot wilid season pl_ht_cm wilid_full
## <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <chr>
## 1 2017 wb wb-cc cc 63 spring 235 wb-cc-63
## 2 2017 wb wb-cc cc 64 spring 187 wb-cc-64
## 3 2017 wb wb-cc cc 67 spring 248 wb-cc-67
## 4 2017 wb wb-cc cc 70 spring 242 wb-cc-70
## 5 2017 wb wb-cc cc 73 spring 143 wb-cc-73
## 6 2017 wb wb-cc cc 76 spring 142 wb-cc-76
## 7 2017 wb wb-cc cc 79 spring 186 wb-cc-79
## 8 2017 wb wb-cc cc 82 spring 182 wb-cc-82
## 9 2017 wb wb-cc cc 85 spring 301 wb-cc-85
## 10 2017 wb wb-cc cc 88 spring 178 wb-cc-88
## # ... with 377 more rows
## add in the 16 and 17 spring data
Scraping these files for any data
ht.all.16.17.18.19 <- ht.all.16.17.18.19 %>%
mutate(site = case_when(site == "halibuff" ~ "hailbuff",
site == "cresc" ~ 'crescent',
site == "crescent" ~ "crescent",
site == "lost l" ~ "lostl",
site == "lost c" ~ "lostc",
site == "xtal" ~ "crystal",
TRUE ~ site)) %>%
mutate(site2 = paste0(site,"-",plot)) %>%
mutate(wilid_full = paste0(site2,"-",wilid))
# ht.all.16.17.18.19 <- ht.all.16.17.18.19 %>%
# filter(!is.na(site)) %>%
# distinct()
ht.all.16.17.18.19 %>%
ggTile_yr_season_site2()
ht.all.16.17.18.19 <- ht.all.16.17.18.19 %>%
mutate(site = case_when(wilid == "415" & is.na(site) ~ "ghole",
wilid == "418" & is.na(site) ~ "ghole",
wilid == "449" & is.na(site) ~ "glen",
wilid == "452" & is.na(site) ~ "glen",
TRUE ~ site))
ht.all.16.17.18.19 <- ht.all.16.17.18.19 %>%
mutate(plot = case_when(site == "crescent" & plot == "cc" ~ "obs",
site == "cresc" & plot == "cc" ~ "obs",
site == "elk1" & plot == "cc" ~ "obs",
site == "elk2" & plot == "cc" ~ "obs",
site == "elk3" & plot == "cc" ~ "obs",
site == "elk4" & plot == "cc" ~ "obs",
site == "elk5" & plot == "cc" ~ "obs",
site == "ghole" & plot == "cc" ~ "obs",
site == "hailbuf" & plot == "cc" ~ "obs",
site == "lava" & plot == "cc" ~ "obs",
site == "lb" & plot == "cc" ~ "obs",
site == "lb1" & plot == "cc" ~ "obs",
site == "lb2" & plot == "cc" ~ "obs",
site == "lb3" & plot == "cc" ~ "obs",
site == "lb4" & plot == "cc" ~ "obs",
site == "lostc" & plot == "cc" ~ "obs",
site == "lostl" & plot == "cc" ~ "obs",
site == "oxbow" & plot == "cc" ~ "obs",
site == "rose" & plot == "cc" ~ "obs",
site == "slide" & plot == "cc" ~ "obs",
site == "wb1" & plot == "cc" ~ "obs",
site == "wb2" & plot == "cc" ~ "obs",
site == "wb4" & plot == "cc" ~ "obs",
site == "yancy" & plot == "cc" ~ "obs",
TRUE ~ plot
)) %>%
mutate(site2 = paste0(site,"-", plot)) %>%
mutate(wilid_full = paste0(site2,"-", wilid))
ht.all.16.17.18.19 %>%
group_by(yr, season, site) %>%
summarise(n= n()) %>%
ggplot(aes(yr, site)) +
geom_tile(aes(fill = n), color = 'black') +
theme(axis.text.x = element_text(angle = 55, hjust = 1, size = 7)) +
theme(axis.text.y = element_text(size = 9)) +
facet_wrap(~season) +
theme(axis.text.x = element_text(angle = 55, hjust = 1, size = 9)) +
theme(axis.text.y = element_text(size = 7)) +
facet_wrap(~season) +
scale_fill_viridis(option = "C") +
labs(caption = "Combined 2016 and 2017 fall height")
#
prod.sprcag.ht %>%
tabyl(site)
## site n percent
## eb1 1327 0.2066334475
## eb2 1328 0.2067891623
## eb4 3 0.0004671442
## elk 1728 0.2690750545
## wb 2036 0.3170351915
# fix
ht.all.16.17.18.19 %>% ggTile_yr_season_site2()
ht.all.01.19 <- ht.all.16.17.18.19 %>%
bind_rows(.,prod.sprcag.ht) %>%
mutate(site2 = paste0(site,"-",plot)) %>%
mutate(wilid_full = paste0(site2,"-",wilid)) %>%
filter(!is.na(pl_ht_cm)) %>%
distinct()
ht.all.01.19 %>%
visdat::vis_dat()
ht.all.01.19 %>%
ggTile_yr_season_site()
## bind in the dcc from raw files
dcc.ht.fa.spr <- dcc.ht.fa.spr %>%
select(-c(species,wilid_full)) %>%
distinct()
dcc.ht.fa.spr %>%
visdat::vis_dat()
##
# ht.all.16.17.18.19 %>%
# mutate(pl_ht_cm = as.numeric(pl_ht_cm)) %>%
# mutate(yr = as.character(yr))
dcc.16.17.18.19 <- ht.all.16.17.18.19 %>%
# select(-c(browse, exp, dam)) %>%
bind_rows(., dcc.ht.fa.spr) %>%
mutate(site2 = paste0(site,"-",plot)) %>%
mutate(wilid_full = paste0(site2,"-",wilid)) %>%
filter(!is.na(pl_ht_cm))
# dcc.16.17.18.19 <- dcc.16.17.18.19 %>%
# left_join(.,wilid.spp.lu2)
dcc.16.17.18.19 <- dcc.16.17.18.19 %>%
distinct()
dcc.16.17.18.19 %>%
visdat::vis_dat() +
labs(caption = 'dcc.16.17.18.19')
dcc.16.17.18.19 %>%
group_by(yr, season, site) %>%
summarise(n= n()) %>%
ggplot(aes(yr, site)) +
geom_tile(aes(fill = n), color = 'black') +
theme_minimal() +
theme(axis.text.x = element_text(angle = 55, hjust = 1, size = 7)) +
theme(axis.text.y = element_text(size = 9)) +
facet_wrap(~season) +
theme(axis.text.x = element_text(angle = 55, hjust = 1, size = 9)) +
theme(axis.text.y = element_text(size = 7)) +
facet_wrap(~season)
## bind in other dcc object
dcc.16.17.18.19 <- ht.all18.19 %>%
bind_rows(.,dcc.16.17.18.19) %>%
# select(-c(species, live_status)) %>%
distinct()
### select
dcc.16.17.18.19 <- dcc.16.17.18.19 %>%
select(c(yr, season, site, site2, wilid, wilid_full, pl_ht_cm, plot))
##
w_ht <- w_ht %>%
# rename(plot = treat) %>%
rename(yr = year) %>%
mutate(yr = as.character(yr)) %>%
mutate(wilid_full = paste0(site,"-",plot,"-", wilid))
w_ht <- w_ht %>%
select(c(yr, season, site, site2, wilid, wilid_full, pl_ht_cm, plot))%>%
mutate(wilid = as.character(wilid))
## join in spp
# w_ht <- left_join(w_ht, wilid.spp.lu2)
# FALL 18 and 19 plus DCC
ht.combined <- dcc.16.17.18.19 %>%
mutate(pl_ht_cm = as.numeric(pl_ht_cm)) %>%
bind_rows(., w_ht) %>%
distinct()
## clean
ht.combined <- ht.combined %>%
mutate(site = case_when(site == "halibuff" ~ "hailbuff",
TRUE ~ site)) %>%
distinct()
#
# ht.combined %>%
# visdat::vis_miss()
ht.combined %>%
group_by(yr, season, site) %>%
summarise(n= n()) %>%
ggplot(aes(yr, site)) +
geom_tile(aes(fill = n), color = 'black') +
theme(axis.text.x = element_text(angle = 55, hjust = 1, size = 7)) +
theme(axis.text.y = element_text(size = 7)) +
facet_wrap(~season) +
labs(caption = "Combined DCC, 16-19")
dcc.ht.fa.spr %>%
group_by(yr, season, site) %>%
summarise(n= n()) %>%
ggplot(aes(yr, site)) +
geom_tile(aes(fill = n), color = 'black') +
theme(axis.text.x = element_text(angle = 55, hjust = 1, size = 7)) +
theme(axis.text.y = element_text(size = 7)) +
facet_wrap(~season) +
labs(title = "DCC data")
ht.combined <- ht.combined %>%
filter(pl_ht_cm < 700)
# ht.combined %>%
# distinct(site) %>%
# View()
ht.combined %>%
group_by(site2, season, yr) %>%
tally() %>%
ggplot(aes(yr, site2)) +
geom_tile(aes(fill = n)) +
theme(axis.text.x = element_text(angle = 55, hjust = 1, size = 7)) +
theme(axis.text.y = element_text(size = 7)) +
facet_wrap(~season) +
labs(caption = "Combined DCC, 16-19")
### the missing spring dcc data
# note: this is supplanted by code that pulls in
# both fa and spr data from raw dcc files
# nsf.ht.spr <- nsf.ht.spr %>%
# mutate(yr = as.character(yr), wilid = as.character(wilid)) %>%
# mutate(season = "spring") %>%
# mutate(site2 = paste0(site,"-",plot))
# nsf.ht.spr <- left_join(nsf.ht.spr, plot.lu, by = "plot")
# nsf.ht.spr %>% filter(is.na(species))
nsf.ht.fa.expobs <- nsf.ht.fa.expobs %>%
mutate(yr = as.character(yr)) %>%
mutate(wilid = as.character(wilid)) %>%
mutate(wilid_full = paste0(site,"-",plot,"wilid")) %>%
mutate(site2 = paste0(site,"-",plot))
# ht.combined <- bind_rows(ht.combined, nsf.ht spring and fall)
ht.combined <- bind_rows(ht.combined, nsf.ht.fa.expobs) %>%
distinct()
## use species lookup table to
#
# ht.combined %>%
# distinct(species) %>%
# write_csv("./data/lu_species_code.csv")
# clean
ht.combined <- ht.combined %>%
# mutate(species = case_when(species == 'beb' ~ "bebb",
# species == 'drumm' ~ "drum",
# species == 'boothii' ~ "booth",
# species == 'boothi' ~ "booth",
# species == 'lassiandra' ~ "lass",
# TRUE ~ species)) %>%
# filter(species != "?") %>%
mutate(plot = if_else(is.na(plot),"obs",plot)) %>% # filter(!(wilid == "570" & pl_ht_cm == 283)) %>%
filter(!is.na(site)) %>%
mutate(site = if_else(site == "crescent","cresc", site)) %>%
mutate(site2 = paste0(site,"-",plot)) %>%
mutate(wilid_full = paste0(site,"-",plot,"-",wilid))
# ## find missing data
ht.combined %>%
group_by(yr, season, site) %>%
summarise(n= n()) %>%
ggplot(aes(yr, site)) +
geom_tile(aes(fill = n), color = 'black') +
facet_wrap(~season) +
theme(axis.text.x = element_text(angle = 55, hjust = 1, size = 7)) +
theme(axis.text.y = element_text(size = 7)) +
facet_wrap(~season)
# ggsave("./output/output4qaqc/height_heatmap20191204 1937.pdf", width = 11, height = 8.5)
#clean sites
ht.combined <- ht.combined %>%
mutate(site = case_when(site == "lb41" ~ "lb4",
site == 'lost c' ~ "lostc",
site == "lost l" ~ "lostl",
TRUE ~ site)) %>%
mutate(site = case_when(site == "halibuff" ~ "hailbuff",
site == "cresc" ~ 'crescent',
site == "crescent" ~ "crescent",
site == "lost l" ~ "lostl",
site == "lost c" ~ "lostc",
site == "xtal" ~ "crystal",
TRUE ~ site))
# ht.combined <- ht.combined %>%
# mutate(pl_ht_cm = round(pl_ht_cm,0))
ht.combined <- ht.combined %>%
mutate(wilid = as.character(wilid)) %>%
filter(wilid != "0") %>%
distinct()
ht.combined <- ht.combined %>%
mutate(site = case_when(site == "hailbuff"~ "hailbuf",
TRUE ~ site))
#
ht.combined %>%
group_by(yr, season, site2) %>%
summarise(n= n()) %>%
ggplot(aes(yr, site2)) +
geom_tile(aes(fill = n), color = 'black') +
facet_wrap(~season) +
theme(axis.text.x = element_text(angle = 55, hjust = 1, size = 7)) +
theme(axis.text.y = element_text(size = 7)) +
facet_wrap(~season)
## correct the height
ht.combined <- ht.combined %>%
mutate(pl_ht_cm = if_else(pl_ht_cm == 1362, 362, pl_ht_cm)) %>%
mutate(pl_ht_cm = if_else(pl_ht_cm == 2877, 287, pl_ht_cm))
# these should be corrected in raw files?
#### Site problems 18 19 spring
#######
u18u19.ht <- u18u19.ht %>%
mutate(yr = as.character(yr)) %>%
select(-file_name)
u18u19.ht %>%
distinct() %>%
mutate(site2 = paste0(site,"-",plot)) %>%
ggTile_yr_season_site2()
ht.combined <- ht.combined %>%
select(-c(species, wilid_full, site2)) %>%
distinct()
## bind in the spring19
ht.combined <- ht.combined %>%
bind_rows(., u19.ht) %>%
distinct()
ht.combined %>%
mutate(site2 = paste0(site,"-",plot)) %>%
ggTile_yr_season_site2()
#### 18
u18.ht <- u18.ht %>%
select(-c(file_name))
ht.combined <- ht.combined %>%
bind_rows(., u18.ht) %>%
distinct()
# ht.combined <- ht.combined %>%
# bind_rows(., u18u19.ht) %>%
# distinct()
ht.combined <- ht.combined %>%
mutate(site = case_when(site == "cresc" ~ "crescent",
site == "hailbuff" ~ "hailbuf",
TRUE ~ site)) %>%
mutate(site = case_when(site == "lb41" ~ "lb4",
site == 'lost c' ~ "lostc",
site == "lost l" ~ "lostl",
TRUE ~ site)) %>%
mutate(plot = case_when(site == "hailbuf" & plot == "cc" ~ "obs",
site == "glen" & plot == "cc" ~ "obs",
TRUE ~ plot)) %>%
mutate(site2 = paste0(site,"-",plot)) %>%
mutate(wilid_full = paste0(site2,"-",wilid))
ht.combined %>% ggTile_yr_season_site2()
## more site name cleanup
ht.combined <- ht.combined %>%
select(yr, wilid, site, site2, season, plot, pl_ht_cm, wilid_full) %>%
distinct()
ht.combined %>% ggTile_yr_season_site2()
ht.combined <- ht.combined %>%
# select(-species) %>%
mutate(plot = case_when(site == "crescent" & plot == "cc" ~ "obs",
site == "cresc" & plot == "cc" ~ "obs",
site == "elk1" & plot == "cc" ~ "obs",
site == "elk2" & plot == "cc" ~ "obs",
site == "elk3" & plot == "cc" ~ "obs",
site == "elk4" & plot == "cc" ~ "obs",
site == "elk5" & plot == "cc" ~ "obs",
site == "ghole" & plot == "cc" ~ "obs",
site == "hailbuf" & plot == "cc" ~ "obs",
site == "lava" & plot == "cc" ~ "obs",
site == "lb" & plot == "cc" ~ "obs",
site == "lb1" & plot == "cc" ~ "obs",
site == "lb2" & plot == "cc" ~ "obs",
site == "lb3" & plot == "cc" ~ "obs",
site == "lb4" & plot == "cc" ~ "obs",
site == "lostc" & plot == "cc" ~ "obs",
site == "lostl" & plot == "cc" ~ "obs",
site == "oxbow" & plot == "cc" ~ "obs",
site == "rose" & plot == "cc" ~ "obs",
site == "slide" & plot == "cc" ~ "obs",
site == "wb1" & plot == "cc" ~ "obs",
site == "wb2" & plot == "cc" ~ "obs",
site == "wb4" & plot == "cc" ~ "obs",
site == "yancy" & plot == "cc" ~ "obs",
TRUE ~ plot
)) %>%
mutate(plot = case_when(site == "glen" ~ "obs",
site == "hailbuff" ~ "obs",
TRUE ~ plot)) %>%
mutate(site2 = paste0(site,"-",plot)) %>%
mutate(wilid_full = paste0(site2,"-",wilid))
## try to retireve the 18 spring data that went missing
ht.combined <- ht.combined %>%
select(-c(site2, wilid_full)) %>%
bind_rows(., u18.ht) %>%
distinct() %>%
mutate(site2 = paste0(site,"-",plot)) %>%
mutate(wilid_full = paste0(site2,"-",wilid))
ht.combined %>%
filter(plot != "obs") %>%
ggTile_yr_season_site2()
## try to retireve the 19 spring data that went missing
ht.combined <- ht.combined %>%
select(-c(site2, wilid_full)) %>%
bind_rows(., u19.ht) %>%
distinct() %>%
mutate(site2 = paste0(site,"-",plot)) %>%
mutate(wilid_full = paste0(site2,"-",wilid))
ht.combined %>%
# filter(plot != "obs") %>%
ggTile_yr_season_site2()
## fix obvious site issues
ht.combined <- ht.combined %>%
select(-c(site2, wilid_full)) %>%
mutate(site = case_when(site == "cresc" ~ "crescent",
site == "lost l" ~ "lostl",
site == "lost c" ~ "lostc",
site == "hailbuf" ~"hailbuff",
TRUE ~ site)) %>%
distinct() %>%
mutate(site2 = paste0(site,"-",plot)) %>%
mutate(wilid_full = paste0(site2,"-",wilid))
ht.combined %>% ggTile_yr_season_site2()
## what happended to 18 spr cresc?
u18.ht %>%
# distinct(site) %>%
filter(site == "cresc")
## # A tibble: 3 x 6
## yr season plot site wilid pl_ht_cm
## <chr> <chr> <chr> <chr> <chr> <dbl>
## 1 2018 spring obs cresc 86 57
## 2 2018 spring obs cresc 92 50
## 3 2018 spring obs cresc 95 52
##
ht.combined %>%
ggTile_yr_season_site2()
## Fa raw DCC. Note error in wilid=158, 2010
read_delim("./data/NSF_DataArchive20180208/Plant_level_fall_current_annual_growth_and_height_on_experimental_plot/willows-plantCAGfall2002-2015.txt", delim = " ") %>%
select(year, site, plot, species, willid, height) %>%
rename(yr = year, wilid = willid, pl_ht_cm = height) %>%
mutate(season = "fall") %>%
filter(wilid == "158")
## # A tibble: 13 x 7
## yr site plot species wilid pl_ht_cm season
## <dbl> <chr> <chr> <chr> <dbl> <dbl> <chr>
## 1 2002 wb dx beb 158 127 fall
## 2 2003 wb dx beb 158 160 fall
## 3 2004 wb dx beb 158 180 fall
## 4 2005 wb dx beb 158 219 fall
## 5 2006 wb dx beb 158 240 fall
## 6 2007 wb dx beb 158 280 fall
## 7 2008 wb dx beb 158 298 fall
## 8 2009 wb dx beb 158 327 fall
## 9 2010 wb dx beb 158 1362 fall
## 10 2012 wb dx beb 158 382 fall
## 11 2013 wb dx beb 158 136 fall
## 12 2014 wb dx beb 158 364 fall
## 13 2015 wb dx beb 158 380 fall
# check specific records Tom identified
ht.combined %>%
distinct() %>%
filter (yr == '2010' & site == "wb") %>%
# datatable()
filter(wilid == "158")
## # A tibble: 2 x 8
## yr wilid site site2 season plot pl_ht_cm wilid_full
## <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <chr>
## 1 2010 158 wb wb-dx spring dx 338 wb-dx-158
## 2 2010 158 wb wb-dx fall dx 362 wb-dx-158
Two issues here, now fixed: 1.plant height of 1362 would appear to be a data entry error in the raw file. This is 2010 data drawn from the DCC (library repository), so I don’t have the raw data to check. The value is in the raw file, not an artifact introduced in the data processing. I’ve changed it to “362”.
ht.combined %>%
distinct() %>%
filter (yr == '2010' & site == "wb") %>%
# datatable()
filter(wilid == "158") %>%
datatable(caption = "questionable records flagged by TH")
1.Notice the different species: booth vs boothi, beb vs bebb. I ran code to find and replace such issues, but had it too early in the chain of transformations involved in the import and merging of the raw data. I have steps to remove duplicates, but b/c of the different species, they’re not the same.
## add full id to join with species
# wilid and site are not unique
ht.combined <- ht.combined %>%
filter(!is.na(pl_ht_cm))
# ht.combined <- ht.combined %>%
# mutate(plot = case_when(site == "crescent" & plot == "cc" ~ "obs",
# site == "elk1" & plot == "cc" ~ "obs",
# site == "elk2" & plot == "cc" ~ "obs",
# site == "elk3" & plot == "cc" ~ "obs",
# site == "elk4" & plot == "cc" ~ "obs",
# site == "elk5" & plot == "cc" ~ "obs",
# site == "ghole" & plot == "cc" ~ "obs",
# site == "hailbuf" & plot == "cc" ~ "obs",
# site == "lava" & plot == "cc" ~ "obs",
# site == "lb" & plot == "cc" ~ "obs",
# site == "lb1" & plot == "cc" ~ "obs",
# site == "lb2" & plot == "cc" ~ "obs",
# site == "lb3" & plot == "cc" ~ "obs",
# site == "lb4" & plot == "cc" ~ "obs",
# site == "lostc" & plot == "cc" ~ "obs",
# site == "lostl" & plot == "cc" ~ "obs",
# site == "oxbow" & plot == "cc" ~ "obs",
# site == "rose" & plot == "cc" ~ "obs",
# site == "slide" & plot == "cc" ~ "obs",
# site == "wb1" & plot == "cc" ~ "obs",
# site == "wb2" & plot == "cc" ~ "obs",
# site == "wb4" & plot == "cc" ~ "obs",
# site == "yancy" & plot == "cc" ~ "obs",
# TRUE ~ plot
# ))
#
ht.combined %>% ggTile_yr_season_site2()
## cleaning
ht.combined %>%
filter(season == "spring") %>%
tabyl(site,plot) %>%
gt()
| site | 3 | cc | cx | dc | dx | obs |
|---|---|---|---|---|---|---|
| crescent | 0 | 0 | 0 | 0 | 0 | 35 |
| crystal | 10 | 0 | 0 | 0 | 0 | 46 |
| eb1 | 0 | 178 | 115 | 200 | 200 | 100 |
| eb2 | 0 | 126 | 152 | 219 | 171 | 120 |
| elk | 0 | 231 | 220 | 197 | 280 | 97 |
| elk1 | 0 | 0 | 0 | 0 | 0 | 29 |
| elk2 | 0 | 0 | 0 | 0 | 0 | 32 |
| elk3 | 0 | 0 | 0 | 0 | 0 | 39 |
| elk4 | 0 | 0 | 0 | 0 | 0 | 39 |
| elk5 | 0 | 0 | 0 | 0 | 0 | 16 |
| ghole | 0 | 0 | 0 | 0 | 0 | 33 |
| glen | 0 | 0 | 0 | 0 | 0 | 36 |
| hailbuf | 0 | 0 | 0 | 0 | 0 | 29 |
| lava | 0 | 0 | 0 | 0 | 0 | 38 |
| lb1 | 0 | 0 | 0 | 0 | 0 | 38 |
| lb2 | 0 | 0 | 0 | 0 | 0 | 42 |
| lb3 | 0 | 0 | 0 | 0 | 0 | 37 |
| lb4 | 0 | 0 | 0 | 0 | 0 | 13 |
| lb5 | 0 | 0 | 0 | 0 | 0 | 11 |
| lb6 | 0 | 0 | 0 | 0 | 0 | 3 |
| lostc | 0 | 0 | 0 | 0 | 0 | 40 |
| lostl | 0 | 0 | 0 | 0 | 0 | 40 |
| oxbow | 0 | 0 | 0 | 0 | 0 | 42 |
| rose | 0 | 0 | 0 | 0 | 0 | 35 |
| slide | 0 | 0 | 0 | 0 | 0 | 41 |
| tower | 0 | 0 | 0 | 0 | 0 | 10 |
| wb | 0 | 299 | 258 | 319 | 246 | 126 |
| wb1 | 0 | 0 | 0 | 0 | 0 | 40 |
| wb2 | 0 | 0 | 0 | 0 | 0 | 35 |
| wb4 | 0 | 0 | 0 | 0 | 0 | 73 |
| yancy | 0 | 0 | 0 | 0 | 0 | 38 |
| NA | 0 | 0 | 0 | 0 | 0 | 1 |
# Eliminate species codes, find distinct, then join in the species from LU
# manually correct missing sites in raw files and
# regenerate the full_id
ht.combined <- ht.combined %>%
mutate(site = case_when(wilid == "415" & is.na(site) ~ "ghole",
wilid == "418" & is.na(site) ~ "ghole",
wilid == "449" & is.na(site) ~ "glen",
wilid == "452" & is.na(site) ~ "glen",
TRUE ~ site)) %>%
mutate(site2 = paste0(site,"-", plot)) %>%
mutate(wilid_full = paste0(site2,"-", wilid))
## still issues with wilid decimal points
ht.combined <- ht.combined %>%
mutate(wilid = str_remove(.$wilid, ".0"))
## !!
ht.combined <- ht.combined %>%
mutate(wilid = as.numeric(wilid)) %>%
filter(!is.na(wilid)) %>%
filter(wilid != "0") %>%
mutate(wilid_full = paste0(site,"-",plot,"-",wilid)) %>%
distinct()
ht.combined %>%
ggTile_yr_season_site2()
# problem records: plot
ht.combined <- ht.combined %>%
# mutate(plot = case_when(site == "crescent" & plot == "cc" ~ "obs",
# TRUE ~ plot)) %>%
mutate(site2 = paste0(site,"-",plot)) %>%
mutate(wilid_full = paste0(site2,"-",wilid))
# ht.combined %>% visdat::vis_dat()
ht.combined %>%
ggTile_yr_season_site2() +
labs(caption = "ht.combined")
# ### Bind in the sprcag and prod derived ht data
ht.combined2 <- ht.combined %>%
mutate(wilid = as.character(wilid)) %>%
bind_rows(., ht.all.01.19) %>%
distinct()
ht.combined2 %>% ggTile_yr_season_site2()
ht.combined2 <- ht.combined %>%
mutate(site2 = paste0(site,"-",plot)) %>%
mutate(wilid_full = paste0(site2,"-",wilid))
ht.combined %>%
ggTile_yr_season_site2()
ht.combined %>%
filter(plot != "obs") %>%
ggTile_yr_season_site2() +
labs(title = "exp sites")
ht.combined %>%
filter(plot == "obs") %>%
ggTile_yr_season_site2() +
labs(title = "obs sites")
## more filtering
ht.combined <- ht.combined %>%
filter(pl_ht_cm < 600)
# fix glen
ht.combined <- ht.combined %>%
mutate(plot = case_when(site == "glen" & plot == "cc" ~ "obs",
TRUE ~ plot))
### QA QC checks on combined data
# ht.combined %>%
# distinct(wilid) %>%
# datatable(caption = "distinct wilid")
# ht.combined %>%
# distinct(wilid_full) %>%
# datatable(caption = "distinct wilid_full")
ht.combined %>%
distinct(site2) %>%
datatable(caption = "distinct site2")
ht.combined %>%
mutate(yr = as.character(yr)) %>%
filter(plot != "obs") %>%
ggPoint_yr_site_season_plot()
gg.plty1 <- ht.combined %>%
ggplot(aes(x = site2, y = pl_ht_cm)) +
geom_point() +
coord_flip()
plotly::ggplotly(gg.plty1)
## create site2 beaver occ lu
### export site 2 lu
# ht.combined.f3 %>%
# distinct(site, plot, site2) %>%
# write_csv("./data/lu_site_site2_beav.csv")
## manually update with LM input
# Beaver currently occupy crystal (2015?-2019) and wb4 (2017-2019).
#
# Lb4, lb5, and lb6 (2016/2017-2018), along with elk4 and elk5 (not sure of dates but not currently occupied).
# lu_site_beav <- read_csv("./data/lu_site_site2_beav.csv")
## plt join
ht.combined <- ht.combined %>%
mutate(site2 = paste0(site,"-",plot)) %>%
mutate(wilid_full = paste0(site2,"-",wilid))
ht.combined %>%
ggTile_yr_season_site2()
ht.combined <- ht.combined %>%
filter(!(yr == "2006" & pl_ht_cm == 460)) %>%
filter(pl_ht_cm > 1)
p <- ht.combined %>%
# mutate(pl_ht_cm = if_else(condition = pl_ht_cm < 1, true = pl_ht_cm*100, false = pl_ht_cm)) %>%
filter(site == "eb1") %>%
ggplot(aes(yr,pl_ht_cm)) +
geom_jitter(aes(color = plot)) +
facet_wrap(~site2)
plotly::ggplotly(p)
# pltly1
pltly1 <- ht.combined %>%
filter(plot != "obs") %>%
ggplot(aes(yr,pl_ht_cm)) +
geom_jitter(aes(color = plot)) +
facet_wrap(~site2)
plotly::ggplotly(pltly1)
# fix
ht.combined <- ht.combined %>%
filter(!is.na(site))
ht.combined %>%
filter(!is.na(site)) %>%
filter(wilid == "353") %>%
ggplot(aes(yr, pl_ht_cm)) +
geom_point(aes(color = season)) +
# geom_label_repel(aes(label = wilid)) +
geom_label(aes(label = season), size = 2.5) +
geom_point(aes(color = season), size = 6, alpha = .1) +
facet_wrap(~site, ncol = 1) +
theme_minimal() +
# facet_grid(season~site) +
labs(title = "wilid 353: suspect 'site' attribution for elk and elk1")
# make educated guess and reclass site for 2014
ht.combined <- ht.combined %>%
mutate(site = case_when(yr == "2014" & site == "elk" ~ "elk2",
TRUE ~ site))
ht.combined %>%
filter(!is.na(site)) %>%
filter(wilid == "353") %>%
ggplot(aes(yr, pl_ht_cm)) +
geom_point(aes(color = season)) +
# geom_label_repel(aes(label = wilid)) +
geom_label(aes(label = season), size = 2.5) +
geom_point(aes(color = season), size = 6, alpha = .1) +
facet_wrap(~site, ncol = 1) +
# facet_grid(season~site) +
labs(title = "wilid 353: suspect 'site' attribution for elk and elk1")
ht.combined %>%
filter(!is.na(site)) %>%
filter(wilid == "353") %>%
ggplot(aes(yr, pl_ht_cm)) +
geom_point(aes(color = season)) +
# geom_label_repel(aes(label = wilid)) +
geom_label(aes(label = wilid)) +
facet_wrap(~site, ncol = 1) +
# facet_grid(season~site) +
labs(title = "wilid 353: suspect 'site' attribution for elk and elk1")
# clean
# address issue of crystal and elk 2 as != obs
ht.combined <- ht.combined %>%
mutate(plot = case_when(site == "crystal" ~ "obs",
TRUE ~ plot)) %>%
mutate(plot = case_when(site == "elk2" ~ "obs",
TRUE ~ plot)) %>%
mutate(site2 = paste0(site,"-",plot)) %>%
mutate(wilid_full = paste0(site2,"-",wilid)) %>%
# select(-c(species, spp_notes)) %>%
distinct()
# gt.1 <- function(df){
# df %>%
# gt::gt() %>%
# tab_header(title = "Count")
# }
#
# ht.combined %>%
# filter(plot != "obs") %>%
# filter(season == "spring") %>%
# tabyl(site, plot, yr) %>%
# # set_names() %>%
# map_df(.,rbind, .id = 'names') %>%
# gt() %>%
# tab_header(title = "Spring data - count of observations")
ht.combined %>%
# filter(site == "elk2") %>%
filter(plot != "obs") %>%
filter(season == "spring") %>%
tabyl(site, plot, yr) %>%
# set_names() %>%
map_df(.,rbind, .id = 'yr') %>%
datatable(caption = "Spring data - count of observations", rownames = FALSE, filter = "top")
ht.combined.nest <- ht.combined %>%
# filter(wilid == "353")
group_by(site, yr) %>%
nest()
ht.combined.nest %>%
pluck(3) %>%
pluck(5) %>%
gt()
#### lu merge
# dcc.wilid.spp.lu
# wilid.spp.lu <- wilid.spp.lu %>%
# mutate(wilid_full = paste0(site, "-", plot, "-", wilid))
## create a lu with dcc raw and v1 wilid spp list
# wilid.spp.lu.2 <- bind_rows(wilid.spp.lu, dcc.wilid.spp.lu) %>%
# distinct()
# write_csv(wilid.spp.lu.2, "./data/wilid_spp._lu_v2.csv")
## summarize by site2 and year using skimr
summary.by.site2 <- ht.combined %>%
# filter(wilid == "924") %>%
filter(!is.na(site)) %>%
mutate(year = as.factor(yr)) %>%
group_by(site, plot, site2,yr) %>%
nest() %>%
mutate(skim2 = map(data,skim)) %>%
unnest(skim2) %>%
ungroup()
## line plot
summary.by.site2 %>%
mutate(yr = as.integer(yr)) %>%
filter(skim_variable == 'pl_ht_cm') %>%
filter(plot != "obs") %>%
# filter(!(site2 == "elk-dx" & yr == 2019)) %>%
ggplot(aes(yr)) +
geom_line(aes(y=numeric.p50, color = plot)) +
geom_point(aes(y=numeric.p50, color = plot)) +
geom_pointrange(aes(y = numeric.p50, ymin = numeric.p25, ymax = numeric.p75, color = plot), alpha = 0.31) +
facet_wrap(~site) +
theme_minimal() +
labs(y="Median willow height (cm)", x = "Year", caption = "Willow height at experimental sites")
# ggsave("./output/median_willow_height_20191205_0924.png", width = 7, height = 5.5)
##
summary.by.site2 %>%
select(yr, plot, site2, skim_variable, contains("numeric")) %>%
filter(!(site2 == "elk-dx" & yr == 2019)) %>%
filter(skim_variable == "pl_ht_cm") %>%
filter(plot != "obs") %>%
mutate(yr = as.integer(yr)) %>%
ggplot(aes(yr, site2)) +
geom_tile(aes(fill = numeric.mean), color = 'gray70') +
scale_fill_viridis() +
theme_light() +
labs(x = "Year", y = "", subtitle = "Mean willow height", fill = "Height (cm)", caption = getwd())
# ggsave("./output/median_willow_height_HM_20191205_0924.png", width = 7, height = 7)
## create species lookup
# ht.combined %>%
# mutate(species = case_when(species == 'beb' ~ "bebb",
# species == 'drumm' ~ "drum",
# species == 'boothii' ~ "booth",
# species == 'boothi' ~ "booth",
# species == 'lassiandra' ~ "lass",
# species == 'plantifolia' ~ "plan",
# species == 'planifolia' ~ "plan",
#
# TRUE ~ species)) %>%
# # filter(is.na(species))
# # filter(species == "na")
# distinct(site2, wilid, species) %>%
# filter(!is.na(species)) %>%
# filter(species != "na") %>%
# mutate(wilid_full = paste0(site2,"-",wilid)) %>%
# select(wilid_full, species) %>%
# write_csv("./data/lu_spp_site2.csv")
ht.combined %>%
# filter(is.na(species)) %>%
group_by(site, wilid, yr) %>%
tally() %>%
datatable(filter = "top")
lu.wilid.spp.v3 <- lu.wilid.spp.v3 %>%
select(species, wilid_full)
### spp join on wilid ful
ht.combined <- ht.combined %>%
left_join(.,lu.wilid.spp.v3, by = "wilid_full")
ht.combined <- ht.combined %>%
left_join(.,plot.lu) %>%
select(-treat)
ht.combined %>%
visdat::vis_dat()
## join bv beav
ht.combined <- ht.combined %>%
left_join(., lu_site_beav)
ht.combined %>% visdat::vis_dat()
ht.combined %>%
group_by(yr, site, plot) %>%
tally() %>%
ggplot(aes(yr,site)) +
geom_tile(aes(fill = n)) +
facet_wrap(~plot)
ht.combined %>% visdat::vis_dat()
ht.combined %>%
# mutate(wilid = str_remove(.$wilid, ".0"))
filter(is.na(species))
## # A tibble: 2,248 x 17
## yr wilid site site2 season plot pl_ht_cm wilid_full species exp dam
## <chr> <dbl> <chr> <chr> <chr> <chr> <dbl> <chr> <chr> <chr> <chr>
## 1 2018 3 elk elk-~ fall cc 99 elk-cc-3 <NA> 1 0
## 2 2018 3 elk elk-~ fall cc 178 elk-cc-3 <NA> 1 0
## 3 2018 5 elk elk-~ fall dc 116 elk-dc-5 <NA> 1 1
## 4 2018 3 elk elk-~ fall dx 331 elk-dx-3 <NA> 1 1
## 5 2018 6 elk elk-~ fall dx 239 elk-dx-6 <NA> 1 1
## 6 2018 9 elk elk-~ fall dx 408 elk-dx-9 <NA> 1 1
## 7 2018 532 elk elk-~ fall dx 312 elk-dx-532 <NA> 1 1
## 8 2018 5 elk elk-~ fall dx 183 elk-dx-5 <NA> 1 1
## 9 2018 3 elk elk-~ fall cx 253 elk-cx-3 <NA> 1 0
## 10 2018 2 elk elk-~ fall cx 224 elk-cx-2 <NA> 1 0
## # ... with 2,238 more rows, and 6 more variables: browse <chr>, beav19 <chr>,
## # beav18 <chr>, beav17 <chr>, beav16 <chr>, beav15 <chr>
ht.combined %>%
# select(-c(species, spp_notes)) %>%
write_csv("./output/processed_data/ht_combined20191231_1142.csv")
The metadata csv included in the DCC repository does not include all the variables.
In the DCC data, “browse = 0” indicates experimental exclosure treatment. For example, see willid 1 in EB1. The plot type is listed in the 2018 dataset as “dx”. In the 2001-2017 data, it’s dam == 1, browse == 0
In the supplemental material accompanying the 2013 Marshall et al. ProcRoySoc paper, the willid are attributed with “dammed” and “UNbrowsed”. This is confusing, since for “dam”, 1 is the experimental treatment, but for “browse”, 1 is the control.
#### old
## Import 2018 Data
prod.path <- "data/raw/production/Exp_2018_Production_Height_20181220.xlsx"
# the following seems to work for taking all of the tabs, importing them into a single tibble
# B/c of parsing errors, everything is brought in as char, so need to type-fix.
prod18.df <- prod.path %>%
excel_sheets() %>%
set_names() %>%
map(read_excel, path = prod.path, skip = 1, col_types = 'text') %>%
map(clean_names) %>%
map_df(.f = bind_rows, .id = "FNAME")
# I could theoretically type set on import through the 'col_types' arg, BUT some of the tabs have 126 columns, some 127... Not sure which columns differ. A different puzzle to solve at some point :)
## plot the count of observations
w_ht01_17 %>%
mutate(year = as.factor(year)) %>%
group_by(season, year) %>%
summarise(cnt = n()) %>%
ggplot(aes(year, cnt)) +
geom_bar(stat = 'identity', aes(fill = season), position = "dodge", color = "black") +
theme_bw()
# There's only two years (01,17) with Spring measurements...