Skip to content

Commit

Permalink
R CMD check fixes [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
seananderson committed Oct 18, 2023
1 parent 10105ce commit c840721
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 22 deletions.
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ Suggests:
ggforce,
glmmTMB,
ggplot2,
inlabru,
knitr,
rmarkdown,
sf,
Expand Down
38 changes: 19 additions & 19 deletions R/mesh.R
Original file line number Diff line number Diff line change
Expand Up @@ -234,27 +234,27 @@ binary_search_knots <- function(loc_xy,
#' @rdname make_mesh
#' @export
plot.sdmTMBmesh <- function(x, ...) {
r1 <- requireNamespace("inlabru", quietly = TRUE)
r2 <- requireNamespace("ggplot2", quietly = TRUE)
if (r1 && r2) {
dat <- data.frame(
x = x$loc_xy[,1,drop=TRUE],
y = x$loc_xy[,2,drop=TRUE]
)
ggplot2::ggplot() +
inlabru::gg(x$mesh, ext.color = "grey20", ext.linewidth = 0.5, edge.color = "grey50") +
# ggplot2::coord_sf() +
# fmesher::geom_fm(data = x$mesh) +
ggplot2::geom_point(
data = dat,
mapping = ggplot2::aes(x = .data$x, y = .data$y), alpha = 0.4, pch = 20, colour = "#3182BD") +
ggplot2::coord_fixed() +
ggplot2::labs(x = x$xy_cols[[1]], y = x$xy_cols[[2]])
} else {
# r1 <- requireNamespace("inlabru", quietly = TRUE)
# r2 <- requireNamespace("ggplot2", quietly = TRUE)
# if (r1 && r2) {
# dat <- data.frame(
# x = x$loc_xy[,1,drop=TRUE],
# y = x$loc_xy[,2,drop=TRUE]
# )
# ggplot2::ggplot() +
# # inlabru::gg(x$mesh, ext.color = "grey20", ext.linewidth = 0.5, edge.color = "grey50") +
# ggplot2::coord_sf() +
# fmesher::geom_fm(data = x$mesh) +
# ggplot2::geom_point(
# data = dat,
# mapping = ggplot2::aes(x = .data$x, y = .data$y), alpha = 0.4, pch = 20, colour = "#3182BD") +
# # ggplot2::coord_fixed() +
# ggplot2::labs(x = x$xy_cols[[1]], y = x$xy_cols[[2]])
# } else {
plot(x$mesh, main = NA, edge.color = "grey60", asp = 1, ...)
points(x$loc_xy, pch = ".", col = "#00000070")
points(x$loc_xy, pch = 21, cex = 0.3, col = "#00000080")
points(x$loc_centers, pch = 20, col = "red")
}
# }
}

# from TMB examples repository:
Expand Down
2 changes: 1 addition & 1 deletion R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#' spatiotemporal range (distance at which correlation is effectively
#' independent) in any direction from zero. Uses \pkg{ggplot2}. If anisotropy
#' was turned off when fitting the model, `NULL` is returned instead of a
#' {ggplot2} object.
#' \pkg{ggplot2} object.
#'
#' `plot_anisotropy2()`: A plot of eigenvectors illustrating the estimated
#' anisotropy. A list of the plotted data is invisibly returned. Uses base
Expand Down
2 changes: 2 additions & 0 deletions R/priors.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ mvnormal <- function(location = 0, scale = diag(length(location))) {
#' pc_matern(range_gt = 5, sigma_lt = 1)
#' plot_pc_matern(range_gt = 5, sigma_lt = 1)
#'
#' \donttest{
#' d <- subset(pcod, year > 2011)
#' pcod_spde <- make_mesh(d, c("X", "Y"), cutoff = 30)
#'
Expand Down Expand Up @@ -194,6 +195,7 @@ mvnormal <- function(location = 0, scale = diag(length(location))) {
#' matern_s = pc_matern(range_gt = 5, sigma_lt = 1),
#' matern_st = pc_matern(range_gt = 5, sigma_lt = 1))
#' )
#' }
pc_matern <- function(range_gt, sigma_lt, range_prob = 0.05, sigma_prob = 0.05) {
assert_that(range_prob > 0 && range_prob < 1)
assert_that(sigma_prob > 0 && sigma_prob < 1)
Expand Down
2 changes: 2 additions & 0 deletions R/stacking.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#'
#'
#' @examples
#' \donttest{
#' # Set parallel processing if desired. See 'Details' in ?sdmTMB_cv
#'
#' # Depth as quadratic:
Expand Down Expand Up @@ -59,6 +60,7 @@
#' models <- list(m_cv_1, m_cv_2, m_cv_3)
#' weights <- sdmTMB_stacking(models)
#' weights
#' }
sdmTMB_stacking <- function(model_list, include_folds = NULL) {
n_models <- length(model_list)
if (is.null(include_folds)) {
Expand Down
2 changes: 1 addition & 1 deletion man/plot_anisotropy.Rd

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

2 changes: 2 additions & 0 deletions man/priors.Rd

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

2 changes: 2 additions & 0 deletions man/sdmTMB_stacking.Rd

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

0 comments on commit c840721

Please sign in to comment.