75 lines
1.7 KiB
R
75 lines
1.7 KiB
R
# Setup
|
|
source("setup/functions.R")
|
|
source("setup/loadlibraries.R")
|
|
|
|
|
|
# Import data ----
|
|
|
|
# A farm that has one type of feeder ----
|
|
farmA <- xlsx_to_dataframe(filename = "data/farm_A_demo.xlsx",
|
|
method = "farm_A_11rows")
|
|
|
|
str(farmA)
|
|
|
|
# From CDPQ group ----
|
|
load("data/farmB.RData")
|
|
|
|
farmB <- data_alim # renaming
|
|
rm(data_alim)
|
|
|
|
str(farmB)
|
|
|
|
# Standardizing ----
|
|
|
|
farmB_standard <- harmonize_feeder_data(farmB,
|
|
groupstations = TRUE,
|
|
method = "deschambault")
|
|
|
|
farmA_standard <- harmonize_feeder_data(farmA,
|
|
groupstations = TRUE,
|
|
method = "farm_A_raw",
|
|
remove_filling = TRUE,
|
|
remove_na = TRUE)
|
|
|
|
str(farmA_standard)
|
|
|
|
str(farmB_standard)
|
|
|
|
|
|
# Inspecting data integrity
|
|
|
|
populationPlot(farmA_standard)
|
|
populationPlot(farmB_standard)
|
|
|
|
|
|
visitPlotsDay(farmA_standard,
|
|
thedate = "2021-06-03",
|
|
thestation = 11,
|
|
singlestrip = FALSE)
|
|
|
|
inspectDay(farmA_standard, 11)
|
|
|
|
|
|
# Make network plots ----
|
|
|
|
farmA_list <- makeAllStationsPerdate(farmA_standard, domerge = "F")
|
|
|
|
farmA_pairs <- makePairsPerStation(farmA_list, mythreshold = 5) # TAKES A LONG TIME
|
|
|
|
farmA_network <- makeIGraphObjects(farmA_pairs, directed = T)
|
|
|
|
plot(farmA_network[["12"]][["2021-05-20"]])
|
|
|
|
|
|
# Edge density plot ----
|
|
|
|
getmetheplot_pliz(site = "Farm A",
|
|
df = farmA_standard,
|
|
thestation = 12)
|
|
|
|
getmetheplot_pliz_but_corrected_this_time(site = "Farm A",
|
|
df = farmA_standard,
|
|
thestation = 5)
|
|
|
|
|