Skip to content

Commit 9e4d797

Browse files
Add NoSuggests check (#23)
* Add NoSuggests check * Don't evaluate vignette without Suggests * Don't load ggplot2 before checking it exists * Skip if no modeldata * Wrap examples to check for modeldata * Change if -> examplesIf
1 parent 6cbe612 commit 9e4d797

10 files changed

+79
-8
lines changed

.Rbuildignore

+2
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@
99
^pkgdown$
1010
^cran-comments\.md$
1111
^CRAN-RELEASE$
12+
^doc$
13+
^Meta$
+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
#
4+
# NOTE: This workflow only directly installs "hard" dependencies, i.e. Depends,
5+
# Imports, and LinkingTo dependencies. Notably, Suggests dependencies are never
6+
# installed, with the exception of testthat, knitr, and rmarkdown. The cache is
7+
# never used to avoid accidentally restoring a cache containing a suggested
8+
# dependency.
9+
on:
10+
push:
11+
branches: [main]
12+
pull_request:
13+
branches: [main]
14+
15+
name: R-CMD-check-hard
16+
17+
jobs:
18+
R-CMD-check:
19+
runs-on: ${{ matrix.config.os }}
20+
21+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
22+
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
config:
27+
- {os: ubuntu-18.04, r: 'release'}
28+
29+
env:
30+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
31+
R_KEEP_PKG_SOURCE: yes
32+
33+
steps:
34+
- uses: actions/checkout@v2
35+
36+
- uses: r-lib/actions/setup-pandoc@v2
37+
38+
- uses: r-lib/actions/setup-r@v2
39+
with:
40+
r-version: ${{ matrix.config.r }}
41+
http-user-agent: ${{ matrix.config.http-user-agent }}
42+
use-public-rspm: true
43+
44+
- uses: r-lib/actions/setup-r-dependencies@v2
45+
with:
46+
dependencies: '"hard"'
47+
cache: false
48+
extra-packages: |
49+
any::rcmdcheck
50+
any::testthat
51+
any::knitr
52+
any::rmarkdown
53+
needs: check
54+
55+
- uses: r-lib/actions/check-r-package@v2
56+
with:
57+
upload-snapshots: true

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
inst/doc
66
docs
77
pkgdown
8+
/doc/
9+
/Meta/

R/block_cv.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#' and `data.frame`. The results include a column for the data split objects
3434
#' and an identification variable `id`.
3535
#'
36-
#' @examples
36+
#' @examplesIf rlang::is_installed("modeldata")
3737
#' data(Smithsonian, package = "modeldata")
3838
#' smithsonian_sf <- sf::st_as_sf(Smithsonian,
3939
#' coords = c("longitude", "latitude"),

R/spatial_clustering_cv.R

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#' International Geoscience and Remote Sensing Symposium, Munich, 2012,
3838
#' pp. 5372-5375, doi: 10.1109/IGARSS.2012.6352393.
3939
#'
40-
#' @examples
40+
#' @examplesIf rlang::is_installed("modeldata")
4141
#' data(Smithsonian, package = "modeldata")
4242
#' spatial_clustering_cv(Smithsonian, coords = c(latitude, longitude), v = 5)
4343
#'
@@ -48,8 +48,10 @@
4848
#'
4949
#' # When providing sf objects, coords are inferred automatically
5050
#' spatial_clustering_cv(smithsonian_sf, v = 5)
51+
#'
5152
#' # Can use hclust instead:
5253
#' spatial_clustering_cv(smithsonian_sf, v = 5, cluster_function = "hclust")
54+
#'
5355
#' @rdname spatial_clustering_cv
5456
#' @export
5557
spatial_clustering_cv <- function(data, coords, v = 10, cluster_function = c("kmeans", "hclust"), ...) {

man/spatial_block_cv.Rd

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/spatial_clustering_cv.Rd

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-spatial_block_cv.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
library(testthat)
22
library(rsample)
33
library(purrr)
4-
library(modeldata)
4+
skip_if_not_installed("modeldata")
55

66
data(ames, package = "modeldata")
77
ames_sf <- sf::st_as_sf(ames, coords = c("Longitude", "Latitude"), crs = 4326)

tests/testthat/test-spatial_clustering_cv.R

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
library(testthat)
22
library(rsample)
33
library(purrr)
4-
library(modeldata)
5-
6-
data("Smithsonian")
4+
skip_if_not_installed("modeldata")
75

6+
data("Smithsonian", package = "modeldata")
87

98
test_that("using kmeans", {
109
set.seed(11)

vignettes/spatialsample.Rmd

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,17 @@ vignette: >
1010
```{r, include = FALSE}
1111
knitr::opts_chunk$set(
1212
collapse = TRUE,
13-
comment = "#>"
13+
comment = "#>",
14+
eval = requireNamespace("ggplot2", quietly = TRUE) && requireNamespace("modeldata", quietly = TRUE)
1415
)
16+
```
17+
18+
```{r, include = FALSE}
1519
library(ggplot2)
1620
theme_set(theme_minimal())
1721
```
1822

23+
1924
The resampled objects created by spatialsample can be used in many of the same ways that those created by [rsample](https://rsample.tidymodels.org/) can, from making comparisons to evaluating models. These objects can be used together with other parts of the [tidymodels](https://www.tidymodels.org/) framework, but let's walk through a more basic example using linear modeling of housing data from Ames, IA.
2025

2126
```{r}

0 commit comments

Comments
 (0)