Skip to content

Commit 4f05313

Browse files
klin333kai-lin-cci
andauthored
Stats imports (#5514)
* add stats:: in front of functions not explicitly imported (#5186) * add utils:: in front of functions not explicitly imported (#5186) * explicitly import utils::head and utils::tail (#5186) --------- Co-authored-by: Kai Lin <[email protected]>
1 parent 567006c commit 4f05313

File tree

7 files changed

+12
-9
lines changed

7 files changed

+12
-9
lines changed

NAMESPACE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,3 +703,5 @@ importFrom(lifecycle,deprecated)
703703
importFrom(stats,setNames)
704704
importFrom(tibble,tibble)
705705
importFrom(utils,.DollarNames)
706+
importFrom(utils,head)
707+
importFrom(utils,tail)

R/axis-secondary.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ AxisSecondary <- ggproto("AxisSecondary", NULL,
236236

237237
# Map the break values back to their correct position on the primary scale
238238
if (!is.null(range_info$major_source)) {
239-
old_val <- approx(full_range, old_range, range_info$major_source)$y
239+
old_val <- stats::approx(full_range, old_range, range_info$major_source)$y
240240
old_val_trans <- scale$trans$transform(old_val)
241241

242242
# rescale values from 0 to 1
@@ -252,7 +252,7 @@ AxisSecondary <- ggproto("AxisSecondary", NULL,
252252
}
253253

254254
if (!is.null(range_info$minor_source)) {
255-
old_val_minor <- approx(full_range, old_range, range_info$minor_source)$y
255+
old_val_minor <- stats::approx(full_range, old_range, range_info$minor_source)$y
256256
old_val_minor_trans <- scale$trans$transform(old_val_minor)
257257

258258
range_info$minor[] <- round(

R/backports.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Backport fix from R 3.3:
22
# https://github.com/wch/r-source/commit/4efc81c98d262f93de9e7911aaa910f5c63cd00f
33
if (getRversion() < "3.3") {
4-
absolute.units <- getFromNamespace("absolute.units", "grid")
5-
absolute.units.unit <- getFromNamespace("absolute.units.unit", "grid")
6-
absolute.units.unit.list <- getFromNamespace("absolute.units.unit.list", "grid")
7-
absolute.units.unit.arithmetic <- getFromNamespace("absolute.units.unit.arithmetic", "grid")
4+
absolute.units <- utils::getFromNamespace("absolute.units", "grid")
5+
absolute.units.unit <- utils::getFromNamespace("absolute.units.unit", "grid")
6+
absolute.units.unit.list <- utils::getFromNamespace("absolute.units.unit.list", "grid")
7+
absolute.units.unit.arithmetic <- utils::getFromNamespace("absolute.units.unit.arithmetic", "grid")
88

99
backport_unit_methods <- function() {
1010
registerS3method("absolute.units", "unit", absolute.units.unit)

R/ggplot2-package.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
#' @importFrom glue glue glue_collapse
77
#' @importFrom lifecycle deprecated
88
#' @importFrom stats setNames
9+
#' @importFrom utils head tail
910
## usethis namespace: end
1011
NULL

R/stat-align.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ StatAlign <- ggproto("StatAlign", Stat,
8585
d
8686
})
8787
}
88-
y_val <- approxfun(data$x, data$y)(unique_loc)
88+
y_val <- stats::approxfun(data$x, data$y)(unique_loc)
8989
keep <- !is.na(y_val)
9090
x_val <- unique_loc[keep]
9191
y_val <- y_val[keep]

R/stat-ecdf.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ StatEcdf <- ggproto("StatEcdf", Stat,
100100
if (pad) {
101101
x <- c(-Inf, x, Inf)
102102
}
103-
data_ecdf <- ecdf(data$x)(x)
103+
data_ecdf <- stats::ecdf(data$x)(x)
104104

105105
df_ecdf <- data_frame0(
106106
x = x,

R/stat-qq-line.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ StatQqLine <- ggproto("StatQqLine", Stat,
7676
}
7777

7878
x_coords <- inject(distribution(p = line.p, !!!dparams))
79-
y_coords <- quantile(sample, line.p)
79+
y_coords <- stats::quantile(sample, line.p)
8080
slope <- diff(y_coords) / diff(x_coords)
8181
intercept <- y_coords[1L] - slope * x_coords[1L]
8282

0 commit comments

Comments
 (0)