Skip to content

Commit 8d02957

Browse files
committed
remove library() call from try_require(). closes #3126.
1 parent 91b6a17 commit 8d02957

File tree

3 files changed

+2
-10
lines changed

3 files changed

+2
-10
lines changed

R/fortify-map.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ fortify.map <- function(model, data, ...) {
7575
#' coord_map("albers", at0 = 45.5, lat1 = 29.5)
7676
#' }
7777
map_data <- function(map, region = ".", exact = FALSE, ...) {
78-
try_require("maps", "map_data", attach = TRUE)
78+
try_require("maps", "map_data")
7979
map_obj <- maps::map(map, region, exact = exact, plot = FALSE, fill = TRUE, ...)
8080
fortify(map_obj)
8181
}

R/stat-quantile.r

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ StatQuantile <- ggproto("StatQuantile", Stat,
5454

5555
if (is.null(formula)) {
5656
if (method == "rqss") {
57-
# this should not be needed, since quantreg imports MatrixModels
58-
# try_require("MatrixModels", "stat_quantile")
59-
6057
# we need to attach quantreg for qss to work inside formula
6158
require("quantreg")
6259
formula <- eval(substitute(y ~ qss(x, lambda = lambda)),

R/utilities.r

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,8 @@ clist <- function(l) {
4747
# the name of the ggplot2 function that uses this package, and is
4848
# used only to produce a meaningful error message if the
4949
# package is not available.
50-
#
51-
# Set `attach = TRUE` if you want to attach the package, not
52-
# just make sure it is available. It is generally recommended to
53-
# not set `attach = TRUE`.
54-
try_require <- function(package, fun, attach = FALSE) {
50+
try_require <- function(package, fun) {
5551
if (requireNamespace(package, quietly = TRUE)) {
56-
if (isTRUE(attach)) library(package, character.only = TRUE)
5752
return(invisible())
5853
}
5954

0 commit comments

Comments
 (0)