Skip to content

Commit 430671a

Browse files
committed
Rework code
1 parent 6c8567b commit 430671a

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

R/verb-uncount.R

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,13 @@ dbplyr_uncount <- function(data, weights, .remove = TRUE, .id = NULL) {
4040
weights_col <- quo_name(weights_quo)
4141
} else {
4242
weights_col <- "..dbplyr_weight_col"
43-
data <- mutate(
44-
data,
45-
!!weights_col := !!weights_quo,
46-
)
43+
data <- mutate(data, !!weights_col := !!weights_quo)
4744
}
4845

49-
n_max <- pull(summarise(
50-
ungroup(data),
51-
max = max(!!sym(weights_col), na.rm = TRUE)
52-
))
46+
n_max <- data |>
47+
ungroup() |>
48+
summarise(max = max(!!sym(weights_col), na.rm = TRUE)) |>
49+
pull()
5350
n_max <- vctrs::vec_cast(n_max, integer(), x_arg = "weights")
5451

5552
if (is_null(.id)) {

0 commit comments

Comments
 (0)