9
9
# ' @export
10
10
mean.epi_df <- function (x , ... ) {
11
11
cli_abort(c(" `mean` can't be used on entire `epi_df`s" ,
12
- " x" = " {rlang::caller_arg(x)} was an `epi_df`" ,
13
- " i" = " If you encountered this while trying to take a rolling mean
12
+ " x" = " {rlang::caller_arg(x)} was an `epi_df`" ,
13
+ " i" = " If you encountered this while trying to take a rolling mean
14
14
of a column using `epi_slide`, you probably forgot to
15
15
specify the column name (e.g., ~ mean(.x$colname)). You may
16
- also prefer to use the specialized `epi_slide_mean` method." ))
16
+ also prefer to use the specialized `epi_slide_mean` method."
17
+ ))
17
18
}
18
19
19
20
# Similarly, provide better error messages for some other potentially-common
@@ -22,17 +23,21 @@ mean.epi_df <- function(x, ...) {
22
23
# ' @export
23
24
Summary.epi_df <- function (... , na.rm = FALSE ) {
24
25
generic <- .Generic # cli uses dot prefixes for special purpose, don't upset it
25
- maybe_opt_pointer <- switch (
26
- .Generic ,
26
+ maybe_opt_pointer <- switch (.Generic ,
27
27
sum = " You may also prefer the specialized epi_slide_sum method." ,
28
- prod = , min = , max = , all = , any = " You may also prefer the specialized epi_slide_opt method." ,
28
+ prod = ,
29
+ min = ,
30
+ max = ,
31
+ all = ,
32
+ any = " You may also prefer the specialized epi_slide_opt method." ,
29
33
range = " " ,
30
34
cli_abort(" Unrecognized .Generic: {generic}" )
31
35
)
32
36
cli_abort(c(" `{generic}` can't be used on entire `epi_df`s" ,
33
- " x" = " {rlang::caller_arg(..1)} was an `epi_df`" ,
34
- " i" = " If you encountered this while trying to take a rolling {generic}
37
+ " x" = " {rlang::caller_arg(..1)} was an `epi_df`" ,
38
+ " i" = " If you encountered this while trying to take a rolling {generic}
35
39
of a column using `epi_slide`, you probably forgot to
36
40
specify the column name (e.g., ~ mean(.x$colname)).
37
- {maybe_opt_pointer}" ))
41
+ {maybe_opt_pointer}"
42
+ ))
38
43
}
0 commit comments