diff --git a/DESCRIPTION b/DESCRIPTION index 0aad247..8e49c1f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -22,8 +22,6 @@ URL: https://docs.ropensci.org/paleobioDB/, BugReports: https://github.com/ropensci/paleobioDB/issues Imports: curl, - graphics, - grDevices, gtools, maps, rjson, diff --git a/R/pbdb_geographic_functions.R b/R/pbdb_geographic_functions.R index 497dc41..8dacecf 100644 --- a/R/pbdb_geographic_functions.R +++ b/R/pbdb_geographic_functions.R @@ -65,13 +65,13 @@ #' in the map. #' @param do_plot Logical. If `TRUE`, the function produces a plot in #' addition to returning a data frame with the occurrence counts. -#' @param ... Other parameters. See [par()] and [map()]. +#' @param ... Other parameters. See [par()] and [maps::map()]. #' @details The argument `show = "coords"` in the [pbdb_occurrences()] #' function is required. We recommend the use of a cairo device #' ([X11()]) for better visualization of the maps. See Examples. #' @returns A data frame with the number of occurrences per #' coordinate. -#' @seealso See [pbdb_occurrences()], [map()], [par()] and [colors()] +#' @seealso See [pbdb_occurrences()], [maps::map()], [par()] and [colors()] #' help pages. #' @export #' @examples \dontrun{ @@ -173,7 +173,7 @@ pbdb_map <- function(data, col_int = "white", pch = 19, col_ocean = "black", #' map. #' @param do_plot Logical. If `TRUE`, the function produces a plot in #' addition to returning a `SpatRaster`. -#' @param ... Other parameters. See [par()] and [map()] +#' @param ... Other parameters. See [par()] and [maps::map()] #' @details The argument `show = "coords"` in the [pbdb_occurrences()] #' function is required. We recommend the use of a cairo device #' ([X11()]) for better visualization of the maps. See Examples. @@ -182,7 +182,7 @@ pbdb_map <- function(data, col_int = "white", pch = 19, col_ocean = "black", #' resolution that was specified in the `res` argument. The default #' is `res = 5`. Users that wish to work with objects of this type #' should load package `terra`. -#' @seealso See [pbdb_occurrences()], [map()], [par()] and [colors()] +#' @seealso See [pbdb_occurrences()], [maps::map()], [par()] and [colors()] #' help pages #' @export #' @examples \dontrun{ @@ -314,7 +314,7 @@ pbdb_map_occur <- function(data, #' colour gradient showing the richness per cell in the map. #' @param title A title for the plot, to be positioned to the right of #' the legend. -#' @param ... Other parameters. See [par()] and [map()]. +#' @param ... Other parameters. See [par()] and [maps::map()]. #' @details The argument `show = c("coords", "classext")` in the #' [pbdb_occurrences()] function is required. We recommend the use #' of a cairo device ([X11()]) for better visualization of the @@ -324,7 +324,7 @@ pbdb_map_occur <- function(data, #' that was specified in the `res` argument. The default is `res = #' 5`. Users that wish to work with objects of this type should load #' package `terra`. -#' @seealso See [pbdb_occurrences()], [map()], [par()] and [colors()] +#' @seealso See [pbdb_occurrences()], [maps::map()], [par()] and [colors()] #' help pages. #' @export #' @examples \dontrun{ diff --git a/R/pbdb_queries.R b/R/pbdb_queries.R index 106e8dc..bbae788 100644 --- a/R/pbdb_queries.R +++ b/R/pbdb_queries.R @@ -525,6 +525,15 @@ pbdb_scale <- function(id, ...) { #' documentation for accepted parameters at #' . E.g.: #' +#' * `all_records`: Set to `TRUE` to list all intervals. +#' +#' * `id`: Return only time scales with the specified +#' identifier(s). It is possible to provide multiple identifiers as +#' a comma-separated list. +#' +#' * `name`: Return only time scales with the specified name(s). It is +#' possible to provide multiple names as a comma-separated list. +#' #' * `vocab`: Set to `"pbdb"` to show the complete name of the #' variables (by default variables have short 3-letter names). #' @@ -534,7 +543,7 @@ pbdb_scale <- function(id, ...) { #' @examples \dontrun{ #' ## Get a data frame with all the scales available in PBDB #' ## by setting no ids -#' pbdb_scales() +#' pbdb_scales(all_records = TRUE) #' } pbdb_scales <- function(...) { l <- list(...) diff --git a/man/pbdb_map.Rd b/man/pbdb_map.Rd index e213642..6fe4be8 100644 --- a/man/pbdb_map.Rd +++ b/man/pbdb_map.Rd @@ -34,7 +34,7 @@ in the map.} \item{do_plot}{Logical. If \code{TRUE}, the function produces a plot in addition to returning a data frame with the occurrence counts.} -\item{...}{Other parameters. See \code{\link[=par]{par()}} and \code{\link[=map]{map()}}.} +\item{...}{Other parameters. See \code{\link[=par]{par()}} and \code{\link[maps:map]{maps::map()}}.} } \value{ A data frame with the number of occurrences per @@ -68,6 +68,6 @@ function is required. We recommend the use of a cairo device } } \seealso{ -See \code{\link[=pbdb_occurrences]{pbdb_occurrences()}}, \code{\link[=map]{map()}}, \code{\link[=par]{par()}} and \code{\link[=colors]{colors()}} +See \code{\link[=pbdb_occurrences]{pbdb_occurrences()}}, \code{\link[maps:map]{maps::map()}}, \code{\link[=par]{par()}} and \code{\link[=colors]{colors()}} help pages. } diff --git a/man/pbdb_map_occur.Rd b/man/pbdb_map_occur.Rd index 5df7fea..f300a47 100644 --- a/man/pbdb_map_occur.Rd +++ b/man/pbdb_map_occur.Rd @@ -32,7 +32,7 @@ map.} \item{do_plot}{Logical. If \code{TRUE}, the function produces a plot in addition to returning a \code{SpatRaster}.} -\item{...}{Other parameters. See \code{\link[=par]{par()}} and \code{\link[=map]{map()}}} +\item{...}{Other parameters. See \code{\link[=par]{par()}} and \code{\link[maps:map]{maps::map()}}} } \value{ A \code{SpatRaster} object with the sampling effort (number of @@ -62,6 +62,6 @@ function is required. We recommend the use of a cairo device } } \seealso{ -See \code{\link[=pbdb_occurrences]{pbdb_occurrences()}}, \code{\link[=map]{map()}}, \code{\link[=par]{par()}} and \code{\link[=colors]{colors()}} +See \code{\link[=pbdb_occurrences]{pbdb_occurrences()}}, \code{\link[maps:map]{maps::map()}}, \code{\link[=par]{par()}} and \code{\link[=colors]{colors()}} help pages } diff --git a/man/pbdb_map_richness.Rd b/man/pbdb_map_richness.Rd index 4b16a36..73817d6 100644 --- a/man/pbdb_map_richness.Rd +++ b/man/pbdb_map_richness.Rd @@ -40,7 +40,7 @@ colour gradient showing the richness per cell in the map.} \item{title}{A title for the plot, to be positioned to the right of the legend.} -\item{...}{Other parameters. See \code{\link[=par]{par()}} and \code{\link[=map]{map()}}.} +\item{...}{Other parameters. See \code{\link[=par]{par()}} and \code{\link[maps:map]{maps::map()}}.} } \value{ A \code{SpatRaster} object with the richness of the specified @@ -72,6 +72,6 @@ graphs. See Examples. } } \seealso{ -See \code{\link[=pbdb_occurrences]{pbdb_occurrences()}}, \code{\link[=map]{map()}}, \code{\link[=par]{par()}} and \code{\link[=colors]{colors()}} +See \code{\link[=pbdb_occurrences]{pbdb_occurrences()}}, \code{\link[maps:map]{maps::map()}}, \code{\link[=par]{par()}} and \code{\link[=colors]{colors()}} help pages. } diff --git a/man/pbdb_scales.Rd b/man/pbdb_scales.Rd index 4f5d1fb..2d07a51 100644 --- a/man/pbdb_scales.Rd +++ b/man/pbdb_scales.Rd @@ -11,6 +11,12 @@ pbdb_scales(...) documentation for accepted parameters at \url{https://paleobiodb.org/data1.2/scales/list}. E.g.: \itemize{ +\item \code{all_records}: Set to \code{TRUE} to list all intervals. +\item \code{id}: Return only time scales with the specified +identifier(s). It is possible to provide multiple identifiers as +a comma-separated list. +\item \code{name}: Return only time scales with the specified name(s). It is +possible to provide multiple names as a comma-separated list. \item \code{vocab}: Set to \code{"pbdb"} to show the complete name of the variables (by default variables have short 3-letter names). }} @@ -25,6 +31,6 @@ Returns information about multiple time scales. \dontrun{ ## Get a data frame with all the scales available in PBDB ## by setting no ids - pbdb_scales() + pbdb_scales(all_records = TRUE) } } diff --git a/tests/testthat/test-queries_intervals_scales.R b/tests/testthat/test-queries_intervals_scales.R index 05adf02..6ab9c56 100644 --- a/tests/testthat/test-queries_intervals_scales.R +++ b/tests/testthat/test-queries_intervals_scales.R @@ -22,9 +22,10 @@ test_that("pbdb_scale() returns a data frame with an id column", { expect_equal(nrow(response), 1) }) -test_that("multivalue elements are converted to a string with semicolons", { +test_that("pbdb_scales() returns a data frame with an id column", { skip_if_offline("paleobiodb.org") - response <- pbdb_scales() - expect_true("lvs" %in% names(response)) - expect_true(all(grepl(";", response$lvs))) + response <- pbdb_scales(all_records = TRUE) + expect_s3_class(response, "data.frame") + expect_true("oid" %in% names(response)) + expect_gt(nrow(response), 1) })