From c5b182ff87c637c844ab8b25003cd41eb50a38fe Mon Sep 17 00:00:00 2001 From: Koen Hufkens Date: Sat, 2 Sep 2023 10:05:21 +0000 Subject: [PATCH] simplify code --- analysis/02_moonlight_glm_models_GPS.R | 28 +------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/analysis/02_moonlight_glm_models_GPS.R b/analysis/02_moonlight_glm_models_GPS.R index 19e4edc..495274b 100644 --- a/analysis/02_moonlight_glm_models_GPS.R +++ b/analysis/02_moonlight_glm_models_GPS.R @@ -9,33 +9,7 @@ library(report) #---- 0. read in data and subset ---- -if(!file.exists("data/curated/data_GPS.rds")){ - - # read in data, retain GPS night values - # convert data types for modelling - df <- readRDS("data/data_annotated.rds") |> - filter( - sensor == "GPS", - stages == "night", - ocean_dates == "Continental" - ) |> - mutate( - species = factor(species), - tag = factor(tag) - ) |> - select( - altbin, - moon_illuminance, - species, - tag - ) - - # save and compress for reproducibility - saveRDS(df, file = "data/curated/data_GPS.rds", compress = "xz") - -} else { - df <- readRDS("data/curated/data_GPS.rds") -} +df <- readRDS("data/curated/data_GPS.rds") #---- 1. fit model ----