Skip to content

Commit

Permalink
only call caller_env() in top-most level, then pass downward
Browse files Browse the repository at this point in the history
  • Loading branch information
gl-eb committed Sep 9, 2022
1 parent 81db56c commit 5cc6ecd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions R/yardlistr_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ clean_ebird_data <- function(data_file, yard_location,
suppressWarnings()

# filter data by location
dat_location <- check_location(raw_dat, yard_location)
dat_location <- check_location(raw_dat, yard_location, call)

# filter data by location and sort by datetime
dat_cleaned <- dat_location |>
Expand Down Expand Up @@ -80,8 +80,7 @@ clean_ebird_data <- function(data_file, yard_location,
}

# check if specified location is present in data
check_location <- function(raw_dat, yard_location,
call = rlang::caller_env()) {
check_location <- function(raw_dat, yard_location, call) {
dat_location <- raw_dat |> dplyr::filter(Location == yard_location)

if (dim(dat_location)[1] == 0) {
Expand Down
2 changes: 1 addition & 1 deletion R/yardlistr_main.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#' \dontrun{
#' yardlistr("My Location", "./Data", "./Plots")
#' }
yardlistr <- function(location, dir_dat, dir_img, call = rlang::caller_env()) {
yardlistr <- function(location, dir_dat, dir_img) {
# file system -------------------------------------------------------------

# set data directories
Expand Down

0 comments on commit 5cc6ecd

Please sign in to comment.