diff --git a/R/extdata.r b/R/extdata.r index beeac984..40c029b8 100644 --- a/R/extdata.r +++ b/R/extdata.r @@ -8,8 +8,8 @@ #' #' @section Filename: walleye_detections.zip #' -#' @usage -#' system.file("extdata", "walleye_detections.zip", package="glatos") +#' @examples +#' system.file("extdata", "walleye_detections.zip", package = "glatos") #' #' @author Todd Hayden #' @@ -37,8 +37,8 @@ NULL #' #' @section Filename: SMRSL_GLATOS_20140828.xlsm #' -#' @usage -#' system.file("extdata", "SMRSL_GLATOS_20140828.xlsm", package="glatos") +#' @examples +#' system.file("extdata", "SMRSL_GLATOS_20140828.xlsm", package = "glatos") #' #' @author Chris Holbrook #' @@ -53,12 +53,12 @@ NULL #' #' @format Folder contains 30 sequentially labeled .png image files #' -#' @name video images +#' @name video-images #' #' @section Filename: frames #' -#' @usage -#' system.file("extdata", "frames", package="glatos") +#' @examples +#' system.file("extdata", "frames", package = "glatos") #' #' @author Todd Hayden #' @@ -77,8 +77,8 @@ NULL #' #' @section Filename: shoreline.zip #' -#' @usage -#' system.file("extdata", "shoreline.zip", package="glatos") +#' @examples +#' system.file("extdata", "shoreline.zip", package = "glatos") #' #' @author Todd Hayden #' @@ -95,7 +95,7 @@ NULL #' #' @section Filename: otn_aat_animals.csv #' -#' @usage +#' @examples #' system.file("extdata", "otn_aat_animals.csv", package = "glatos") #' #' @source Ryan Gosse, Ocean Tracking Network @@ -111,7 +111,7 @@ NULL #' #' @section Filename: otn_aat_receivers.csv #' -#' @usage +#' @examples #' system.file("extdata", "otn_aat_receivers.csv", package = "glatos") #' #' @source Ryan Gosse, Ocean Tracking Network @@ -127,7 +127,7 @@ NULL #' #' @section Filename: otn_aat_tag_releases.csv #' -#' @usage +#' @examples #' system.file("extdata", "otn_aat_tag_releases.csv", package = "glatos") #' #' @source Ryan Gosse, Ocean Tracking Network diff --git a/R/load-prepare_deploy_sheet.R b/R/load-prepare_deploy_sheet.R index 4230321a..bfd90e1f 100644 --- a/R/load-prepare_deploy_sheet.R +++ b/R/load-prepare_deploy_sheet.R @@ -36,6 +36,13 @@ #' @export prepare_deploy_sheet <- function(path, header_line = 5, sheet_name = 1, combine_arr_stn = TRUE) { + ## Declare global variables for NSE & R CMD check + DEPLOY_LAT <- DEPLOY_LONG <- INS_MODEL_NO <- + `DEPLOY_DATE_TIME (yyyy-mm-ddThh:mm:ss)` <- + `RECOVER_DATE_TIME (yyyy-mm-ddThh:mm:ss)` <- STATION_NO <- + OTN_ARRAY <- station <- ins_model_no <- deploy_lat <- deploy_long <- + deploy_date_time <- recover_date_time <- NULL + deploy_sheet <- readxl::read_excel(path, sheet = sheet_name, skip = header_line - 1, diff --git a/R/load-prepare_tag_sheet.R b/R/load-prepare_tag_sheet.R index d0dee61d..06ee6ccf 100644 --- a/R/load-prepare_tag_sheet.R +++ b/R/load-prepare_tag_sheet.R @@ -31,6 +31,10 @@ #' @export prepare_tag_sheet <- function(path, header_line = 5, sheet_name = 2) { + ## Declare global variables for NSE & R CMD check + TAG_CODE_SPACE <- TAG_ID_CODE <- EST_TAG_LIFE <- UTC_RELEASE_DATE_TIME <- + SEX <- RELEASE_LATITUDE <- RELEASE_LONGITUDE <- SCIENTIFIC_NAME <- NULL + tag_sheet <- readxl::read_excel(path, sheet = sheet_name, skip = header_line - 1) tag_sheet <- tag_sheet %>% dplyr::mutate( transmitter_id = paste(TAG_CODE_SPACE, TAG_ID_CODE, sep = "-"), diff --git a/R/load-read_vdat_csv.r b/R/load-read_vdat_csv.r index ccc3230a..609c0f71 100644 --- a/R/load-read_vdat_csv.r +++ b/R/load-read_vdat_csv.r @@ -1,7 +1,5 @@ #' Read data from an Innovasea Fathom VDAT CSV file #' -#' Read data from an Innovasea Fathom VDAT CSV file -#' #' @param src A character string with path and name of an Innovasea VDAT CSV #' detection file. If only file name is given, then the file must be located #' in the working directory. @@ -136,6 +134,9 @@ read_vdat_csv <- function(src, return() } + ## Declare global variables for NSE & R CMD check + record_type <- NULL + # Identify vdat csv format version and vdat.exe version that created input csv vdat_header <- data.table::fread(file = src, nrows = 1L, header = FALSE) @@ -218,13 +219,13 @@ read_vdat_csv <- function(src, keep.by = FALSE ) - data(vdat_csv_schema) + utils::data("vdat_csv_schema", envir = environment()) vdat_csv_schema <- vdat_csv_schema[[paste0("v", src_version$fathom_csv)]] # Preallocate list; element = record type - vdat <- setNames( + vdat <- stats::setNames( object = vector("list", length(vdat_list)), nm = names(vdat_list) ) diff --git a/R/load-write_vdat_csv.r b/R/load-write_vdat_csv.r index 6ffd201d..114a7457 100644 --- a/R/load-write_vdat_csv.r +++ b/R/load-write_vdat_csv.r @@ -74,6 +74,11 @@ write_vdat_csv <- function(vdat, out_file = NULL, output_format = "csv.fathom", include_empty = FALSE) { + ## Declare global variables for NSE & R CMD check + record_type <- dt2 <- `Device Time (UTC)` <- `Time Correction (s)` <- + `Ambient (deg C)` <- `Ambient Min (deg C)` <- `Ambient Max (deg C)` <- + `Ambient Mean (deg C)` <- `Internal (deg C)` <- ..txt_cols <- txt <- NULL + # Check input class if (!inherits(vdat, "vdat_list")) { stop( @@ -107,7 +112,7 @@ write_vdat_csv <- function(vdat, if (out_file_type == "dir") { out_file_name <- gsub("\\.vrl$|\\.vdat$", out_file_ext, - tail(vdat$DATA_SOURCE_FILE$`File Name`, 1), + utils::tail(vdat$DATA_SOURCE_FILE$`File Name`, 1), ignore.case = TRUE ) @@ -142,12 +147,12 @@ write_vdat_csv <- function(vdat, # Compress each list element into a character vector - vdat_lines_body <- setNames( + vdat_lines_body <- stats::setNames( object = vector("list", length(record_types)), record_types ) - vdat_lines_header <- setNames( + vdat_lines_header <- stats::setNames( object = vector("list", length(record_types)), record_types ) diff --git a/R/package-glatos.r b/R/package-glatos.r index c9716029..dae821bb 100644 --- a/R/package-glatos.r +++ b/R/package-glatos.r @@ -35,12 +35,12 @@ #' #' \item{[real_sensor_values]}{ Converts 'raw' transmitter sensor (e.g., #' depth, temperature) to 'real'-scale values (e.g., depth in meters) using -#' transmitter specification data (e.g., from read\_vemco\_tag\_specs).} } +#' transmitter specification data (e.g., from [read_vemco_tag_specs]).} } #' #' @section Filtering and summarizing: \describe{ #' \item{[min_lag]}{ #' Facilitates identification and removal of false positive detections by -#' calculating the minimum time interval (min\_lag) between successive +#' calculating the minimum time interval (min_lag) between successive #' detections.} #' #' \item{[false_detections]}{ Removes potential false positive detections @@ -123,7 +123,10 @@ #' txtProgressBar unzip write.csv write.table zip #' @importFrom grDevices bmp colorRampPalette dev.new dev.off jpeg png rainbow #' tiff -globalVariables(".") # to avoid R CMD check note +"_PACKAGE" + +# avoid R CMD check note +globalVariables(".") # package startup message .onAttach <- function(libname, pkgname) { diff --git a/R/proc-min_lag.r b/R/proc-min_lag.r index b9f0d103..9d42c050 100644 --- a/R/proc-min_lag.r +++ b/R/proc-min_lag.r @@ -64,6 +64,10 @@ #' @export min_lag <- function(det) { + ## Declare global variables for NSE & R CMD check + ord <- transmitter_codespace <- transmitter_id <- receiver_sn <- + detection_timestamp_utc <- NULL + # coerce to data.table dtc <- data.table::as.data.table(det) diff --git a/R/proc-real_sensor_values.r b/R/proc-real_sensor_values.r index d5115a9a..573641f9 100644 --- a/R/proc-real_sensor_values.r +++ b/R/proc-real_sensor_values.r @@ -110,6 +110,10 @@ #' @export real_sensor_values <- function(det, tag_specs) { + ## Declare global variables for NSE & R CMD check + ord <- transmitter_codespace <- transmitter_id <- code_space <- id_code <- + sensor_value_real <- sensor_intercept <- sensor_value <- sensor_slope <- NULL + # coerce to data.table dtc <- data.table::as.data.table(det) diff --git a/R/sim-crw_in_polygon.r b/R/sim-crw_in_polygon.r index 89a5e6b6..ab614f55 100644 --- a/R/sim-crw_in_polygon.r +++ b/R/sim-crw_in_polygon.r @@ -9,14 +9,14 @@ #' are also accepted); \cr *OR* \cr A polygon defined as data frame or #' matrix with numeric columns x and y. #' -#' @param theta A 2-element numeric vector with turn angle parameters (theta[1] -#' = mean; theta[2] = sd), in degrees, from normal distribution. +#' @param theta A 2-element numeric vector with turn angle parameters (`theta[1]` +#' = mean; `theta[2]` = sd), in degrees, from normal distribution. #' #' @param stepLen A numeric scalar with total distance moved in each step, in #' meters. #' #' @param initPos A 2-element numeric vector with initial position -#' (initPos[1]=x, initPos[2]=y) in same coordinate reference system as +#' (`initPos[1]`=x, `initPos[2]`=y) in same coordinate reference system as #' `polyg`. #' #' @param initHeading A numeric scalar with initial heading in degrees. E.g., 0 @@ -242,7 +242,7 @@ crw_in_polygon <- function(polyg, theta = c(0, 10), stepLen = 100, } # Close polyg if needed (first and last point must be same) - if (!identical(polyg[1, ], tail(polyg, 1))) polyg <- rbind(polyg, polyg[1, ]) + if (!identical(polyg[1, ], utils::tail(polyg, 1))) polyg <- rbind(polyg, polyg[1, ]) # Make sf object polyg_sf <- sf::st_polygon(list(as.matrix(polyg[c("x", "y")]))) @@ -429,8 +429,8 @@ check_cross_boundary <- function(path, boundary, EPSG) { # Make line segment objects of sequential point-pairs in path segs_mat <- cbind( - head(path, -1), - tail(path, -1) + utils::head(path, -1), + utils::tail(path, -1) ) in_poly <- diff --git a/R/sim-detect_transmissions.r b/R/sim-detect_transmissions.r index a5d6b232..cd0cd9ea 100644 --- a/R/sim-detect_transmissions.r +++ b/R/sim-detect_transmissions.r @@ -219,6 +219,9 @@ detect_transmissions <- function(trnsLoc = NA, inputCRS = NA, sp_out = TRUE, show_progress = TRUE) { + ## Declare global variables for NSE & R CMD check + trns_x <- trns_y <- NULL + # Check input class - trnsLoc if (!inherits(trnsLoc, c("data.frame", "sf", "sfc", "SpatialPointsDataFrame"))) { stop( diff --git a/R/sim-transmit_along_path.r b/R/sim-transmit_along_path.r index 3b52f7d4..ab9d6d09 100644 --- a/R/sim-transmit_along_path.r +++ b/R/sim-transmit_along_path.r @@ -179,6 +179,9 @@ transmit_along_path <- function(path = NA, ), pathCRS = NA, sp_out = TRUE) { + ## Declare global variables for NSE & R CMD check + cumdistm <- NULL + # Check input class if (!inherits(path, c("data.frame", "sf", "sfc", "SpatialPointsDataFrame"))) { stop( diff --git a/R/simutil-crw.r b/R/simutil-crw.r index e0537a67..4959ad94 100644 --- a/R/simutil-crw.r +++ b/R/simutil-crw.r @@ -4,12 +4,12 @@ #' drawn from a normal distribution. #' #' @param theta A 2-element numeric vector with turn angle parameters -#' (theta[1] = mean; theta[2] = sd) from normal distribution. +#' (`theta[1]` = mean; `theta[2]` = sd) from normal distribution. #' #' @param stepLen A numeric scalar with total distance moved in each step. #' -#' @param initPos A 2-element numeric vector with nital position (initPos[1]=x, -#' initPos[2]=y). +#' @param initPos A 2-element numeric vector with nital position (`initPos[1]`=x, +#' `initPos[2]`=y). #' #' @param initHeading A numeric scalar with initial heading in degrees. #' diff --git a/R/summ-receiver_efficiency.r b/R/summ-receiver_efficiency.r index aafd20df..c08fa812 100644 --- a/R/summ-receiver_efficiency.r +++ b/R/summ-receiver_efficiency.r @@ -55,6 +55,10 @@ #' @export REI <- function(detections, deployments) { + ## Declare global variables for NSE & R CMD check + recover_date_time <- last_download <- station <- days_deployed <- deploy_lat <- + deploy_long <- animal_id <- common_name_e <- detection_timestamp_utc <- NULL + # Check for proper columns required_deployment_columns <- c("station", "deploy_date_time", "recover_date_time") required_detection_columns <- c("station", "common_name_e", "animal_id", "detection_timestamp_utc") diff --git a/R/summ-residence_index.r b/R/summ-residence_index.r index 2b5959a5..48d1f386 100644 --- a/R/summ-residence_index.r +++ b/R/summ-residence_index.r @@ -174,6 +174,11 @@ residence_index <- function( detections, calculation_method = "kessel", locations = NULL, group_col = "animal_id", time_interval_size = "1 day", groupwise_total = TRUE) { + # Declare global variables for R CMD check + location <- mean_latitude <- mean_longitude <- days_detected <- + total_days <- NULL + + # set to NULL if NA if (!is.null(group_col)) if (is.na(group_col)) group_col <- NULL if (!is.null(locations)) if (all(is.na(locations))) locations <- NULL @@ -237,7 +242,7 @@ residence_index <- function( # numerator group_cols <- c("location", group_col) - detections <- dplyr::group_by(detections, across(group_cols)) + detections <- dplyr::group_by(detections, dplyr::across(group_cols)) ri <- dplyr::do( detections, @@ -263,7 +268,7 @@ residence_index <- function( time_interval_size ) } else { - detections <- dplyr::group_by(detections, across(group_col)) + detections <- dplyr::group_by(detections, dplyr::across(group_col)) ri <- dplyr::left_join(ri, dplyr::do( detections, @@ -365,6 +370,9 @@ total_diff_days <- function(detections) { #' #' @importFrom dplyr mutate aggregate_total_with_overlap <- function(detections) { + # Declare global variables for R CMD check + last_detection <- first_detection <- NULL + detections <- mutate(detections, timedelta = as.double(difftime(last_detection, first_detection, units = "secs"))) detections <- mutate(detections, timedelta = dplyr::recode(detections$timedelta, `0` = 1)) total <- as.double(sum(detections$timedelta)) / 86400.0 @@ -382,6 +390,9 @@ aggregate_total_with_overlap <- function(detections) { #' #' @importFrom data.table foverlaps aggregate_total_no_overlap <- function(detections) { + # Declare global variables for R CMD check + t1 <- t2 <- first_detection <- last_detection <- xid <- yid <- tdiff <- NULL + # extract intervals, rename ints <- data.table::as.data.table(detections)[, .( t1 = first_detection, diff --git a/R/summ-summarize_detections.r b/R/summ-summarize_detections.r index b78a6ed8..4d11ae6e 100644 --- a/R/summ-summarize_detections.r +++ b/R/summ-summarize_detections.r @@ -194,6 +194,11 @@ summarize_detections <- function(det, location_col = "glatos_array", receiver_locs = NULL, animals = NULL, summ_type = "animal") { + ## Declare global variables for NSE & R CMD check + deploy_lat <- deploy_long <- detection_timestamp_utc <- num_fish <- animal_id <- + num_locs <- num_dets <- NULL + + # coerce to data.table dtc <- data.table::as.data.table(det) diff --git a/R/testdata.r b/R/testdata.r index 0bff5e2a..24305dc0 100644 --- a/R/testdata.r +++ b/R/testdata.r @@ -10,7 +10,7 @@ #' #' @section Filename: higgins_lake_transition.rds #' -#' @usage +#' @examples #' system.file("testdata", "higgins_lake_transition.rds", package = "glatos") #' #' @author Chris Holbrook @@ -29,7 +29,7 @@ NULL #' #' @section Filename: flynn_island_transition.rds #' -#' @usage +#' @examples #' system.file("testdata", "flynn_island_transition.rds", package = "glatos") #' #' @author Chris Holbrook diff --git a/R/util-convert_glatos_to_att.r b/R/util-convert_glatos_to_att.r index 196eee45..aec6b688 100644 --- a/R/util-convert_glatos_to_att.r +++ b/R/util-convert_glatos_to_att.r @@ -42,6 +42,11 @@ convert_glatos_to_att <- function(detectionObj, receiverObj, crs = sp::CRS("+init=epsg:4326")) { + ## Declare global variables for R CMD check + Sex <- glatos_array <- station_no <- deploy_lat <- deploy_long <- + station <- dummy <- ins_model_no <- ins_serial_no <- + deploy_date_time <- recover_date_time <- detection_timestamp_utc <- NULL + transmitters <- if (all(grepl("-", detectionObj$transmitter_id, fixed = TRUE))) { detectionObj$transmitter_id diff --git a/R/util-convert_otn_erddap_to_att.r b/R/util-convert_otn_erddap_to_att.r index 931532a8..da17625e 100644 --- a/R/util-convert_otn_erddap_to_att.r +++ b/R/util-convert_otn_erddap_to_att.r @@ -77,6 +77,11 @@ #' convert_otn_erddap_to_att <- function(detectionObj, erdTags, erdRcv, erdAni, crs = sf::st_crs(4326)) { + ## Declare global variables for R CMD check + Sex <- latitude <- longitude <- station <- receiver_model <- + receiver_serial_number <- dummy <- time <- recovery_datetime_utc <- + deploy_datetime_utc <- detection_timestamp_utc <- NULL + transmitters <- if (all(grepl("-", detectionObj$transmitter_id, fixed = TRUE))) { detectionObj$transmitter_id diff --git a/R/util-convert_otn_to_att.r b/R/util-convert_otn_to_att.r index e104ce15..dd1cd706 100644 --- a/R/util-convert_otn_to_att.r +++ b/R/util-convert_otn_to_att.r @@ -89,6 +89,12 @@ convert_otn_to_att <- function(detectionObj, deploymentSheet = NULL, timeFilter = TRUE, crs = sf::st_crs(4326)) { + ## Declare global variables for R CMD check + station <- receiver_sn <- deploy_lat <- deploy_long <- detection_timestamp_utc <- + deploy_date_time <- recover_date_time <- last_download <- instrumenttype <- + ins_model_no <- Tag.ID <- Sex <- NULL + + if (is.null(deploymentObj) && is.null(deploymentSheet)) { stop("Deployment data must be supplied by either 'deploymentObj' or 'deploymentSheet'") } else if ((!is.null(deploymentObj)) && (!is.null(deploymentSheet))) { diff --git a/R/util-kml_to_csv.r b/R/util-kml_to_csv.r index 01971d40..13a28b11 100644 --- a/R/util-kml_to_csv.r +++ b/R/util-kml_to_csv.r @@ -42,7 +42,7 @@ kml_to_csv <- function(filePath, type[type == "polygons"] <- "POLYGON" # Unzip if kmz - fileExt <- tools::file_ext(kml_file) + fileExt <- tools::file_ext(filePath) if (tolower(fileExt) == "kmz") stop("kmz are not supported.") diff --git a/R/util-vdat.r b/R/util-vdat.r index 7b4eed18..736e1dd8 100644 --- a/R/util-vdat.r +++ b/R/util-vdat.r @@ -180,6 +180,10 @@ vdat_convert <- function(src, skip_pattern = "-RLD_", show_progress = TRUE, diagn = FALSE) { + ## Declare global variables for NSE & R CMD check + src_dir <- src_file <- out_file <- out_file_exists <- src_to_convert <- + written <- NULL + # Supported input file extensions (not case sensitive) supported_ext <- c("vrl", "vdat") @@ -487,7 +491,7 @@ vdat_convert <- function(src, #' of the system. #' #' @returns Character string with command for calling VDAT.exe via -#' \code{system2}'s \code{\link{command}} argument. +#' \code{system2}'s \code{command} argument. #' #' @examples #' \dontrun{ diff --git a/R/util-vue.r b/R/util-vue.r index a52de60e..5a5d9054 100644 --- a/R/util-vue.r +++ b/R/util-vue.r @@ -167,6 +167,10 @@ vue_convert <- function(src, skip_pattern = "-RLD_", show_progress = TRUE, diagn = FALSE) { + ## Declare global variables for NSE & R CMD check + src_dir <- src_file <- out_file <- out_file_exists <- src_to_convert <- + written <- NULL + # Supported input file extensions (not case sensitive) supported_ext <- "vrl" @@ -468,7 +472,7 @@ vue_convert <- function(src, #' of the system. #' #' @returns Character string with command for calling VUE.exe via -#' \code{system2}'s \code{\link{command}} argument. +#' \code{system2}'s \code{command} argument. #' #' @examples #' \dontrun{ diff --git a/R/vis-detection_bubble_plot.r b/R/vis-detection_bubble_plot.r index e52ffed0..655124ed 100644 --- a/R/vis-detection_bubble_plot.r +++ b/R/vis-detection_bubble_plot.r @@ -1,4 +1,3 @@ -#' Plot number of tagged animals or detections on a map #' #' Make bubble plots showing the number of fish detected across a defined set #' of receiver locations. @@ -124,6 +123,9 @@ detection_bubble_plot <- function(det, location_col = "glatos_array", symbol_radius = 1, col_grad = c("white", "red"), scale_loc = NULL) { + # Declare global variables for NSE & R CMD check + great_lakes_polygon <- NULL + # Check that the specified columns appear in the det data frame missingCols <- setdiff( c( @@ -163,7 +165,11 @@ detection_bubble_plot <- function(det, location_col = "glatos_array", message("Converted map to EPSG:4326") } - if (is.null(map)) map <- great_lakes_polygon # example in glatos package (sf object) + if (is.null(map)) { + utils::data("great_lakes_polygon", envir = environment()) + map <- great_lakes_polygon + rm(great_lakes_polygon) + } # example in glatos package (sf object) # Check that timestamp is of class 'POSIXct' if (!("POSIXct" %in% class(det$detection_timestamp_utc))) { diff --git a/R/vis-interpolate_path.r b/R/vis-interpolate_path.r index 073287ad..2ec2a1cc 100644 --- a/R/vis-interpolate_path.r +++ b/R/vis-interpolate_path.r @@ -63,7 +63,7 @@ #' interpolation will be used for all points when `lnl_thresh` #' = 0. #' -#' @details All linear interpolation is done by code{stats::approx} with +#' @details All linear interpolation is done by [stats::approx] with #' argument `ties = "ordered"` controlling how tied `x` values #' are handled. See [approxfun()]. #' @@ -196,6 +196,14 @@ interpolate_path <- function(det, trans = NULL, start_time = NULL, int_time_stamp = 86400, lnl_thresh = 0.9, out_class = NULL, show_progress = TRUE){ + ## Declare global variables for NSE & R CMD check + detection_timestamp_utc <- record_type <- num_rows <- animal_id <- bin <- + bin_stamp <- i_lat <- deploy_lat <- i_lon <- deploy_long <- bin_timestamp <- + num <- start_dtc <- x.animal_id <- x.detection_timestamp_utc <- x.deploy_lat <- + x.deploy_long <- x.record_type <- x.num_rows <- x.bin <- gcd <- i.start <- + lcd <- crit <- t_lat <- t_lon <- t_timestamp <- coord <- grp <- nln_longitude <- + nln_latitude <- seq_count <- i_time <- latitude_lead <- longitude_lead <- + cumdist <- NULL # stop if out_class is not NULL, data.table, or tibble if(!is.null(out_class)){ diff --git a/R/vis-kml_workbook.r b/R/vis-kml_workbook.r index 63d2a5a8..aee435dc 100644 --- a/R/vis-kml_workbook.r +++ b/R/vis-kml_workbook.r @@ -115,6 +115,9 @@ kml_workbook <- function( )) } + ## Declare global variables for NSE & R CMD check + Folder <- NULL + # set default and get optional kml arguments kml_args <- list(labelSize = 0.6, iconSize = 0.6) args_in <- list(...) diff --git a/R/vis-make_frames.r b/R/vis-make_frames.r index 231817f3..12fc58f7 100644 --- a/R/vis-make_frames.r +++ b/R/vis-make_frames.r @@ -64,22 +64,23 @@ #' the timeline). See also **Details** and **Note** sections. #' #' @details -#' #' ***To customize fish location points (from `proc_obj`):*** Add any argument #' that can be passed to [points][graphics::points]. The following values will #' create the default plot: #' \itemize{ -#' \item{`cex:`}{ symbol size; default = 2} -#' \item{`col:`}{ symbol color; default = "blue"} -#' \item{`pch:`}{ symbol type; default = 16} +#' \item `cex`: symbol size; default = 2 +#' \item `col`: symbol color; default = "blue" +#' \item `pch`: symbol type; default = 16 #' } #' +#' @details +#' #' ***To customize receiver location points (from `recs`):*** Add prefix #' `recs.` to any argument that can be passed to [points][graphics::points]. The #' following values will create the default plot: #' \itemize{ -#' \item{`recs.cex:`}{ symbol size; default = 1.5} -#' \item{`recs.pch:`}{ symbol type; default = 16} +#' \item `recs.cex`: symbol size; default = 1.5 +#' \item `recs.pch`: symbol type; default = 16 #' } #' #' ***To customize timeline:*** Add add prefix `timeline.` to any @@ -87,31 +88,31 @@ #' the sliding symbol (see 'slider' below) are created by a call to `axis`. The #' following values will create the default plot: #' \itemize{ -#' \item{`timeline.at:`}{ a sequence with locations of labels (with first +#' \item `timeline.at`: a sequence with locations of labels (with first #' and last being start and end) along x-axis; in units of longitude; by default #' this will center the timeline with five equally-spaced labels in the middle -#' 80% of background_xlim.} -#' \item{`timeline.pos:`}{ location along the y-axis; in units of latitude; +#' 80% of background_xlim. +#' \item `timeline.pos`: location along the y-axis; in units of latitude; #' by default this will place the timeline up from the bottom 6% of the range -#' of `background_ylim`} -#' \item{`timeline.labels:`}{ text used for labels; default = -#' `format(labels, "\%Y-\%m-\%d")`, where labels are values of proc_obj$bin_timestamp} -#' \item{`timeline.col:`}{ color of line; default = "grey70"} -#' \item{`timeline.lwd:`}{ width of line; default = 20 times the aspect -#' ratio of the plot device} -#' \item{`timeline.cex.axis:`}{size of labels; default = 2} +#' of `background_ylim` +#' \item `timeline.labels`: text used for labels; default = +#' `format(labels, "\%Y-\%m-\%d")`, where labels are values of proc_obj$bin_timestamp +#' \item `timeline.col`: color of line; default = "grey70" +#' \item `timeline.lwd`: width of line; default = 20 times the aspect +#' ratio of the plot device +#' \item `timeline.cex.axis`: size of labels; default = 2 #' } #' #' ***To customize time slider (symbol that slides):*** Add prefix #' `timeline.` to any argument that can be passed to [points][graphics::points]. #' The following values will create the default plot: #' \itemize{ -#' \item{`timeslider.bg:`}{ a single value with symbol bg color; default = -#' "grey40"} -#' \item{`timeslider.cex:`}{ a single value with symbol size; default = 2} -#' \item{`timeslider.col:`}{ a single value with symbol type; default = -#' "grey20"} -#' \item{`timeslider.pch:`}{ a single value with symbol type; default = 21} +#' \item `timeslider.bg`: a single value with symbol bg color; default = +#' "grey40" +#' \item `timeslider.cex`: a single value with symbol size; default = 2 +#' \item `timeslider.col`: a single value with symbol type; default = +#' "grey20" +#' \item `timeslider.pch`: a single value with symbol type; default = 21 #' } #' #' ***To customize parameters controlled by `par`:*** Add prefix @@ -119,11 +120,11 @@ #' `par.mar` controls whitespace behind default timeslider. The following values #' will create the default plot: #' \itemize{ -#' \item{`par.oma`}{ plot outer margins; default = c(0,0,0,0)} -#' \item{`par.mar`}{ plot inner margins; default = c(6,0,0,0)} +#' \item `par.oma`: plot outer margins; default = c(0,0,0,0) +#' \item `par.mar`: plot inner margins; default = c(6,0,0,0) #' } #' -#' @details If `animate = TRUE` then the animation output file name (`ani_name` +#' If `animate = TRUE` then the animation output file name (`ani_name` #' argument) will be passed to the `output` argument in [make_video()]. Default #' values for all other [make_video()] arguments will be used. Note that the #' default frame rate is 24 frames per second (`framerate` argument in @@ -215,6 +216,11 @@ make_frames <- function(proc_obj, recs = NULL, out_dir = getwd(), bg_map = NULL, show_progress = TRUE, ...) { # NOTE: As of glatos v 0.4.1, the package no longer uses the external program ffmpeg. Input argument 'ffmpeg' has been removed" + # Declare global variables for NSE & R CMD check + row_in <- recover_date_time <- grp <- bin_timestamp <- t_end <- grp_num <- + f_name <- animal_id <- record_type <- latitude <- longitude <- + deploy_date_time <- great_lakes_polygon <- NULL + # expand path to animation output file # - place in same file as images (out_dir) if none specified # - preserve "./" prefix if specified @@ -392,8 +398,10 @@ make_frames <- function(proc_obj, recs = NULL, out_dir = getwd(), data.table::setkey(work_proc_obj, bin_timestamp, animal_id, record_type) # Load background (use example Great Lakes if null) - if (is.null(bg_map)) { - background <- great_lakes_polygon # example in glatos package + if (is.null(bg_map)) { # example in glatos package + utils::data("great_lakes_polygon", envir = environment()) + background <- great_lakes_polygon + rm(great_lakes_polygon) } else { background <- bg_map diff --git a/R/vis-make_transition.r b/R/vis-make_transition.r index 48689d88..32fab3db 100644 --- a/R/vis-make_transition.r +++ b/R/vis-make_transition.r @@ -51,9 +51,10 @@ #' #' @return A list with two elements: #' \itemize{ -#' \item{`transition:`}{ a geo-corrected transition raster layer where land = 0 -#' and water=1 (see `gdistance`)} -#' \item{`rast:`}{ rasterized input layer of class `raster`}} +#' \item `transition`: a geo-corrected transition raster layer where land = 0 +#' and water=1 (see `gdistance`) +#' \item `rast`: rasterized input layer of class `raster` +#' } #' Additionally, rasterized version of input shapefile (*.tif extension) is #' written to computer at `output_dir` #' diff --git a/R/vis-make_transition3.r b/R/vis-make_transition3.r index 14f8cef7..9de7f041 100644 --- a/R/vis-make_transition3.r +++ b/R/vis-make_transition3.r @@ -26,7 +26,7 @@ #' layer. Both objects have the same extents and geographic #' projection as input shapefile. #' -#' @details If receiver\_points is provided, any receiver not in water +#' @details If receiver_points is provided, any receiver not in water #' is buffered by the distance from the receiver to the nearest #' water. This allows all receivers to be coded as in water if the #' receiver is on land. diff --git a/R/vis-position_heat_map.r b/R/vis-position_heat_map.r index 9b00992b..4f882a6e 100644 --- a/R/vis-position_heat_map.r +++ b/R/vis-position_heat_map.r @@ -5,10 +5,14 @@ #' VPS positional telemetry data. #' #' @param positions A dataframe containing detection data with at least the -#' following 4 columns: \describe{ \item{`DETECTEDID`}{Individual animal -#' identifier; character.} \item{`DATETIME`}{Date-time stamps for the -#' positions (MUST be of class 'POSIXct')} \item{`LAT`}{Position -#' latitude.} \item{`LON`}{Position longitude.} } +#' following 4 columns: +#' \describe{ +#' \item{`DETECTEDID`}{Individual animal identifier; character.} +#' \item{`DATETIME`}{Date-time stamps for the positions (MUST be of +#' class 'POSIXct')} +#' \item{`LAT`}{Position latitude.} +#' \item{`LON`}{Position longitude.} +#' } #' #' @param projection A character string indicating if the coordinates in the #' 'positions' dataframe are geographic (`projection = "LL"`) or @@ -87,13 +91,13 @@ #' the 4 intervals, than the number of intervals for that fish and grid #' combination is 3. Intervals are determined by applying the #' [findInterval][base::findInterval] function (base R) to a sequence of timestamps -#' (class: POSIXct) created using seq(from = min(positions[, DATETIME]), to = -#' min(positions[, DATETIME]), by = interval), where interval is the -#' user-assigned interval duration in seconds. Number of intervals is a more -#' robust surrogate than number of positions for relative time spent in each -#' grid in cases where spatial or temporal variability in positioning -#' probability are likely to significantly bias the distribution of positions -#' in the array. +#' (class: POSIXct) created using +#' `seq(from = min(positions[, DATETIME]), to = min(positions[, DATETIME]), by = interval)`, +#' where interval is the user-assigned interval duration in seconds. Number of +#' intervals is a more robust surrogate than number of positions for relative +#' time spent in each grid in cases where spatial or temporal variability in +#' positioning probability are likely to significantly bias the distribution of +#' positions in the array. #' @details Calculated values (i.e., fish, positions, intervals) can be returned #' as absolute or relative, which is specified using the abs_or_rel argument; @@ -397,7 +401,7 @@ position_heat_map <- function(positions, png( - file = file.path(png_file), + filename = file.path(png_file), bg = "transparent", height = 2000, width = 2000 * (ncol(results) / nrow(results)), diff --git a/man/check_vdat.Rd b/man/check_vdat.Rd index 3f7c6a4c..57b3c5c8 100644 --- a/man/check_vdat.Rd +++ b/man/check_vdat.Rd @@ -13,7 +13,7 @@ of the system.} } \value{ Character string with command for calling VDAT.exe via -\code{system2}'s \code{\link{command}} argument. +\code{system2}'s \code{command} argument. } \description{ Check path to Innovasea program VDAT.exe diff --git a/man/check_vue.Rd b/man/check_vue.Rd index dc254ceb..60c69077 100644 --- a/man/check_vue.Rd +++ b/man/check_vue.Rd @@ -13,7 +13,7 @@ of the system.} } \value{ Character string with command for calling VUE.exe via -\code{system2}'s \code{\link{command}} argument. +\code{system2}'s \code{command} argument. } \description{ Check path to Innovasea program VUE.exe diff --git a/man/crw.Rd b/man/crw.Rd index c5c822a2..46289434 100644 --- a/man/crw.Rd +++ b/man/crw.Rd @@ -14,12 +14,12 @@ crw( } \arguments{ \item{theta}{A 2-element numeric vector with turn angle parameters -(theta\link{1} = mean; theta\link{2} = sd) from normal distribution.} +(\code{theta[1]} = mean; \code{theta[2]} = sd) from normal distribution.} \item{stepLen}{A numeric scalar with total distance moved in each step.} -\item{initPos}{A 2-element numeric vector with nital position (initPos\link{1}=x, -initPos\link{2}=y).} +\item{initPos}{A 2-element numeric vector with nital position (\code{initPos[1]}=x, +\code{initPos[2]}=y).} \item{initHeading}{A numeric scalar with initial heading in degrees.} diff --git a/man/crw_in_polygon.Rd b/man/crw_in_polygon.Rd index fca0b6ec..518efc26 100644 --- a/man/crw_in_polygon.Rd +++ b/man/crw_in_polygon.Rd @@ -24,14 +24,14 @@ features (but \code{SpatialPolygonsDataFrame} and \code{SpatialPolygons} are also accepted); \cr \emph{OR} \cr A polygon defined as data frame or matrix with numeric columns x and y.} -\item{theta}{A 2-element numeric vector with turn angle parameters (theta\link{1} -= mean; theta\link{2} = sd), in degrees, from normal distribution.} +\item{theta}{A 2-element numeric vector with turn angle parameters (\code{theta[1]} += mean; \code{theta[2]} = sd), in degrees, from normal distribution.} \item{stepLen}{A numeric scalar with total distance moved in each step, in meters.} \item{initPos}{A 2-element numeric vector with initial position -(initPos\link{1}=x, initPos\link{2}=y) in same coordinate reference system as +(\code{initPos[1]}=x, \code{initPos[2]}=y) in same coordinate reference system as \code{polyg}.} \item{initHeading}{A numeric scalar with initial heading in degrees. E.g., 0 diff --git a/man/detection_bubble_plot.Rd b/man/detection_bubble_plot.Rd index 0f7737af..95447e65 100644 --- a/man/detection_bubble_plot.Rd +++ b/man/detection_bubble_plot.Rd @@ -2,7 +2,8 @@ % Please edit documentation in R/vis-detection_bubble_plot.r \name{detection_bubble_plot} \alias{detection_bubble_plot} -\title{Plot number of tagged animals or detections on a map} +\title{Make bubble plots showing the number of fish detected across a defined set +of receiver locations.} \usage{ detection_bubble_plot( det, diff --git a/man/flynn_island_transition.Rd b/man/flynn_island_transition.Rd index a159ee1d..18313a9e 100644 --- a/man/flynn_island_transition.Rd +++ b/man/flynn_island_transition.Rd @@ -7,9 +7,6 @@ A list comprised of a TransitionLayer and RasterLayer (see \code{\link[=make_transition]{make_transition()}}). } -\usage{ -system.file("testdata", "flynn_island_transition.rds", package = "glatos") -} \description{ A transition object, created from \code{\link[=flynn_island_polygon]{flynn_island_polygon()}} for testing \code{\link[=make_transition]{make_transition()}}. @@ -18,6 +15,10 @@ A transition object, created from flynn_island_transition.rds } +\examples{ +system.file("testdata", "flynn_island_transition.rds", package = "glatos") + +} \author{ Chris Holbrook } diff --git a/man/glatos.Rd b/man/glatos.Rd index 9401faf3..d8c2379a 100644 --- a/man/glatos.Rd +++ b/man/glatos.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/package-glatos.r \docType{package} \name{glatos} -\alias{-package} +\alias{glatos-package} \alias{glatos} \title{An R package for the Great Lakes Acoustic Telemetry Observation System} \description{ @@ -44,14 +44,14 @@ and operating schedule.} \item{\link{real_sensor_values}}{ Converts 'raw' transmitter sensor (e.g., depth, temperature) to 'real'-scale values (e.g., depth in meters) using -transmitter specification data (e.g., from read\_vemco\_tag\_specs).} } +transmitter specification data (e.g., from \link{read_vemco_tag_specs}).} } } \section{Filtering and summarizing}{ \describe{ \item{\link{min_lag}}{ Facilitates identification and removal of false positive detections by -calculating the minimum time interval (min\_lag) between successive +calculating the minimum time interval (min_lag) between successive detections.} \item{\link{false_detections}}{ Removes potential false positive detections @@ -130,3 +130,29 @@ Toolbox(https://github.com/vinayudyawer/ATT) and the VTrack package.} } } +\seealso{ +Useful links: +\itemize{ + \item \url{https://github.com/ocean-tracking-network/glatos} + \item Report bugs at \url{https://github.com/ocean-tracking-network/glatos/issues} +} + +} +\author{ +\strong{Maintainer}: Christopher Holbrook \email{cholbrook@usgs.gov} + +Authors: +\itemize{ + \item Todd Hayden + \item Thomas Binder + \item Jon Pye +} + +Other contributors: +\itemize{ + \item Alex Nunes [contributor] + \item Angela Dini [contributor] + \item Ryan Gosse [contributor] +} + +} diff --git a/man/higgins_lake_transition.Rd b/man/higgins_lake_transition.Rd index 75ac1d1f..f0383651 100644 --- a/man/higgins_lake_transition.Rd +++ b/man/higgins_lake_transition.Rd @@ -7,9 +7,6 @@ A list comprised of a TransitionLayer and RasterLayer (see \code{\link[=make_transition]{make_transition()}}). } -\usage{ -system.file("testdata", "higgins_lake_transition.rds", package = "glatos") -} \description{ A transition object, created from \code{\link[=higgins_lake_polygon]{higgins_lake_polygon()}} for testing \code{\link[=make_transition]{make_transition()}}. @@ -18,6 +15,10 @@ A transition object, created from higgins_lake_transition.rds } +\examples{ +system.file("testdata", "higgins_lake_transition.rds", package = "glatos") + +} \author{ Chris Holbrook } diff --git a/man/interpolate_path.Rd b/man/interpolate_path.Rd index 71a0ae04..c681e7f6 100644 --- a/man/interpolate_path.Rd +++ b/man/interpolate_path.Rd @@ -84,7 +84,7 @@ be used for all points when \code{lnl_thresh} > 1 and linear interpolation will be used for all points when \code{lnl_thresh} = 0. -All linear interpolation is done by code{stats::approx} with +All linear interpolation is done by \link[stats:approxfun]{stats::approx} with argument \code{ties = "ordered"} controlling how tied \code{x} values are handled. See \code{\link[=approxfun]{approxfun()}}. } diff --git a/man/make_frames.Rd b/man/make_frames.Rd index 1bc8658c..4925e2ea 100644 --- a/man/make_frames.Rd +++ b/man/make_frames.Rd @@ -95,17 +95,17 @@ a video animation (mp4 file). that can be passed to \link[graphics:points]{points}. The following values will create the default plot: \itemize{ -\item{\verb{cex:}}{ symbol size; default = 2} -\item{\verb{col:}}{ symbol color; default = "blue"} -\item{\verb{pch:}}{ symbol type; default = 16} +\item \code{cex}: symbol size; default = 2 +\item \code{col}: symbol color; default = "blue" +\item \code{pch}: symbol type; default = 16 } \emph{\strong{To customize receiver location points (from \code{recs}):}} Add prefix \code{recs.} to any argument that can be passed to \link[graphics:points]{points}. The following values will create the default plot: \itemize{ -\item{\verb{recs.cex:}}{ symbol size; default = 1.5} -\item{\verb{recs.pch:}}{ symbol type; default = 16} +\item \code{recs.cex}: symbol size; default = 1.5 +\item \code{recs.pch}: symbol type; default = 16 } \emph{\strong{To customize timeline:}} Add add prefix \code{timeline.} to any @@ -113,31 +113,31 @@ argument of \link[graphics:axis]{axis}. Note all elements of the timeline excep the sliding symbol (see 'slider' below) are created by a call to \code{axis}. The following values will create the default plot: \itemize{ -\item{\verb{timeline.at:}}{ a sequence with locations of labels (with first +\item \code{timeline.at}: a sequence with locations of labels (with first and last being start and end) along x-axis; in units of longitude; by default this will center the timeline with five equally-spaced labels in the middle -80\% of background_xlim.} -\item{\verb{timeline.pos:}}{ location along the y-axis; in units of latitude; +80\% of background_xlim. +\item \code{timeline.pos}: location along the y-axis; in units of latitude; by default this will place the timeline up from the bottom 6\% of the range -of \code{background_ylim}} -\item{\verb{timeline.labels:}}{ text used for labels; default = -\code{format(labels, "\\\%Y-\\\%m-\\\%d")}, where labels are values of proc_obj$bin_timestamp} -\item{\verb{timeline.col:}}{ color of line; default = "grey70"} -\item{\verb{timeline.lwd:}}{ width of line; default = 20 times the aspect -ratio of the plot device} -\item{\verb{timeline.cex.axis:}}{size of labels; default = 2} +of \code{background_ylim} +\item \code{timeline.labels}: text used for labels; default = +\code{format(labels, "\\\%Y-\\\%m-\\\%d")}, where labels are values of proc_obj$bin_timestamp +\item \code{timeline.col}: color of line; default = "grey70" +\item \code{timeline.lwd}: width of line; default = 20 times the aspect +ratio of the plot device +\item \code{timeline.cex.axis}: size of labels; default = 2 } \emph{\strong{To customize time slider (symbol that slides):}} Add prefix \code{timeline.} to any argument that can be passed to \link[graphics:points]{points}. The following values will create the default plot: \itemize{ -\item{\verb{timeslider.bg:}}{ a single value with symbol bg color; default = -"grey40"} -\item{\verb{timeslider.cex:}}{ a single value with symbol size; default = 2} -\item{\verb{timeslider.col:}}{ a single value with symbol type; default = -"grey20"} -\item{\verb{timeslider.pch:}}{ a single value with symbol type; default = 21} +\item \code{timeslider.bg}: a single value with symbol bg color; default = +"grey40" +\item \code{timeslider.cex}: a single value with symbol size; default = 2 +\item \code{timeslider.col}: a single value with symbol type; default = +"grey20" +\item \code{timeslider.pch}: a single value with symbol type; default = 21 } \emph{\strong{To customize parameters controlled by \code{par}:}} Add prefix @@ -145,8 +145,8 @@ The following values will create the default plot: \code{par.mar} controls whitespace behind default timeslider. The following values will create the default plot: \itemize{ -\item{\code{par.oma}}{ plot outer margins; default = c(0,0,0,0)} -\item{\code{par.mar}}{ plot inner margins; default = c(6,0,0,0)} +\item \code{par.oma}: plot outer margins; default = c(0,0,0,0) +\item \code{par.mar}: plot inner margins; default = c(6,0,0,0) } If \code{animate = TRUE} then the animation output file name (\code{ani_name} diff --git a/man/make_transition.Rd b/man/make_transition.Rd index c366dffc..f3f596ff 100644 --- a/man/make_transition.Rd +++ b/man/make_transition.Rd @@ -41,9 +41,10 @@ pixel must be at least 50\% covered by polygon to be coded as water.} \value{ A list with two elements: \itemize{ -\item{\verb{transition:}}{ a geo-corrected transition raster layer where land = 0 -and water=1 (see \code{gdistance})} -\item{\verb{rast:}}{ rasterized input layer of class \code{raster}}} +\item \code{transition}: a geo-corrected transition raster layer where land = 0 +and water=1 (see \code{gdistance}) +\item \code{rast}: rasterized input layer of class \code{raster} +} Additionally, rasterized version of input shapefile (*.tif extension) is written to computer at \code{output_dir} } diff --git a/man/make_transition3.Rd b/man/make_transition3.Rd index 24d8dfbd..100a0501 100644 --- a/man/make_transition3.Rd +++ b/man/make_transition3.Rd @@ -45,7 +45,7 @@ two-object list containing the raster layer and transition layer. Both objects have the same extents and geographic projection as input shapefile. -@details If receiver\_points is provided, any receiver not in water +@details If receiver_points is provided, any receiver not in water is buffered by the distance from the receiver to the nearest water. This allows all receivers to be coded as in water if the receiver is on land. diff --git a/man/otn_aat_animals.Rd b/man/otn_aat_animals.Rd index abc242cd..de0cddd7 100644 --- a/man/otn_aat_animals.Rd +++ b/man/otn_aat_animals.Rd @@ -9,9 +9,6 @@ CSV \source{ Ryan Gosse, Ocean Tracking Network } -\usage{ -system.file("extdata", "otn_aat_animals.csv", package = "glatos") -} \description{ An example animal data file from the OTN ERDDAP } @@ -19,3 +16,7 @@ An example animal data file from the OTN ERDDAP otn_aat_animals.csv } +\examples{ +system.file("extdata", "otn_aat_animals.csv", package = "glatos") + +} diff --git a/man/otn_aat_receivers.Rd b/man/otn_aat_receivers.Rd index 80a642bd..0d5ef9c4 100644 --- a/man/otn_aat_receivers.Rd +++ b/man/otn_aat_receivers.Rd @@ -9,9 +9,6 @@ CSV \source{ Ryan Gosse, Ocean Tracking Network } -\usage{ -system.file("extdata", "otn_aat_receivers.csv", package = "glatos") -} \description{ An example receiver station data file from the OTN ERDDAP } @@ -19,3 +16,7 @@ An example receiver station data file from the OTN ERDDAP otn_aat_receivers.csv } +\examples{ +system.file("extdata", "otn_aat_receivers.csv", package = "glatos") + +} diff --git a/man/otn_aat_tag_releases.Rd b/man/otn_aat_tag_releases.Rd index b6dbefb7..538f0c65 100644 --- a/man/otn_aat_tag_releases.Rd +++ b/man/otn_aat_tag_releases.Rd @@ -9,9 +9,6 @@ CSV \source{ Ryan Gosse, Ocean Tracking Network } -\usage{ -system.file("extdata", "otn_aat_tag_releases.csv", package = "glatos") -} \description{ An example tag release data file from the OTN ERDDAP } @@ -19,3 +16,7 @@ An example tag release data file from the OTN ERDDAP otn_aat_tag_releases.csv } +\examples{ +system.file("extdata", "otn_aat_tag_releases.csv", package = "glatos") + +} diff --git a/man/position_heat_map.Rd b/man/position_heat_map.Rd index d8536844..c5b476ac 100644 --- a/man/position_heat_map.Rd +++ b/man/position_heat_map.Rd @@ -24,10 +24,14 @@ position_heat_map( } \arguments{ \item{positions}{A dataframe containing detection data with at least the -following 4 columns: \describe{ \item{\code{DETECTEDID}}{Individual animal -identifier; character.} \item{\code{DATETIME}}{Date-time stamps for the -positions (MUST be of class 'POSIXct')} \item{\code{LAT}}{Position -latitude.} \item{\code{LON}}{Position longitude.} }} +following 4 columns: +\describe{ +\item{\code{DETECTEDID}}{Individual animal identifier; character.} +\item{\code{DATETIME}}{Date-time stamps for the positions (MUST be of +class 'POSIXct')} +\item{\code{LAT}}{Position latitude.} +\item{\code{LON}}{Position longitude.} +}} \item{projection}{A character string indicating if the coordinates in the 'positions' dataframe are geographic (\code{projection = "LL"}) or @@ -126,13 +130,13 @@ of raw number of positions. For example, in 4 hours there are a total of 4 the 4 intervals, than the number of intervals for that fish and grid combination is 3. Intervals are determined by applying the \link[base:findInterval]{findInterval} function (base R) to a sequence of timestamps -(class: POSIXct) created using seq(from = min(positions\link{, DATETIME}), to = -min(positions\link{, DATETIME}), by = interval), where interval is the -user-assigned interval duration in seconds. Number of intervals is a more -robust surrogate than number of positions for relative time spent in each -grid in cases where spatial or temporal variability in positioning -probability are likely to significantly bias the distribution of positions -in the array. +(class: POSIXct) created using +\code{seq(from = min(positions[, DATETIME]), to = min(positions[, DATETIME]), by = interval)}, +where interval is the user-assigned interval duration in seconds. Number of +intervals is a more robust surrogate than number of positions for relative +time spent in each grid in cases where spatial or temporal variability in +positioning probability are likely to significantly bias the distribution of +positions in the array. Calculated values (i.e., fish, positions, intervals) can be returned as absolute or relative, which is specified using the abs_or_rel argument; diff --git a/man/raw_lamprey_workbook.Rd b/man/raw_lamprey_workbook.Rd index 2dd8fb47..408ab09a 100644 --- a/man/raw_lamprey_workbook.Rd +++ b/man/raw_lamprey_workbook.Rd @@ -18,9 +18,6 @@ worksheets: \source{ \url{http://glatos.glos.us/home/project/SMRSL} } -\usage{ -system.file("extdata", "SMRSL_GLATOS_20140828.xlsm", package="glatos") -} \description{ A completed GLATOS workbook from St. Marys River Sea Lamprey project. @@ -29,6 +26,10 @@ project. SMRSL_GLATOS_20140828.xlsm } +\examples{ +system.file("extdata", "SMRSL_GLATOS_20140828.xlsm", package = "glatos") + +} \author{ Chris Holbrook } diff --git a/man/raw_walleye_detections.Rd b/man/raw_walleye_detections.Rd index f9f312ba..66997f30 100644 --- a/man/raw_walleye_detections.Rd +++ b/man/raw_walleye_detections.Rd @@ -9,9 +9,6 @@ A zipped walleye detection file in detection file format 1.3: \source{ \url{http://glatos.glos.us/home/project/HECWL} } -\usage{ -system.file("extdata", "walleye_detections.zip", package="glatos") -} \description{ An example detection file } @@ -19,6 +16,10 @@ An example detection file walleye_detections.zip } +\examples{ +system.file("extdata", "walleye_detections.zip", package = "glatos") + +} \author{ Todd Hayden } diff --git a/man/shoreline.Rd b/man/shoreline.Rd index 3c6234cf..1507dc5c 100644 --- a/man/shoreline.Rd +++ b/man/shoreline.Rd @@ -9,9 +9,6 @@ shapefile \source{ \url{http://glatos.glos.us/home} } -\usage{ -system.file("extdata", "shoreline.zip", package="glatos") -} \description{ Polygon coastline of Great Lakes in WGS84 projection. Includes outlines of Tittabawassee River (Lake @@ -21,6 +18,10 @@ Huron), Maumee River (Lake Erie), and Sandusky River (Lake Erie) shoreline.zip } +\examples{ +system.file("extdata", "shoreline.zip", package = "glatos") + +} \author{ Todd Hayden } diff --git a/man/video-images.Rd b/man/video-images.Rd index ca13d922..88a11e43 100644 --- a/man/video-images.Rd +++ b/man/video-images.Rd @@ -1,7 +1,7 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/extdata.r -\name{video images} -\alias{video images} +\name{video-images} +\alias{video-images} \title{Video frames of walleye movements in Lake Huron} \format{ Folder contains 30 sequentially labeled .png image files @@ -9,9 +9,6 @@ Folder contains 30 sequentially labeled .png image files \source{ \url{http://glatos.glos.us/home/project/HECWL} } -\usage{ -system.file("extdata", "frames", package="glatos") -} \description{ Sequential images of walleye movements in Lake Huron for testing functionality of ffmpeg function. @@ -20,6 +17,10 @@ for testing functionality of ffmpeg function. frames } +\examples{ +system.file("extdata", "frames", package = "glatos") + +} \author{ Todd Hayden } diff --git a/tests/testthat/_snaps/kml_to_csv.md b/tests/testthat/_snaps/kml_to_csv.md new file mode 100644 index 00000000..b40d1c80 --- /dev/null +++ b/tests/testthat/_snaps/kml_to_csv.md @@ -0,0 +1,20 @@ +# creates csv + + Code + read.csv(file.path(temp_dir, "example_polygons.csv")) + Output + name feature_type seq longitude latitude altitude + 1 example_polygon1 POLYGON 1 -109.33785 45.53534 0 + 2 example_polygon1 POLYGON 2 -106.95169 41.46721 0 + 3 example_polygon1 POLYGON 3 -100.89851 44.45468 0 + 4 example_polygon1 POLYGON 4 -109.33785 45.53534 0 + 5 example_polygon2 POLYGON 1 -100.06183 37.08399 0 + 6 example_polygon2 POLYGON 2 -99.84344 35.26575 0 + 7 example_polygon2 POLYGON 3 -98.61712 35.40292 0 + 8 example_polygon2 POLYGON 4 -96.75744 37.63186 0 + 9 example_polygon2 POLYGON 5 -96.44857 39.81675 0 + 10 example_polygon2 POLYGON 6 -98.79507 41.59274 0 + 11 example_polygon2 POLYGON 7 -102.16848 39.89768 0 + 12 example_polygon2 POLYGON 8 -103.08779 36.17908 0 + 13 example_polygon2 POLYGON 9 -100.06183 37.08399 0 + diff --git a/tests/testthat/test-convert_otn_erddap_to_att.r b/tests/testthat/test-convert_otn_erddap_to_att.r index 5656c6bd..279ae456 100644 --- a/tests/testthat/test-convert_otn_erddap_to_att.r +++ b/tests/testthat/test-convert_otn_erddap_to_att.r @@ -62,7 +62,7 @@ test_that("matches internal data: blue_shark_erddap_att", { ) # Check if expected and actual results are the same - expect_identical(bs_att, blue_shark_erddap_att) + expect_equal(bs_att, blue_shark_erddap_att) }) diff --git a/tests/testthat/test-kml_to_csv.R b/tests/testthat/test-kml_to_csv.R new file mode 100644 index 00000000..8ade7d9a --- /dev/null +++ b/tests/testthat/test-kml_to_csv.R @@ -0,0 +1,35 @@ +test_that("errors with kmz", { + expect_error( + kml_to_csv("some_kmz_file.kmz"), + "kmz are not supported" + ) +}) + +test_that("creates csv", { + temp_dir <- file.path(tempdir(), "test-kml_to_csv") + dir.create(temp_dir) + result_of_copy <- file.copy( + system.file("extdata", "example_polygons.kml", package = "glatos"), + temp_dir + ) + + + out_loc <- kml_to_csv(file.path(temp_dir, "example_polygons.kml")) + + expect_equal( + out_loc, + file.path(temp_dir, "example_polygons.csv") + ) + + expect_true( + file.exists(file.path(temp_dir, "example_polygons.csv")) + ) + + expect_snapshot( + read.csv( + file.path(temp_dir, "example_polygons.csv") + ) + ) + + unlink(temp_dir, recursive = T) +})