-
Notifications
You must be signed in to change notification settings - Fork 8
wip: rework slide window args #513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
[Made checkboxes for completion/wontdo status.] Snippet above looks pretty good; I haven't looked at actual diffs.
misc. suggests:
|
Responding to @brookslogan's questions above:
|
I started thinking "left window" rather than "align on window's left side", oops. I think right/center/left names are fine. I thought about suggesting |
|
musing: Sorry for all the trouble, I'm not sure dot prefixing / name conflict stuff was actually necessary here after all. I think we do get a small benefit from it though if it is included.
thoughts: re. naming: ... I don't know if these are bikeshedding or load-bearing signage. With
reprex: grabbing some arg naming infolibrary(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
tibble(pkgname = c("dplyr", "tidyr", "slider", "zoo", "xts", "data.table")) %>%
mutate(member_value = lapply(pkgname, function(pkgname) as.list(asNamespace(pkgname)))) %>%
mutate(member_name = lapply(member_value, names)) %>%
tidyr::unchop(c(member_name, member_value)) %>%
mutate(argname = lapply(member_value, function(x) {
if (is.function(x)) {
formalArgs(args(x))
} else {
character(0L)
}
}), member_value = NULL) %>%
tidyr::unchop(argname) %>%
filter(argname %in% c("n", ".n", "window", ".window", "window_size", ".window_size")) %>%
print(n = 100L)
#> # A tibble: 74 × 3
#> pkgname member_name argname
#> <chr> <chr> <chr>
#> 1 dplyr slice_min.data.frame n
#> 2 dplyr vec_as_location_invert n
#> 3 dplyr check_slice_unnamed_n_prop n
#> 4 dplyr sample_int n
#> 5 dplyr check_size n
#> 6 dplyr dplyr_new_data_frame n
#> 7 dplyr shift_c n
#> 8 dplyr shift n
#> 9 dplyr check_slice_n_prop n
#> 10 dplyr minimal_names n
#> 11 dplyr ntile n
#> 12 dplyr slice_max n
#> 13 dplyr slice_tail n
#> 14 dplyr ntext n
#> 15 dplyr get_slice_size n
#> 16 dplyr fmt_check_length_val n
#> 17 dplyr progress_estimated n
#> 18 dplyr slice_min n
#> 19 dplyr slice_tail.data.frame n
#> 20 dplyr random_table_name n
#> 21 dplyr shift_slice n
#> 22 dplyr slice_max.data.frame n
#> 23 dplyr nth n
#> 24 dplyr slice_sample n
#> 25 dplyr lag n
#> 26 dplyr lead n
#> 27 dplyr top_n_rank n
#> 28 dplyr top_frac n
#> 29 dplyr slice_head n
#> 30 dplyr slice_sample.data.frame n
#> 31 dplyr slice_head.data.frame n
#> 32 dplyr top_n n
#> 33 dplyr check_length_val n
#> 34 dplyr last_dplyr_warnings n
#> 35 tidyr str_split_fixed n
#> 36 slider vec_init_unspecified_list n
#> 37 slider compute_from n
#> 38 slider compute_to n
#> 39 zoo scale_y_yearqtr n
#> 40 zoo scale_x_yearmon n
#> 41 zoo make.par.list n
#> 42 zoo yearqtr_trans n
#> 43 zoo head.zoo n
#> 44 zoo scale_y_yearmon n
#> 45 zoo yearmon_trans n
#> 46 zoo scale_x_yearqtr n
#> 47 zoo tail.zoo n
#> 48 xts shift.time n
#> 49 xts last.default n
#> 50 xts naCheck n
#> 51 xts align.time.xts n
#> 52 xts align.time.POSIXct n
#> 53 xts shift.time.xts n
#> 54 xts first.xts n
#> 55 xts last.xts n
#> 56 xts align.time.POSIXlt n
#> 57 xts first.default n
#> 58 data.table froll n
#> 59 data.table gtail n
#> 60 data.table frollsum n
#> 61 data.table first n
#> 62 data.table g[ n
#> 63 data.table gshift n
#> 64 data.table last n
#> 65 data.table cedta n
#> 66 data.table shift n
#> 67 data.table head.data.table n
#> 68 data.table setalloccol n
#> 69 data.table alloc.col n
#> 70 data.table frollapply n
#> 71 data.table tail.data.table n
#> 72 data.table ghead n
#> 73 data.table g[[ n
#> 74 data.table frollmean n Created on 2024-08-15 with reprex v2.1.1
|
My personal take is that these names don't matter as much as clear documentation around them and we should spend our very finite research time elsewhere (though I appreciate the thoroughness you're bringing to this question Logan). I'm not going to weigh this discussion down with more opinions about This PR fixes the key window arithmetic issues Dan pointed out and incrementally moves this package towards a tidy design best practice. I can address the todos above and I propose we move ahead. As for "clear documentation" mentioned above, I hope to address that point with our renewed effort on documentation in the coming months. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Browsing review requests and wasn't sure if this was still wip or not. Just dropped a few comments but realized it's probably still wip. If it's ready, please re-request!
Updated all the documentation that I could find, including vignettes. I'm sure there will be things I missed. Will fix issues as I spot them on the site in the documentation pass coming up. |
Checklist
Please:
PR).
brookslogan, nmdefries.
DESCRIPTION
. Always incrementthe patch version number (the third number), unless you are making a
release PR from dev to main, in which case increment the minor version
number (the second number).
(backwards-incompatible changes to the documented interface) are noted.
Collect the changes under the next release number (e.g. if you are on
1.7.2, then write your changes under the 1.8 heading).
process.
Change explanations for reviewer
Prototype of new slide interface. Fixing tests takes a long time, want to make sure we agree on inner logic and deprecation handling before I tackle all that. The core logic may be easier to read outside the diffs, so reproducing here:
Magic GitHub syntax to mark associated Issue(s) as resolved when this is merged into the default branch
epi_slide
andepix_slide
args #510