Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit

Permalink
Fix missing ggplot2 namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
nfrerebeau committed Nov 25, 2019
1 parent 70962f8 commit 8765578
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 12 deletions.
14 changes: 14 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,25 @@ exportMethods(test_fit)
exportMethods(turnover)
importFrom(ca,ca)
importFrom(ggplot2,aes)
importFrom(ggplot2,coord_fixed)
importFrom(ggplot2,element_blank)
importFrom(ggplot2,element_rect)
importFrom(ggplot2,element_text)
importFrom(ggplot2,facet_wrap)
importFrom(ggplot2,geom_line)
importFrom(ggplot2,geom_path)
importFrom(ggplot2,geom_point)
importFrom(ggplot2,geom_tile)
importFrom(ggplot2,ggplot)
importFrom(ggplot2,labs)
importFrom(ggplot2,scale_size_area)
importFrom(ggplot2,scale_x_continuous)
importFrom(ggplot2,scale_x_discrete)
importFrom(ggplot2,scale_x_log10)
importFrom(ggplot2,scale_y_continuous)
importFrom(ggplot2,scale_y_discrete)
importFrom(ggplot2,scale_y_log10)
importFrom(ggplot2,theme)
importFrom(methods,as)
importFrom(methods,callNextMethod)
importFrom(methods,new)
Expand Down
2 changes: 1 addition & 1 deletion R/index-diversity.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ simulate_diversity <- function(x, method, prob = NULL,
}
loop_args <- list(X = sample_sizes, FUN = sim,
n = n, prob = prob, level = level, method = method, ...)
loop_fun <- if (requireNamespace("pbapply", quietly = TRUE)) {
loop_fun <- if (interactive() && requireNamespace("pbapply", quietly = TRUE)) {
pbapply::pblapply
} else {
lapply
Expand Down
1 change: 1 addition & 0 deletions R/index-richness.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ setMethod(
.RichnessIndex(
id = object[["id"]],
index = index,
size = rowSums(object),
method = method
)
}
Expand Down
20 changes: 12 additions & 8 deletions R/plot-diversity.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,21 @@ setMethod(
type = ifelse(sim_stacked[["ind"]] == "mean", "mean", "conf. int.")
)
sim <- stats::na.omit(sim)
gg_sim <- geom_path(mapping = aes(x = .data$size, y = .data$values,
colour = .data$type, group = .data$ind),
data = sim, inherit.aes = FALSE)
gg_sim <- ggplot2::geom_path(
mapping = ggplot2::aes(x = .data$size, y = .data$values,
colour = .data$type, group = .data$ind),
data = sim, inherit.aes = FALSE
)
}

# ggplot
ggplot(data = count,
mapping = aes(x = .data$x, y = .data$y, label = .data$label)) +
geom_point() +
ggplot2::ggplot(data = count,
mapping = ggplot2::aes(x = .data$x, y = .data$y,
label = .data$label)) +
ggplot2::geom_point() +
gg_sim +
scale_x_log10() +
labs(x = "Sample size", y = object[["method"]], colour = "Simulation")
ggplot2::scale_x_log10() +
ggplot2::labs(x = "Sample size", y = object[["method"]],
colour = "Simulation")
}
)
6 changes: 3 additions & 3 deletions R/refine.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ boot_hull <- function(x, margin = 1, n = 1000, axes = c(1, 2), ...) {
return(as.data.frame(hull))
}

loop_fun <- if (requireNamespace("pbapply", quietly = TRUE)) {
loop_fun <- if (interactive() && requireNamespace("pbapply", quietly = TRUE)) {
pbapply::pbapply
} else {
apply
Expand Down Expand Up @@ -210,7 +210,7 @@ boot_date <- function(x, model, margin = 1, n = 1000, keep = ncol(x),
return(distrib)
}

loop_fun <- if (requireNamespace("pbapply", quietly = TRUE)) {
loop_fun <- if (interactive() && requireNamespace("pbapply", quietly = TRUE)) {
pbapply::pbapply
} else {
apply
Expand Down Expand Up @@ -292,7 +292,7 @@ jack_date <- function(x, model, keep = ncol(x), level = 0.95, ...) {
return(stats::coef(fit))
}

loop_fun <- if (requireNamespace("pbapply", quietly = TRUE)) {
loop_fun <- if (interactive() && requireNamespace("pbapply", quietly = TRUE)) {
pbapply::pblapply
} else {
lapply
Expand Down

0 comments on commit 8765578

Please sign in to comment.