@@ -198,7 +198,7 @@ assert_sufficient_f_args <- function(f, ...) {
198198# '
199199# ' @source https://github.com/r-lib/rlang/blob/c55f6027928d3104ed449e591e8a225fcaf55e13/R/fn.R#L343-L427
200200# '
201- # ' @param . f A function, one-sided formula, or quosure.
201+ # ' @param f A function, one-sided formula, or quosure.
202202# '
203203# ' If a **function**, the function is returned as-is, with no
204204# ' modifications.
@@ -220,7 +220,6 @@ assert_sufficient_f_args <- function(f, ...) {
220220# ' @param ... Additional arguments to pass to the function or formula
221221# ' specified via `x`. If `x` is a quosure, any arguments passed via `...`
222222# ' will be ignored.
223- # ' @inheritParams rlang::args_error_context
224223# ' @examples
225224# ' f <- as_slide_computation(~ .x + 1)
226225# ' f(10)
@@ -235,13 +234,13 @@ assert_sufficient_f_args <- function(f, ...) {
235234# ' f_rhs is_formula caller_arg caller_env
236235# '
237236# ' @noRd
238- as_slide_computation <- function (.f ,
239- ... ,
240- arg = caller_arg( .f ),
241- call = caller_env()) {
237+ as_slide_computation <- function (f , ... ) {
238+ arg = caller_arg( f )
239+ call = caller_env()
240+
242241 # A quosure is a type of formula, so be careful with the order and contents
243242 # of the conditional logic here.
244- if (is_quosure(. f )) {
243+ if (is_quosure(f )) {
245244 fn = function (.x , .group_key , .ref_time_value , ... ) {
246245 # Convert to environment to standardize between tibble and R6
247246 # based inputs. In both cases, we should get a simple
@@ -254,31 +253,31 @@ as_slide_computation <- function(.f,
254253 data_mask $ .x = .x
255254 data_mask $ .group_key = .group_key
256255 data_mask $ .ref_time_value = .ref_time_value
257- rlang :: eval_tidy(. f , data_mask )
256+ rlang :: eval_tidy(f , data_mask )
258257 }
259258
260259 return (fn )
261260 }
262261
263- if (is_function(. f )) {
262+ if (is_function(f )) {
264263 # Check that `f` takes enough args
265- assert_sufficient_f_args(. f , ... )
266- return (. f )
264+ assert_sufficient_f_args(f , ... )
265+ return (f )
267266 }
268267
269- if (is_formula(. f )) {
270- if (length(. f ) > 2 ) {
268+ if (is_formula(f )) {
269+ if (length(f ) > 2 ) {
271270 Abort(sprintf(" %s must be a one-sided formula" , arg ),
272271 class = " epiprocess__as_slide_computation__formula_is_twosided" ,
273- epiprocess__f = . f ,
272+ epiprocess__f = f ,
274273 call = call )
275274 }
276275
277- env <- f_env(. f )
276+ env <- f_env(f )
278277 if (! is_environment(env )) {
279278 Abort(" Formula must carry an environment." ,
280279 class = " epiprocess__as_slide_computation__formula_has_no_env" ,
281- epiprocess__f = . f ,
280+ epiprocess__f = f ,
282281 epiprocess__f_env = env ,
283282 arg = arg , call = call )
284283 }
@@ -288,16 +287,16 @@ as_slide_computation <- function(.f,
288287 .x = quote(..1 ), .y = quote(..2 ), .z = quote(..3 ),
289288 . = quote(..1 ), .group_key = quote(..2 ), .ref_time_value = quote(..3 )
290289 )
291- fn <- new_function(args , f_rhs(. f ), env )
290+ fn <- new_function(args , f_rhs(f ), env )
292291 fn <- structure(fn , class = c(" epiprocess_slide_computation" , " function" ))
293292
294293 return (fn )
295294 }
296295
297- Abort(sprintf(" Can't convert a %s to a slide computation" , class(. f )),
296+ Abort(sprintf(" Can't convert a %s to a slide computation" , class(f )),
298297 class = " epiprocess__as_slide_computation__cant_convert_catchall" ,
299- epiprocess__f = . f ,
300- epiprocess__f_class = class(. f ),
298+ epiprocess__f = f ,
299+ epiprocess__f_class = class(f ),
301300 arg = arg ,
302301 call = call )
303302}
0 commit comments