Skip to content

Commit 3a299c5

Browse files
committed
rename f args in epix_slide tests and examples
1 parent d2823b4 commit 3a299c5

File tree

5 files changed

+12
-19
lines changed

5 files changed

+12
-19
lines changed

R/methods-epi_archive.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ group_by.epi_archive = function(.data, ..., .add=FALSE, .drop=dplyr::group_by_dr
822822
#' archive_cases_dv_subset %>%
823823
#' group_by(geo_value) %>%
824824
#' epix_slide(
825-
#' function(x, g) {
825+
#' function(x, gk, rtv) {
826826
#' tibble(
827827
#' versions_end = max(x$versions_end),
828828
#' time_range = if(nrow(x$DT) == 0L) {

R/utils.R

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ check_sufficient_f_args <- function(f, n_mandatory_f_args = 2L) {
153153
#' place of `.y`, and `.ref_time_value` can be used in place of `.z`. This
154154
#' allows you to create very compact anonymous functions (lambdas) with up
155155
#' to two inputs. Functions created from formulas have a special class. Use
156-
#' `is_lambda()` to test for it.
156+
#' `rlang::is_lambda()` to test for it.
157157
#'
158158
#' If a **string**, the function is looked up in `env`. Note that
159159
#' this interface is strictly for user convenience because of the
@@ -175,10 +175,6 @@ check_sufficient_f_args <- function(f, n_mandatory_f_args = 2L) {
175175
#' h <- as_slide_computation(~ .x - .group_key)
176176
#' h(6, 3)
177177
#'
178-
#' # Functions created from a formula have a special class:
179-
#' is_lambda(f)
180-
#' is_lambda(as_slide_computation(function() "foo"))
181-
#'
182178
#' @importFrom rlang check_dots_empty0 is_function is_quosure eval_tidy call2
183179
#' quo_get_env new_function pairlist2 f_env is_environment missing_arg f_rhs
184180
#' is_string quo_get_expr is_formula caller_arg caller_env

man/as_slide_computation.Rd

Lines changed: 4 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/epix_slide.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-epix_slide.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ test_that("epix_slide with all_versions option has access to all older versions"
198198
# `waldo` package:
199199
testthat::local_edition(3)
200200

201-
slide_fn <- function(x, g, t) {
201+
slide_fn <- function(x, gk, rtv) {
202202
return(tibble(n_versions = length(unique(x$DT$version)),
203203
n_row = nrow(x$DT),
204204
dt_class1 = class(x$DT)[[1L]],
@@ -248,7 +248,7 @@ test_that("as_of and epix_slide with long enough window are compatible", {
248248

249249
# For all_versions = FALSE:
250250

251-
f1 = function(x, g, t) {
251+
f1 = function(x, gk, rtv) {
252252
tibble(
253253
diff_mean = mean(diff(x$binary))
254254
)
@@ -262,11 +262,11 @@ test_that("as_of and epix_slide with long enough window are compatible", {
262262

263263
# For all_versions = TRUE:
264264

265-
f2 = function(x, g, t) {
265+
f2 = function(x, gk, rtv) {
266266
x %>%
267267
# extract time&version-lag-1 data:
268268
epix_slide(
269-
function(subx, subg, t) {
269+
function(subx, subgk, rtv) {
270270
tibble(data = list(
271271
subx %>%
272272
filter(time_value == attr(subx, "metadata")$as_of - 1) %>%
@@ -306,7 +306,7 @@ test_that("as_of and epix_slide with long enough window are compatible", {
306306
})
307307

308308
test_that("epix_slide `f` is passed an ungrouped `epi_archive`", {
309-
slide_fn <- function(x, g, t) {
309+
slide_fn <- function(x, gk, rtv) {
310310
expect_true(is_epi_archive(x))
311311
return(NA)
312312
}

0 commit comments

Comments
 (0)