diff --git a/R/check_var_in_nc.R b/R/check_var_in_nc.R index 51aa32c2..908482fb 100644 --- a/R/check_var_in_nc.R +++ b/R/check_var_in_nc.R @@ -5,7 +5,7 @@ #' @param bio_variables vector of names of variables to be extracted #' @param path_to_nc the path to the custom nc file containing the palaeoclimate #' reconstructions. -#' @returns TRUE fi the variable exists +#' @returns TRUE if the variable exists #' #' @keywords internal diff --git a/R/get_vars_for_dataset.R b/R/get_vars_for_dataset.R index 1f76a3ff..c2a84a8e 100644 --- a/R/get_vars_for_dataset.R +++ b/R/get_vars_for_dataset.R @@ -53,7 +53,7 @@ get_vars_for_dataset <- function(dataset, path_to_nc = NULL, details=FALSE) { #' #' @param variable a vector of names of the variables of interest #' @param dataset dataset of interest -#' +#' @returns TRUE if var is available #' @keywords internal check_available_variable <- function(variable, dataset) { @@ -76,6 +76,7 @@ check_available_variable <- function(variable, dataset) { #' #' @param variable string defining the variable name #' @param dataset string defining dataset to be downloaded +#' @returns the name of the variable #' get_varname <- function(variable, dataset) { diff --git a/R/is_region_series.R b/R/is_region_series.R index ef6c7a51..aab4ad81 100644 --- a/R/is_region_series.R +++ b/R/is_region_series.R @@ -13,6 +13,7 @@ #' regional reconstructions obtained from \code{region_series}. #' @param strict a boolean defining whether to preform a thorough test (see #' description above for details). +#' @returns TRUE if the object is a region series #' #' @export diff --git a/R/location_series.R b/R/location_series.R index d4dc2048..a20fc540 100644 --- a/R/location_series.R +++ b/R/location_series.R @@ -111,6 +111,7 @@ location_series <- #' Deprecated version of \code{location_series} #' #' @param ... arguments to be passed to \code{series} +#' @returns a data.frame with teh climatic variables of interest #' #' @export diff --git a/R/location_slice.R b/R/location_slice.R index 8c4460ba..3b97d38a 100644 --- a/R/location_slice.R +++ b/R/location_slice.R @@ -22,7 +22,7 @@ #' information (i.e. they are under water or ice). Interpolation is only #' performed from the first ring of nearest neighbours; if climate is not #' available, NA will be returned for that location. Defaults to TRUE. -#' @returns a data.frame with teh climatic variables of interest +#' @returns a data.frame with the climatic variables of interest. #' @export location_slice <- @@ -152,6 +152,7 @@ location_slice <- #' Deprecated version of \code{location_slice} #' #' @param ... arguments to be passed to \code{location_slice} +#' @returns a data.frame with teh climatic variables of interest #' #' @export diff --git a/R/region_slice.R b/R/region_slice.R index 8119716a..a2865aea 100644 --- a/R/region_slice.R +++ b/R/region_slice.R @@ -54,6 +54,9 @@ region_slice <- #' Deprecated version of \code{region_slice} #' #' @param ... arguments to be passed to \code{region_slice} +#' @returns a +#' SpatRaster \code{terra::SpatRaster} object, with +#' each variable as a layer. #' #' @export diff --git a/R/sample_region_series.R b/R/sample_region_series.R index 3f18a3d8..51e879a5 100644 --- a/R/sample_region_series.R +++ b/R/sample_region_series.R @@ -52,6 +52,8 @@ sample_region_series<-function(x, size, method="random", replace=FALSE, na.rm=TR #' defaults to "random" #' @param replace boolean determining whether we sample with replacement #' @param na.rm boolean determining whether NAs are removed +#' @returns a data.frame with the sampled cells and their respective values for +#' the climate variables. #' #' @keywords internal @@ -103,6 +105,8 @@ sample_rs_fixed<-function(x, size, method="random", replace=FALSE, na.rm=TRUE) #' defaults to "random" #' @param replace boolean determining whether we sample with replacement #' @param na.rm boolean determining whether NAs are removed +#' @returns a data.frame with the sampled cells and their respective values for +#' the climate variables. #' #' @keywords internal diff --git a/cran-comments.md b/cran-comments.md index 0b96bbca..a9cd6d04 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,8 +1,52 @@ -This is a new package not present on CRAN yet. +This is a resubmission + +# Feedback on previous submission (with details of fixes) + +Please do not start the description with "This package", package name, +title or similar. + +> Description changed as requested. + +If there are references describing the methods in your package, please +add these in the description field of your DESCRIPTION file in the form +authors (year) +authors (year) +authors (year, ISBN:...) +or if those are not available: +with no space after 'doi:', 'arXiv:', 'https:' and angle brackets for +auto-linking. (If you want to add a title as well please put it in +quotes: "Title") + +> Reference added as suggested. + +Please add \value to .Rd files regarding exported methods and explain +the functions results in the documentation. Please write about the +structure of the output (class) and also what the output means. (If a +function does not return a value, please document that too, e.g. +\value{No return value, called for side effects} or similar) +Missing Rd-tags in up to 26 .Rd files, e.g.: + check_dataset_path.Rd: \value + climate_for_locations.Rd: \value + climate_for_time_slice.Rd: \value + df_from_region_series.Rd: \value + df_from_region_slice.Rd: \value + download_dataset.Rd: \value + ... + +> My apologies, I relied on devtools::check() to test the documentation, +I see now that it fails to check returns. All functions now should have a +return value. + +Please ensure that your functions do not write by default or in your +examples/vignettes/tests in the user's home filespace (including the +package directory and getwd()). This is not allowed by CRAN policies. +Please omit any default path in writing functions. In your +examples/vignettes/tests you can write to tempdir(). -> +R/set_data_path.R and corresponding tests + +> Functions changed to ensure that no files are written to the user's home +filespace (sorry, I had misread the note about R_user_dir on CRAN). -On all testing environment (see below), we only get a note because of the -package being a new submission (expected), and a false positive for mispelling -(palaeoclimate is an existing word and IS spelled correctly). ## Test environments - R-hub windows-x86_64-devel (r-devel) @@ -10,6 +54,10 @@ package being a new submission (expected), and a false positive for mispelling - R-hub fedora-clang-devel (r-devel) - devtools::check_mac_release +On all testing environment (see below), I only get a note because of the +package being a new submission (expected), and a false positive for mispelling +(palaeoclimate is an existing word and IS spelled correctly). + ## R CMD check results On all systems: diff --git a/inst/rawdata_scripts/check_returns_in_documentation.R b/inst/rawdata_scripts/check_returns_in_documentation.R new file mode 100644 index 00000000..18fa8930 --- /dev/null +++ b/inst/rawdata_scripts/check_returns_in_documentation.R @@ -0,0 +1,14 @@ +# with wd set to the root of the package, source this script +# it will return a list of the map pages missing returns +# note that map pages for datasets don't need returns. + +check_returns_in_documentation <-function(){ + # note the additiona \ to run through system 2 + files_with_value <- basename(system2(command = "grep", + args='-Ril "\\\\value" ./man/', + stdout=TRUE) + ) + all_files<-dir ("./man") + return(all_files[!all_files %in% files_with_value]) +} +check_returns_in_documentation() diff --git a/inst/rawdata_scripts/readme.md b/inst/rawdata_scripts/readme.md index 691cd74e..d02f4bad 100644 --- a/inst/rawdata_scripts/readme.md +++ b/inst/rawdata_scripts/readme.md @@ -1,4 +1,8 @@ -This files provides an overivew of the scripts used to generate the data used in pastclim. All R scripts assume that you are in the root directory of the package: +This files provides an overivew of the scripts used to generate the data used in pastclim. All R scripts assume that you are in the root directory of the package. + +NOTE: these scripts were used with terra <1.6-41, which changed the way time +is coded. Make sure that you check the scripts before running, as they might not +function as expected. ## scripts to package the climate data diff --git a/man/check_available_variable.Rd b/man/check_available_variable.Rd index be956c9c..7ada379e 100644 --- a/man/check_available_variable.Rd +++ b/man/check_available_variable.Rd @@ -11,6 +11,9 @@ check_available_variable(variable, dataset) \item{dataset}{dataset of interest} } +\value{ +TRUE if var is available +} \description{ Internal getter function } diff --git a/man/check_var_in_nc.Rd b/man/check_var_in_nc.Rd index bcb64989..da509b72 100644 --- a/man/check_var_in_nc.Rd +++ b/man/check_var_in_nc.Rd @@ -13,7 +13,7 @@ check_var_in_nc(bio_variables, path_to_nc) reconstructions.} } \value{ -TRUE fi the variable exists +TRUE if the variable exists } \description{ Internal function to test a custom nc file. diff --git a/man/climate_for_locations.Rd b/man/climate_for_locations.Rd index 2fe3b355..7fba68f6 100644 --- a/man/climate_for_locations.Rd +++ b/man/climate_for_locations.Rd @@ -9,6 +9,9 @@ climate_for_locations(...) \arguments{ \item{...}{arguments to be passed to \code{location_slice}} } +\value{ +a data.frame with teh climatic variables of interest +} \description{ Deprecated version of \code{location_slice} } diff --git a/man/climate_for_time_slice.Rd b/man/climate_for_time_slice.Rd index 701b8315..0938e0c0 100644 --- a/man/climate_for_time_slice.Rd +++ b/man/climate_for_time_slice.Rd @@ -9,6 +9,11 @@ climate_for_time_slice(...) \arguments{ \item{...}{arguments to be passed to \code{region_slice}} } +\value{ +a +SpatRaster \code{terra::SpatRaster} object, with +each variable as a layer. +} \description{ Deprecated version of \code{region_slice} } diff --git a/man/get_varname.Rd b/man/get_varname.Rd index 1b92f8c9..998279dd 100644 --- a/man/get_varname.Rd +++ b/man/get_varname.Rd @@ -11,6 +11,9 @@ get_varname(variable, dataset) \item{dataset}{string defining dataset to be downloaded} } +\value{ +the name of the variable +} \description{ Internal function to get the varname for this variable } diff --git a/man/is_region_series.Rd b/man/is_region_series.Rd index 0e97f4b1..0192b1c2 100644 --- a/man/is_region_series.Rd +++ b/man/is_region_series.Rd @@ -13,6 +13,9 @@ regional reconstructions obtained from \code{region_series}.} \item{strict}{a boolean defining whether to preform a thorough test (see description above for details).} } +\value{ +TRUE if the object is a region series +} \description{ A region series is a \code{terra::SpatRasterDataset} for which each subdataset is a variable, and all variables have the same number of diff --git a/man/location_slice.Rd b/man/location_slice.Rd index 7d4f543a..cb57797e 100644 --- a/man/location_slice.Rd +++ b/man/location_slice.Rd @@ -39,7 +39,7 @@ performed from the first ring of nearest neighbours; if climate is not available, NA will be returned for that location. Defaults to TRUE.} } \value{ -a data.frame with teh climatic variables of interest +a data.frame with the climatic variables of interest. } \description{ This function extract local climate for a set of locations diff --git a/man/sample_rs_fixed.Rd b/man/sample_rs_fixed.Rd index b34782ab..24cfa190 100644 --- a/man/sample_rs_fixed.Rd +++ b/man/sample_rs_fixed.Rd @@ -20,6 +20,10 @@ defaults to "random"} \item{na.rm}{boolean determining whether NAs are removed} } +\value{ +a data.frame with the sampled cells and their respective values for +the climate variables. +} \description{ Internal function for fixed sampling from \code{sample_region_series}, used when a single size is given. diff --git a/man/sample_rs_variable.Rd b/man/sample_rs_variable.Rd index e95eed39..b4a014a1 100644 --- a/man/sample_rs_variable.Rd +++ b/man/sample_rs_variable.Rd @@ -19,6 +19,10 @@ defaults to "random"} \item{na.rm}{boolean determining whether NAs are removed} } +\value{ +a data.frame with the sampled cells and their respective values for +the climate variables. +} \description{ Internal function for sampling different number of points for each timestep of a region series from \code{sample_region_series}, diff --git a/man/time_series_for_locations.Rd b/man/time_series_for_locations.Rd index 96e60414..720b21e0 100644 --- a/man/time_series_for_locations.Rd +++ b/man/time_series_for_locations.Rd @@ -9,6 +9,9 @@ time_series_for_locations(...) \arguments{ \item{...}{arguments to be passed to \code{series}} } +\value{ +a data.frame with teh climatic variables of interest +} \description{ Deprecated version of \code{location_series} }