From 8b9f5136cc3b5e86eba90718a80fa5ed5605b990 Mon Sep 17 00:00:00 2001 From: Damiano Oldoni Date: Tue, 16 Jan 2024 11:55:31 +0100 Subject: [PATCH] Capitalize comments --- R/read_camtrap_dp.R | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/R/read_camtrap_dp.R b/R/read_camtrap_dp.R index 001eafa5..eac8dafd 100644 --- a/R/read_camtrap_dp.R +++ b/R/read_camtrap_dp.R @@ -49,7 +49,7 @@ read_camtrap_dp <- function(file = NULL, media = TRUE, path = lifecycle::deprecated()) { - # check path (deprecated) + # Check path (deprecated) warning_detail <- paste( "Use argument `file` containing the path or URL to the `datapackage.json`", "file. The use of parameter `path` with path to the local directory is ", @@ -62,11 +62,11 @@ read_camtrap_dp <- function(file = NULL, details = warning_detail ) } - # define the right file value + # Define the right file value if (lifecycle::is_present(path)) { file <- file.path(path, "datapackage.json") } - # file value is a valid path + # File value is a valid path if (dir.exists(file)) { file <- file.path(file, "datapackage.json") } @@ -79,13 +79,9 @@ read_camtrap_dp <- function(file = NULL, # Read package (metadata) package <- frictionless::read_package(file) - # Supported versions - supported_versions <- c("0.1.6", "1.0") - - # Get package version + # Check Camtrap DP version is supported version <- get_version(profile = package$profile) - - # check version is supported + supported_versions <- c("0.1.6", "1.0") assertthat::assert_that( version %in% supported_versions, msg = glue::glue( @@ -94,9 +90,10 @@ read_camtrap_dp <- function(file = NULL, ) ) - # get resource names + # Get resource names resource_names <- frictionless::resources(package) - #check needed resources are present + + # Check needed resources are present resources_to_read <- c("deployments", "media", "observations") assertthat::assert_that( all(resources_to_read %in% resource_names), @@ -107,10 +104,10 @@ read_camtrap_dp <- function(file = NULL, ) ) - # read deployments + # Read deployments deployments <- frictionless::read_resource(package, "deployments") issues_deployments <- check_reading_issues(deployments, "deployments") - # read observations (needed to create sequenceID in media) + # Read observations (needed to create sequenceID in media) observations <- frictionless::read_resource(package, "observations") issues_observations <- check_reading_issues(observations, "observations") @@ -118,7 +115,7 @@ read_camtrap_dp <- function(file = NULL, observations <- add_speed_radius_angle(observations) } - # create first version datapackage with resources in data slot + # Create first version datapackage with resources in data slot data <- list( "deployments" = deployments, "media" = NULL, @@ -127,7 +124,7 @@ read_camtrap_dp <- function(file = NULL, package$data <- data - # read media if needed + # Read media if needed if (media) { media_df <- frictionless::read_resource(package, "media") issues_media <- check_reading_issues(media_df, "media") @@ -139,12 +136,12 @@ read_camtrap_dp <- function(file = NULL, package <- add_taxonomic_info(package) - # convert to 0.1.6 + # Convert to 0.1.6 if (version == "1.0") { package <- convert_to_0.1.6(package, version, media = media) } - # order columns + # Order columns package$data$deployments <- order_cols_deployments(package$data$deployments) package$data$observations <- order_cols_observations( package$data$observations