Skip to content

Commit 7e572f4

Browse files
committed
Uploading examples to include dontrun instead to avoid touching api at all
1 parent e412dfa commit 7e572f4

46 files changed

Lines changed: 71 additions & 198 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

R/01_classDefinitions.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ setClassUnion("id", c("character", "integer", "numeric"))
77
#' @name contacts_classes
88
#' @description An unordered list of individual S4 `contact` objects.
99
#' @export
10-
#' @examples
10+
#' @examples {
1111
#' new("contact", familyname = "Goring", givennames = "Simon J.")
12+
#' }
1213
#' @returns object of class `contact`
1314
#' @aliases contact-class
1415
#' @md

R/clean.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#' * After: \{site: 1, dataset: \[1, 2\]\}
1717
#' So the site is gathered, and the datasets are now part of an
1818
#' array of datasets.
19-
#' @examples \donttest{
19+
#' @examples \dontrun{
2020
#' tryCatch({
2121
#' alex <- get_sites(sitename = "Alex%")
2222
#' alex2 <- get_sites(24)

R/filter.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
#' @param .by (only used for filtering `data.frame` objects)
5050
#' @param .preserve (only used for filtering `data.frame` objects)
5151
#' @returns filtered `sites` object
52-
#' @examples \donttest{
52+
#' @examples \dontrun{
5353
#' # Download 10 sites, but only keep the sites that are close to sea level.
5454
#' tryCatch({
5555
#' some_sites <- get_sites(sitename = "Lake%", limit = 3)

R/get_datasets.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
#' record.
6161
#' * `all_data` The API only downloads the first 25 records of the query.
6262
#' For the complete records, use `all_data=TRUE`
63-
#' @examples \donttest{
63+
#' @examples \dontrun{
6464
#' tryCatch({
6565
#' random_sites <- get_sites(1)
6666
#' allds <- get_datasets(random_sites, limit=3)

R/get_documentation.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#' @importFrom utils browseURL
55
#' @importFrom rlang is_interactive
66
#' @returns NULL
7-
#' @examples \donttest{
7+
#' @examples \dontrun{
88
#' if (interactive()) {
99
#' get_documentation()
1010
#' }

R/get_downloads.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
#' \item{ \code{pi list} }{P.I. info}
4949
#' \item{ \code{analyst} }{analyst info}
5050
#' \item{ \code{metadata} }{dataset metadata}
51-
#' @examples \donttest{
51+
#' @examples \dontrun{
5252
#' # To find the downloads object of dataset 24:
5353
#' tryCatch({
5454
#' downloads24 <- get_downloads(24)

R/get_manual.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#' @description Open up the Neotoma manual homepage.
44
#' @importFrom utils browseURL
55
#' @importFrom rlang is_interactive
6-
#' @examples {
6+
#' @examples \dontrun{
77
#' # This call does not work from `source()` calls or in testing.
88
#' # interactive() just lets us know you are interacting with the console:
99
#' if (interactive()) {

R/get_publications.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#' `year` The year the publication was released.
1818
#' `search` A plain text search string used to search the citation.
1919
#' @returns `publications` object
20-
#' @examples \donttest{
20+
#' @examples \dontrun{
2121
#' # How old are the papers in Neotoma that include the term "mammut"?
2222
#' tryCatch({
2323
#' mammoth_papers <- get_publications(search="mammut") %>%

R/get_sites.R

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -62,42 +62,19 @@
6262
#' * `loc` An `sf` object that describes site's location.
6363
#' * `description`
6464
#' * `collunits` limited information on collunits
65-
#' @examples
66-
#' \donttest{
65+
#' @examples \dontrun{
6766
#' ## Find sites with a min altitude of 12m and a max altitude of 25m
68-
#' tryCatch({
69-
#' sites_12to25 <- get_sites(altmin=12, altmax=25)
70-
#' }, error = function(e) {
71-
#' message("Neotoma server not responding. Try again later.")
72-
#' })
73-
#' ## Return all sites, using a minimum altitude of 2500m (returns >500 sites):
74-
#' tryCatch({
75-
#' sites_2500 <- get_sites(altmin=2500, all_data = TRUE)
76-
#' }, error = function(e) {
77-
#' message("Neotoma server not responding. Try again later.")
78-
#' })
79-
#' ## To find sites in Brazil
67+
#' sites_12to25 <- get_sites(altmin=12, altmax=25)
68+
#' sites_2500 <- get_sites(altmin=2500, all_data = TRUE)
69+
#' ## To find sites in Brazil
8070
#' brazil <- '{"type": "Polygon",
8171
#' "coordinates": [[
8272
#' [-73.125, -9.102096738726443],
8373
#' [-56.953125,-33.137551192346145],
8474
#' [-36.5625,-7.710991655433217],
8575
#' [-68.203125,13.923403897723347],
8676
#' [-73.125,-9.102096738726443]]]}'
87-
#' tryCatch({
8877
#' brazil_sites <- get_sites(loc = brazil[1])
89-
#' # Finding all sites with Liliaceae pollen in 1000 year bins:
90-
#' lilysites <- c()
91-
#' for (i in seq(0, 10000, by = 1000)) {
92-
#' lily <- get_sites(taxa=c("Liliaceae"),
93-
#' ageyoung = i - 500,
94-
#' ageold = i + 500,
95-
#' all_data = TRUE)
96-
#' lilysites <- c(lilysites, length(lily))
97-
#' }
98-
#' }, error = function(e) {
99-
#' message("Neotoma server not responding. Try again later.")
100-
#' })
10178
#' }
10279
#' @md
10380
#' @export

R/get_speleothems.R

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,9 @@ speleo_helper <- function(sites) {
5858
#' * `x` The unique dataset ID (integer) in Neotoma. Can be passed as a
5959
#' vector of dataset IDs.
6060
#' * `sites` A `sites` R object.
61-
#' @examples {
61+
#' @examples \dontrun{
6262
#' ## Find speleothems by numeric datasetid:
63-
#' tryCatch({
64-
#' speleo <- get_speleothems(c(2,5))
65-
#' }, error = function(e) {
66-
#' message("Neotoma server not responding. Try again later.")
67-
#' })
63+
#' speleo <- get_speleothems(c(2,5))
6864
#' }
6965
#' @md
7066
#' @export

0 commit comments

Comments
 (0)