Skip to content

Commit

Permalink
fix all returns
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
dramanica committed Nov 29, 2022
1 parent 0359763 commit 47ce90e
Show file tree
Hide file tree
Showing 20 changed files with 115 additions and 10 deletions.
2 changes: 1 addition & 1 deletion R/check_var_in_nc.R
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion R/get_vars_for_dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions R/is_region_series.R
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions R/location_series.R
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion R/location_slice.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 <-
Expand Down Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions R/region_slice.R
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions R/sample_region_series.R
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
56 changes: 52 additions & 4 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,63 @@
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) <doi:...>
authors (year) <arXiv:...>
authors (year, ISBN:...)
or if those are not available: <https:...>
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)
- R-hub ubuntu-gcc-release (r-release)
- 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:

Expand Down
14 changes: 14 additions & 0 deletions inst/rawdata_scripts/check_returns_in_documentation.R
Original file line number Diff line number Diff line change
@@ -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()
6 changes: 5 additions & 1 deletion inst/rawdata_scripts/readme.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 3 additions & 0 deletions man/check_available_variable.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/check_var_in_nc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/climate_for_locations.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions man/climate_for_time_slice.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/get_varname.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/is_region_series.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/location_slice.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions man/sample_rs_fixed.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions man/sample_rs_variable.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/time_series_for_locations.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 47ce90e

Please sign in to comment.