Skip to content

Commit 76c03a7

Browse files
committed
replace other instances of stats::ave() too
1 parent e502421 commit 76c03a7

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

R/facet-.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,14 +1415,14 @@ censor_labels <- function(ranges, layout, labels) {
14151415
)
14161416

14171417
if (!labels$x) {
1418-
xmax <- stats::ave(layout$ROW, layout$COL, FUN = max)
1419-
xmin <- stats::ave(layout$ROW, layout$COL, FUN = min)
1418+
xmax <- vec_ave(layout$ROW, layout$COL, max)
1419+
xmin <- vec_ave(layout$ROW, layout$COL, min)
14201420
draw[which(layout$ROW != xmax), "bottom"] <- FALSE
14211421
draw[which(layout$ROW != xmin), "top"] <- FALSE
14221422
}
14231423
if (!labels$y) {
1424-
ymax <- stats::ave(layout$COL, layout$ROW, FUN = max)
1425-
ymin <- stats::ave(layout$COL, layout$ROW, FUN = min)
1424+
ymax <- vec_ave(layout$COL, layout$ROW, max)
1425+
ymin <- vec_ave(layout$COL, layout$ROW, min)
14261426
draw[which(layout$COL != ymax), "right"] <- FALSE
14271427
draw[which(layout$COL != ymin), "left"] <- FALSE
14281428
}

R/geom-path.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ GeomPath <- ggproto("GeomPath", Geom,
1919
# middle since you expect those to be shown by a break in the line
2020
aesthetics <- c(self$required_aes, self$non_missing_aes)
2121
complete <- stats::complete.cases(data[names(data) %in% aesthetics])
22-
kept <- stats::ave(complete, data$group, FUN = keep_mid_true)
22+
kept <- vec_ave(complete, data$group, keep_mid_true)
2323
data <- data[kept, ]
2424

2525
if (!all(kept) && !params$na.rm) {
@@ -48,7 +48,7 @@ GeomPath <- ggproto("GeomPath", Geom,
4848
munched <- coord_munch(coord, data, panel_params)
4949

5050
# Silently drop lines with less than two points, preserving order
51-
rows <- stats::ave(seq_len(nrow(munched)), munched$group, FUN = length)
51+
rows <- vec_ave(seq_len(nrow(munched)), munched$group, length)
5252
munched <- munched[rows >= 2, ]
5353
if (nrow(munched) < 2) return(zeroGrob())
5454

R/stat-sum.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ StatSum <- ggproto(
1515

1616
counts <- count(data, group_by, wt_var = "weight")
1717
counts <- rename(counts, c(freq = "n"))
18-
counts$prop <- stats::ave(counts$n, counts$group, FUN = prop.table)
18+
counts$prop <- vec_ave(counts$n, counts$group, prop.table)
1919
counts
2020
}
2121
)

0 commit comments

Comments
 (0)