R/verb-slice.R
changed.
Other files ignored by Codecov
tests/testthat/_snaps/verb-slice.md
has changed.
tests/testthat/test-verb-slice.R
has changed.
99 | 99 | slice_sample.tbl_lazy <- function(.data, ..., n, prop, weight_by = NULL, replace = FALSE) { |
|
100 | 100 | size <- check_slice_size(n, prop) |
|
101 | 101 | weight_by <- enquo(weight_by) |
|
102 | + | if (size$type == "prop") { |
|
103 | + | abort("Sampling by `prop` is not supported on database backends") |
|
104 | + | } |
|
105 | + | ||
102 | 106 | if (!quo_is_null(weight_by)) { |
|
103 | 107 | abort("Weighted resampling is not supported on database backends") |
|
104 | 108 | } |
144 | 148 | abort("`n` must be a non-missing positive number.") |
|
145 | 149 | } |
|
146 | 150 | ||
147 | - | list(type = "n", n = n) |
|
151 | + | list(type = "n", n = as.integer(n)) |
|
148 | 152 | } else if (!missing(prop) && missing(n)) { |
|
149 | 153 | if (!is.numeric(prop) || length(prop) != 1) { |
|
150 | 154 | abort("`prop` must be a single number") |
Files | Coverage |
---|---|
R | 86.88% |
Project Totals (72 files) | 86.88% |