├── .Rbuildignore ├── .gitattributes ├── .github ├── .gitignore ├── pull_request_template.md └── workflows │ └── R-CMD-check.yaml ├── .gitignore ├── DESCRIPTION ├── LICENSE ├── LICENSE.md ├── NAMESPACE ├── NEWS.md ├── R ├── across.R ├── add_count.R ├── arrange.R ├── as_tidytable.R ├── between.R ├── bind.R ├── c_across.R ├── case.R ├── case_match.R ├── case_when.R ├── coalesce.R ├── complete.R ├── consecutive_id.R ├── count.R ├── crossing.R ├── cumulative.R ├── cur-context.R ├── desc.R ├── distinct.R ├── drop_na.R ├── dt.R ├── enframe.R ├── expand.R ├── expand_grid.R ├── extract.R ├── fill.R ├── filter.R ├── first-last-nth.R ├── fread-fwrite.R ├── get_dummies.R ├── group_by.R ├── group_cols.R ├── group_split.R ├── if_all-if_any.R ├── if_else.R ├── in-notin.R ├── inv_gc.R ├── is_tidytable.R ├── join.R ├── lag-lead.R ├── mutate.R ├── mutate_rowwise.R ├── n.R ├── n_distinct.R ├── na_if.R ├── nest.R ├── nest_by.R ├── new_tidytable.R ├── pick.R ├── pivot_longer.R ├── pivot_wider.R ├── print.R ├── pull.R ├── purrr-map.R ├── purrr-map2.R ├── purrr-pmap.R ├── rank.R ├── recode.R ├── reexports.R ├── reframe.R ├── relocate.R ├── rename.R ├── rename_with.R ├── replace_na.R ├── rowwise.R ├── select.R ├── separate.R ├── separate_longer_delim.R ├── separate_rows.R ├── separate_wider_delim.R ├── separate_wider_regex.R ├── slice-head-tail.R ├── slice-min-max.R ├── slice.R ├── slice_sample.R ├── standalone-zeallot.R ├── summarize.R ├── tidytable-package.R ├── tidytable.R ├── top_n.R ├── transmute.R ├── tribble.R ├── uncount.R ├── unite.R ├── unnest.R ├── unnest_longer.R ├── unnest_wider.R ├── utils-across.R ├── utils-fast_copy.R ├── utils-general.R ├── utils-pipe.R ├── utils-prep_exprs.R ├── utils-stringr.R ├── utils-tidyselect.R ├── vctrs-tidytable.R └── zzz.R ├── README.Rmd ├── README.md ├── cran-comments.md ├── docs ├── 404.html ├── LICENSE-text.html ├── LICENSE.html ├── apple-touch-icon-120x120.png ├── apple-touch-icon-152x152.png ├── apple-touch-icon-180x180.png ├── apple-touch-icon-60x60.png ├── apple-touch-icon-76x76.png ├── apple-touch-icon.png ├── articles │ ├── index.html │ ├── speed_comparisons.html │ └── speed_comparisons_files │ │ ├── accessible-code-block-0.0.1 │ │ └── empty-anchor.js │ │ ├── anchor-sections-1.0 │ │ ├── anchor-sections.css │ │ └── anchor-sections.js │ │ ├── header-attrs-2.10 │ │ └── header-attrs.js │ │ ├── header-attrs-2.3 │ │ └── header-attrs.js │ │ ├── header-attrs-2.4 │ │ └── header-attrs.js │ │ ├── header-attrs-2.5 │ │ └── header-attrs.js │ │ ├── header-attrs-2.6 │ │ └── header-attrs.js │ │ ├── header-attrs-2.7 │ │ └── header-attrs.js │ │ ├── header-attrs-2.8 │ │ ├── header-attrs 2.js │ │ └── header-attrs.js │ │ └── header-attrs-2.9 │ │ └── header-attrs.js ├── authors.html ├── bootstrap-toc.css ├── bootstrap-toc.js ├── docsearch.css ├── docsearch.js ├── extra.css ├── favicon-16x16.png ├── favicon-32x32.png ├── favicon.ico ├── index.html ├── link.svg ├── logo.png ├── news │ └── index.html ├── pkgdown.css ├── pkgdown.js ├── pkgdown.yml ├── pull_request_template.html ├── reference │ ├── Rplot001.png │ ├── across..html │ ├── across.html │ ├── add_count..html │ ├── add_count.html │ ├── add_tally..html │ ├── anti_join..html │ ├── arrange..html │ ├── arrange.html │ ├── arrange_across..html │ ├── as_dt.html │ ├── as_tidytable.html │ ├── between..html │ ├── between.html │ ├── bind_cols..html │ ├── bind_cols.html │ ├── bind_rows..html │ ├── c_across..html │ ├── c_across.html │ ├── case..html │ ├── case.html │ ├── case_match..html │ ├── case_match.html │ ├── case_when..html │ ├── case_when.html │ ├── coalesce..html │ ├── coalesce.html │ ├── complete..html │ ├── complete.html │ ├── consecutive_id..html │ ├── consecutive_id.html │ ├── context.html │ ├── count..html │ ├── count.html │ ├── cross_join.html │ ├── crossing..html │ ├── crossing.html │ ├── cur_column..html │ ├── cur_data..html │ ├── cur_group_id..html │ ├── cur_group_rows..html │ ├── desc..html │ ├── desc.html │ ├── distinct..html │ ├── distinct.html │ ├── drop_na..html │ ├── drop_na.html │ ├── dt.html │ ├── dt_verb.html │ ├── enframe..html │ ├── enframe.html │ ├── expand..html │ ├── expand.html │ ├── expand_grid..html │ ├── expand_grid.html │ ├── extract..html │ ├── extract.html │ ├── figures │ │ └── logo.png │ ├── fill..html │ ├── fill.html │ ├── filter..html │ ├── filter.html │ ├── first..html │ ├── first.html │ ├── fread..html │ ├── fread.html │ ├── full_join..html │ ├── fwrite..html │ ├── get_dummies..html │ ├── get_dummies.html │ ├── grapes-notin-grapes.html │ ├── group_by..html │ ├── group_by.html │ ├── group_cols.html │ ├── group_split..html │ ├── group_split.html │ ├── group_vars..html │ ├── group_vars.html │ ├── if_all..html │ ├── if_all.html │ ├── if_any..html │ ├── if_else..html │ ├── if_else.html │ ├── ifelse..html │ ├── in-notin.html │ ├── index.html │ ├── inner_join..html │ ├── inv_gc.html │ ├── is_grouped_df..html │ ├── is_grouped_df.html │ ├── is_tidytable.html │ ├── knit_print.tidytable.html │ ├── lag.html │ ├── lags..html │ ├── last..html │ ├── leads..html │ ├── left_join..html │ ├── left_join.html │ ├── map..html │ ├── map.html │ ├── map2..html │ ├── map2_chr..html │ ├── map2_dbl..html │ ├── map2_df..html │ ├── map2_dfc..html │ ├── map2_dfr..html │ ├── map2_int..html │ ├── map2_lgl..html │ ├── map_chr..html │ ├── map_dbl..html │ ├── map_df..html │ ├── map_dfc..html │ ├── map_dfr..html │ ├── map_int..html │ ├── map_lgl..html │ ├── mutate..html │ ├── mutate.html │ ├── mutate_across..html │ ├── mutate_if..html │ ├── mutate_rowwise..html │ ├── mutate_rowwise.html │ ├── n..html │ ├── n.html │ ├── n_distinct..html │ ├── n_distinct.html │ ├── na_if..html │ ├── na_if.html │ ├── nest..html │ ├── nest.html │ ├── nest_by..html │ ├── nest_by.html │ ├── nest_join.html │ ├── nesting..html │ ├── new_tidytable.html │ ├── nth..html │ ├── pick.html │ ├── pipe.html │ ├── pivot_longer..html │ ├── pivot_longer.html │ ├── pivot_wider..html │ ├── pivot_wider.html │ ├── pmap..html │ ├── pmap_chr..html │ ├── pmap_dbl..html │ ├── pmap_df..html │ ├── pmap_dfc..html │ ├── pmap_dfr..html │ ├── pmap_int..html │ ├── pmap_lgl..html │ ├── pull..html │ ├── pull.html │ ├── rank.html │ ├── recode.html │ ├── reexports.html │ ├── reframe.html │ ├── relocate..html │ ├── relocate.html │ ├── rename..html │ ├── rename.html │ ├── rename_all..html │ ├── rename_with..html │ ├── rename_with.html │ ├── replace_na..html │ ├── replace_na.html │ ├── right_join..html │ ├── row_number..html │ ├── row_number.html │ ├── rowwise..html │ ├── rowwise.html │ ├── select..html │ ├── select.html │ ├── semi_join..html │ ├── separate..html │ ├── separate.html │ ├── separate_longer_delim.html │ ├── separate_rows..html │ ├── separate_rows.html │ ├── separate_wider_delim.html │ ├── separate_wider_regex.html │ ├── slice..html │ ├── slice.html │ ├── slice_head..html │ ├── slice_max..html │ ├── slice_min..html │ ├── slice_sample..html │ ├── slice_tail..html │ ├── starts_with..html │ ├── summarise..html │ ├── summarize..html │ ├── summarize.html │ ├── summarize_across..html │ ├── tally..html │ ├── tidytable-vctrs.html │ ├── tidytable.html │ ├── top_n..html │ ├── top_n.html │ ├── transmute..html │ ├── transmute.html │ ├── tribble.html │ ├── uncount..html │ ├── uncount.html │ ├── ungroup..html │ ├── unite..html │ ├── unite.html │ ├── unnest..html │ ├── unnest.html │ ├── unnest_longer..html │ ├── unnest_longer.html │ ├── unnest_wider..html │ ├── unnest_wider.html │ ├── walk..html │ └── where.html └── sitemap.xml ├── man ├── .DS_Store ├── across.Rd ├── add_count.Rd ├── arrange.Rd ├── as_tidytable.Rd ├── between.Rd ├── bind_cols.Rd ├── c_across.Rd ├── case.Rd ├── case_match.Rd ├── case_when.Rd ├── coalesce.Rd ├── complete.Rd ├── consecutive_id.Rd ├── context.Rd ├── count.Rd ├── cross_join.Rd ├── crossing.Rd ├── desc.Rd ├── distinct.Rd ├── drop_na.Rd ├── dt.Rd ├── enframe.Rd ├── expand.Rd ├── expand_grid.Rd ├── extract.Rd ├── figures │ └── logo.png ├── fill.Rd ├── filter.Rd ├── first.Rd ├── fread.Rd ├── get_dummies.Rd ├── group_by.Rd ├── group_cols.Rd ├── group_split.Rd ├── group_vars.Rd ├── if_all.Rd ├── if_else.Rd ├── in-notin.Rd ├── inv_gc.Rd ├── is_grouped_df.Rd ├── is_tidytable.Rd ├── lag.Rd ├── left_join.Rd ├── map.Rd ├── mutate.Rd ├── mutate_rowwise.Rd ├── n.Rd ├── n_distinct.Rd ├── na_if.Rd ├── nest.Rd ├── nest_by.Rd ├── nest_join.Rd ├── new_tidytable.Rd ├── pick.Rd ├── pipe.Rd ├── pivot_longer.Rd ├── pivot_wider.Rd ├── pull.Rd ├── rank.Rd ├── recode.Rd ├── reexports.Rd ├── reframe.Rd ├── relocate.Rd ├── rename.Rd ├── rename_with.Rd ├── replace_na.Rd ├── rowwise.Rd ├── select.Rd ├── separate.Rd ├── separate_longer_delim.Rd ├── separate_rows.Rd ├── separate_wider_delim.Rd ├── separate_wider_regex.Rd ├── slice.Rd ├── summarize.Rd ├── tidytable-vctrs.Rd ├── tidytable.Rd ├── top_n.Rd ├── transmute.Rd ├── tribble.Rd ├── uncount.Rd ├── unite.Rd ├── unnest.Rd ├── unnest_longer.Rd └── unnest_wider.Rd ├── pkgdown ├── _pkgdown.yml ├── extra.css └── favicon │ ├── apple-touch-icon-120x120.png │ ├── apple-touch-icon-152x152.png │ ├── apple-touch-icon-180x180.png │ ├── apple-touch-icon-60x60.png │ ├── apple-touch-icon-76x76.png │ ├── apple-touch-icon.png │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ └── favicon.ico ├── revdep ├── README.md ├── checks.noindex │ ├── ConfZIC │ │ ├── ConfZIC_1.0.1.tar.gz │ │ ├── new │ │ │ ├── ConfZIC.Rcheck │ │ │ │ ├── 00check.log │ │ │ │ ├── 00install.out │ │ │ │ ├── ConfZIC-Ex.R │ │ │ │ ├── ConfZIC-Ex.Rout │ │ │ │ └── ConfZIC-Ex.pdf │ │ │ └── libraries.txt │ │ └── old │ │ │ ├── ConfZIC.Rcheck │ │ │ ├── 00check.log │ │ │ ├── 00install.out │ │ │ ├── ConfZIC-Ex.R │ │ │ ├── ConfZIC-Ex.Rout │ │ │ └── ConfZIC-Ex.pdf │ │ │ └── libraries.txt │ ├── CooRTweet │ │ ├── CooRTweet_2.0.2.tar.gz │ │ ├── new │ │ │ ├── CooRTweet.Rcheck │ │ │ │ ├── 00check.log │ │ │ │ ├── 00install.out │ │ │ │ ├── CooRTweet-Ex.R │ │ │ │ ├── CooRTweet-Ex.Rout │ │ │ │ ├── CooRTweet-Ex.pdf │ │ │ │ └── tests │ │ │ │ │ ├── startup.Rs │ │ │ │ │ ├── testthat.R │ │ │ │ │ ├── testthat.Rout │ │ │ │ │ └── testthat │ │ │ │ │ └── test-sample_data.R │ │ │ └── libraries.txt │ │ └── old │ │ │ ├── CooRTweet.Rcheck │ │ │ ├── 00check.log │ │ │ ├── 00install.out │ │ │ ├── CooRTweet-Ex.R │ │ │ ├── CooRTweet-Ex.Rout │ │ │ ├── CooRTweet-Ex.pdf │ │ │ └── tests │ │ │ │ ├── startup.Rs │ │ │ │ ├── testthat.R │ │ │ │ ├── testthat.Rout │ │ │ │ └── testthat │ │ │ │ └── test-sample_data.R │ │ │ └── libraries.txt │ ├── bbknnR │ │ ├── bbknnR_1.1.1.tar.gz │ │ ├── new │ │ │ ├── bbknnR.Rcheck │ │ │ │ ├── 00check.log │ │ │ │ └── 00install.out │ │ │ └── libraries.txt │ │ └── old │ │ │ ├── bbknnR.Rcheck │ │ │ ├── 00check.log │ │ │ └── 00install.out │ │ │ └── libraries.txt │ ├── ffsimulator │ │ ├── ffsimulator_1.2.3.tar.gz │ │ ├── new │ │ │ ├── ffsimulator.Rcheck │ │ │ │ ├── 00check.log │ │ │ │ ├── 00install.out │ │ │ │ ├── ffsimulator-Ex.R │ │ │ │ ├── ffsimulator-Ex.Rout │ │ │ │ ├── ffsimulator-Ex.pdf │ │ │ │ └── tests │ │ │ │ │ ├── startup.Rs │ │ │ │ │ ├── testthat.R │ │ │ │ │ ├── testthat.Rout.fail │ │ │ │ │ └── testthat │ │ │ │ │ ├── _snaps │ │ │ │ │ └── ffs_autoplot │ │ │ │ │ │ └── wins-plot.svg │ │ │ │ │ ├── test-ffs_autoplot.R │ │ │ │ │ ├── test-ffs_components.R │ │ │ │ │ ├── test-integration.R │ │ │ │ │ └── testthat-problems.rds │ │ │ └── libraries.txt │ │ └── old │ │ │ ├── ffsimulator.Rcheck │ │ │ ├── 00check.log │ │ │ ├── 00install.out │ │ │ ├── ffsimulator-Ex.R │ │ │ ├── ffsimulator-Ex.Rout │ │ │ ├── ffsimulator-Ex.pdf │ │ │ └── tests │ │ │ │ ├── startup.Rs │ │ │ │ ├── testthat.R │ │ │ │ ├── testthat.Rout.fail │ │ │ │ └── testthat │ │ │ │ ├── _snaps │ │ │ │ └── ffs_autoplot │ │ │ │ │ └── wins-plot.svg │ │ │ │ ├── test-ffs_autoplot.R │ │ │ │ ├── test-ffs_components.R │ │ │ │ ├── test-integration.R │ │ │ │ └── testthat-problems.rds │ │ │ └── libraries.txt │ ├── journalabbr │ │ ├── journalabbr_0.4.3.tar.gz │ │ ├── new │ │ │ ├── journalabbr.Rcheck │ │ │ │ ├── 00check.log │ │ │ │ ├── 00install.out │ │ │ │ ├── journalabbr-Ex.R │ │ │ │ ├── journalabbr-Ex.Rout │ │ │ │ ├── journalabbr-Ex.pdf │ │ │ │ └── tests │ │ │ │ │ ├── startup.Rs │ │ │ │ │ ├── testthat.R │ │ │ │ │ ├── testthat.Rout │ │ │ │ │ └── testthat │ │ │ │ │ ├── test-add_abbrtable.R │ │ │ │ │ ├── test-read_bib2dt.R │ │ │ │ │ └── test-replace_field.R │ │ │ └── libraries.txt │ │ └── old │ │ │ ├── journalabbr.Rcheck │ │ │ ├── 00check.log │ │ │ ├── 00install.out │ │ │ ├── journalabbr-Ex.R │ │ │ ├── journalabbr-Ex.Rout │ │ │ ├── journalabbr-Ex.pdf │ │ │ └── tests │ │ │ │ ├── startup.Rs │ │ │ │ ├── testthat.R │ │ │ │ ├── testthat.Rout │ │ │ │ └── testthat │ │ │ │ ├── test-add_abbrtable.R │ │ │ │ ├── test-read_bib2dt.R │ │ │ │ └── test-replace_field.R │ │ │ └── libraries.txt │ ├── libraries.csv │ ├── msSPChelpR │ │ ├── msSPChelpR_0.9.1.tar.gz │ │ ├── new │ │ │ ├── libraries.txt │ │ │ └── msSPChelpR.Rcheck │ │ │ │ ├── 00check.log │ │ │ │ ├── 00install.out │ │ │ │ ├── msSPChelpR-Ex.R │ │ │ │ ├── msSPChelpR-Ex.Rout │ │ │ │ ├── msSPChelpR-Ex.pdf │ │ │ │ └── tests │ │ │ │ ├── startup.Rs │ │ │ │ ├── testthat.R │ │ │ │ ├── testthat.Rout │ │ │ │ └── testthat │ │ │ │ ├── test-pat_status.R │ │ │ │ ├── test-reshape_wide.R │ │ │ │ └── test-sir_byfutime.R │ │ └── old │ │ │ ├── libraries.txt │ │ │ └── msSPChelpR.Rcheck │ │ │ ├── 00check.log │ │ │ ├── 00install.out │ │ │ ├── msSPChelpR-Ex.R │ │ │ ├── msSPChelpR-Ex.Rout │ │ │ ├── msSPChelpR-Ex.pdf │ │ │ └── tests │ │ │ ├── startup.Rs │ │ │ ├── testthat.R │ │ │ ├── testthat.Rout │ │ │ └── testthat │ │ │ ├── test-pat_status.R │ │ │ ├── test-reshape_wide.R │ │ │ └── test-sir_byfutime.R │ ├── rTwig │ │ ├── new │ │ │ ├── libraries.txt │ │ │ └── rTwig.Rcheck │ │ │ │ ├── 00check.log │ │ │ │ └── 00install.out │ │ ├── old │ │ │ ├── libraries.txt │ │ │ └── rTwig.Rcheck │ │ │ │ ├── 00check.log │ │ │ │ └── 00install.out │ │ └── rTwig_1.3.0.tar.gz │ └── tidyrules │ │ ├── new │ │ ├── libraries.txt │ │ └── tidyrules.Rcheck │ │ │ ├── 00check.log │ │ │ ├── 00install.out │ │ │ ├── tests │ │ │ ├── startup.Rs │ │ │ ├── testthat.R │ │ │ ├── testthat.Rout │ │ │ └── testthat │ │ │ │ ├── Rplots.pdf │ │ │ │ ├── test-c5.R │ │ │ │ ├── test-cubist.R │ │ │ │ ├── test-party.R │ │ │ │ ├── test-rpart.R │ │ │ │ └── test-rulelist.R │ │ │ ├── tidyrules-Ex.R │ │ │ ├── tidyrules-Ex.Rout │ │ │ └── tidyrules-Ex.pdf │ │ ├── old │ │ ├── libraries.txt │ │ └── tidyrules.Rcheck │ │ │ ├── 00check.log │ │ │ ├── 00install.out │ │ │ ├── tests │ │ │ ├── startup.Rs │ │ │ ├── testthat.R │ │ │ ├── testthat.Rout │ │ │ └── testthat │ │ │ │ ├── Rplots.pdf │ │ │ │ ├── test-c5.R │ │ │ │ ├── test-cubist.R │ │ │ │ ├── test-party.R │ │ │ │ ├── test-rpart.R │ │ │ │ └── test-rulelist.R │ │ │ ├── tidyrules-Ex.R │ │ │ ├── tidyrules-Ex.Rout │ │ │ └── tidyrules-Ex.pdf │ │ └── tidyrules_0.2.7.tar.gz ├── cran.md ├── data.sqlite ├── failures.md ├── library.noindex │ └── tidytable │ │ ├── new │ │ ├── glue │ │ │ ├── DESCRIPTION │ │ │ ├── INDEX │ │ │ ├── LICENSE │ │ │ ├── NAMESPACE │ │ │ ├── NEWS.md │ │ │ ├── R │ │ │ │ ├── glue │ │ │ │ ├── glue.rdb │ │ │ │ └── glue.rdx │ │ │ ├── help │ │ │ │ ├── AnIndex │ │ │ │ ├── aliases.rds │ │ │ │ ├── figures │ │ │ │ │ └── logo.png │ │ │ │ ├── glue.rdb │ │ │ │ ├── glue.rdx │ │ │ │ └── paths.rds │ │ │ ├── html │ │ │ │ ├── 00Index.html │ │ │ │ └── R.css │ │ │ └── libs │ │ │ │ └── glue.so │ │ ├── tidytable │ │ │ ├── DESCRIPTION │ │ │ ├── INDEX │ │ │ ├── LICENSE │ │ │ ├── NAMESPACE │ │ │ ├── NEWS.md │ │ │ ├── R │ │ │ │ ├── tidytable │ │ │ │ ├── tidytable.rdb │ │ │ │ └── tidytable.rdx │ │ │ ├── help │ │ │ │ ├── AnIndex │ │ │ │ ├── aliases.rds │ │ │ │ ├── figures │ │ │ │ │ └── logo.png │ │ │ │ ├── paths.rds │ │ │ │ ├── tidytable.rdb │ │ │ │ └── tidytable.rdx │ │ │ └── html │ │ │ │ ├── 00Index.html │ │ │ │ └── R.css │ │ └── withr │ │ │ ├── DESCRIPTION │ │ │ ├── INDEX │ │ │ ├── LICENSE │ │ │ ├── NAMESPACE │ │ │ ├── NEWS.md │ │ │ ├── R │ │ │ ├── withr │ │ │ ├── withr.rdb │ │ │ └── withr.rdx │ │ │ ├── help │ │ │ ├── AnIndex │ │ │ ├── aliases.rds │ │ │ ├── figures │ │ │ │ ├── README-unnamed-chunk-3-1.png │ │ │ │ ├── lifecycle-archived.svg │ │ │ │ ├── lifecycle-defunct.svg │ │ │ │ ├── lifecycle-deprecated.svg │ │ │ │ ├── lifecycle-experimental.svg │ │ │ │ ├── lifecycle-maturing.svg │ │ │ │ ├── lifecycle-questioning.svg │ │ │ │ ├── lifecycle-soft-deprecated.svg │ │ │ │ ├── lifecycle-stable.svg │ │ │ │ ├── lifecycle-superseded.svg │ │ │ │ └── logo.png │ │ │ ├── paths.rds │ │ │ ├── withr.rdb │ │ │ └── withr.rdx │ │ │ └── html │ │ │ ├── 00Index.html │ │ │ └── R.css │ │ └── old │ │ └── tidytable │ │ ├── DESCRIPTION │ │ ├── INDEX │ │ ├── LICENSE │ │ ├── NAMESPACE │ │ ├── NEWS.md │ │ ├── R │ │ ├── tidytable │ │ ├── tidytable.rdb │ │ └── tidytable.rdx │ │ ├── help │ │ ├── AnIndex │ │ ├── aliases.rds │ │ ├── figures │ │ │ └── logo.png │ │ ├── paths.rds │ │ ├── tidytable.rdb │ │ └── tidytable.rdx │ │ └── html │ │ ├── 00Index.html │ │ └── R.css └── problems.md ├── tests ├── testthat.R └── testthat │ ├── test-across.R │ ├── test-add_count.R │ ├── test-arrange.R │ ├── test-as_tidytable.R │ ├── test-between.R │ ├── test-bind.R │ ├── test-case.R │ ├── test-case_match.R │ ├── test-case_when.R │ ├── test-coalesce.R │ ├── test-complete.R │ ├── test-consecutive_id.R │ ├── test-count.R │ ├── test-cumulative.R │ ├── test-cur-context.R │ ├── test-deprec-across.R │ ├── test-distinct.R │ ├── test-drop_na.R │ ├── test-dt.R │ ├── test-enframe.R │ ├── test-expand.R │ ├── test-expand_grid.R │ ├── test-extract.R │ ├── test-fill.R │ ├── test-filter.R │ ├── test-first-last-nth.R │ ├── test-fread.R │ ├── test-get_dummies.R │ ├── test-group_by.R │ ├── test-group_split.R │ ├── test-if_all-if_any.R │ ├── test-if_else.R │ ├── test-in-notin.R │ ├── test-join.R │ ├── test-lag-lead.R │ ├── test-mutate.R │ ├── test-mutate_rowwise.R │ ├── test-n_distinct.R │ ├── test-na_if.R │ ├── test-nest.R │ ├── test-nest_by.R │ ├── test-new_tidytable.R │ ├── test-pick.R │ ├── test-pivot_longer.R │ ├── test-pivot_wider.R │ ├── test-pull.R │ ├── test-purrr.R │ ├── test-rank.R │ ├── test-recode.R │ ├── test-reframe.R │ ├── test-relocate.R │ ├── test-rename.R │ ├── test-replace_na.R │ ├── test-rowwise.R │ ├── test-select.R │ ├── test-separate.R │ ├── test-separate_longer_delim.R │ ├── test-separate_rows.R │ ├── test-separate_wider_delim.R │ ├── test-separate_wider_regex.R │ ├── test-slice-head-tail.R │ ├── test-slice-min-max.R │ ├── test-slice.R │ ├── test-slice_sample.R │ ├── test-summarize.R │ ├── test-tidytable.R │ ├── test-top_n.R │ ├── test-transmute.R │ ├── test-tribble.R │ ├── test-uncount.R │ ├── test-unite.R │ ├── test-unnest.R │ ├── test-unnest_longer.R │ ├── test-unnest_wider.R │ └── test-vctrs-tidytable.R ├── tidytable.Rproj └── vignettes ├── .gitignore └── speed_comparisons.Rmd /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^tidytable\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^LICENSE\.md$ 4 | ^README\.Rmd$ 5 | ^cran-comments\.md$ 6 | ^CRAN-RELEASE$ 7 | ^docs$ 8 | ^pkgdown$ 9 | ^revdep$ 10 | ^doc$ 11 | ^Meta$ 12 | ^vignettes 13 | ^\.github$ 14 | ^CRAN-SUBMISSION$ 15 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | docs/* linguist-documentation 2 | *.html linguist-detectable=false 3 | *.css linguist-detectable=false 4 | *.js linguist-detectable=false 5 | *.tex linguist-detectable=false 6 | -------------------------------------------------------------------------------- /.github/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ### Before you make a pull request 2 | * Make sure your code generally follows the [tidyverse style guide](https://style.tidyverse.org) 3 | * Update `NEWS.md` 4 | * Add `Closes #xx` in your PR message if it fixes an existing issue 5 | -------------------------------------------------------------------------------- /.github/workflows/R-CMD-check.yaml: -------------------------------------------------------------------------------- 1 | # For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. 2 | # https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - master 8 | pull_request: 9 | branches: 10 | - main 11 | - master 12 | 13 | name: R-CMD-check 14 | 15 | jobs: 16 | R-CMD-check: 17 | runs-on: macOS-latest 18 | env: 19 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 20 | steps: 21 | - uses: actions/checkout@v2 22 | - uses: r-lib/actions/setup-r@v2 23 | - name: Install dependencies 24 | run: | 25 | install.packages(c("remotes", "rcmdcheck")) 26 | remotes::install_deps(dependencies = TRUE) 27 | shell: Rscript {0} 28 | - name: Check 29 | run: | 30 | options(crayon.enabled = TRUE) 31 | rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "error") 32 | shell: Rscript {0} 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | .DS_Store 5 | doc 6 | Meta 7 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: tidytable 2 | Title: Tidy Interface to 'data.table' 3 | Version: 0.11.2.9 4 | Authors@R: c( 5 | person("Mark", "Fairbanks", role = c("aut", "cre"), email = "mark.t.fairbanks@gmail.com"), 6 | person("Abdessabour", "Moutik", role = "ctb"), 7 | person("Matt", "Carlson", role = "ctb"), 8 | person("Ivan", "Leung", role = "ctb"), 9 | person("Ross", "Kennedy", role = "ctb"), 10 | person("Robert", "On", role = "ctb"), 11 | person("Alexander", "Sevostianov", role = "ctb"), 12 | person("Koen", "ter Berg", role = "ctb") 13 | ) 14 | Description: A tidy interface to 'data.table', 15 | giving users the speed of 'data.table' while using tidyverse-like syntax. 16 | License: MIT + file LICENSE 17 | Encoding: UTF-8 18 | Imports: 19 | data.table (>= 1.16.0), 20 | glue (>= 1.4.0), 21 | lifecycle (>= 1.0.3), 22 | magrittr (>= 2.0.3), 23 | pillar (>= 1.8.0), 24 | rlang (>= 1.1.0), 25 | tidyselect (>= 1.2.0), 26 | vctrs (>= 0.6.0) 27 | RoxygenNote: 7.3.2 28 | Roxygen: list(markdown = TRUE) 29 | Config/testthat/edition: 3 30 | URL: https://markfairbanks.github.io/tidytable/, https://github.com/markfairbanks/tidytable 31 | BugReports: https://github.com/markfairbanks/tidytable/issues 32 | Suggests: 33 | testthat (>= 2.1.0), 34 | bit64, 35 | knitr, 36 | rmarkdown, 37 | crayon 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | YEAR: 2019 2 | COPYRIGHT HOLDER: Mark Fairbanks 3 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # MIT License 2 | 3 | Copyright (c) 2019 Mark Fairbanks 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /R/across.R: -------------------------------------------------------------------------------- 1 | #' Apply a function across a selection of columns 2 | #' 3 | #' @description 4 | #' Apply a function across a selection of columns. For use in `arrange()`, 5 | #' `mutate()`, and `summarize()`. 6 | #' 7 | #' @param .cols vector `c()` of unquoted column names. `tidyselect` compatible. 8 | #' @param .fns Function to apply. Can be a purrr-style lambda. 9 | #' Can pass also list of functions. 10 | #' @param ... Other arguments for the passed function 11 | #' @param .names A glue specification that helps with renaming output columns. 12 | #' `{.col}` stands for the selected column, and `{.fn}` stands for the name of the function being applied. 13 | #' The default (`NULL`) is equivalent to `"{.col}"` for a single function case and `"{.col}_{.fn}"` 14 | #' when a list is used for `.fns`. 15 | #' 16 | #' @export 17 | #' 18 | #' @examples 19 | #' df <- data.table( 20 | #' x = rep(1, 3), 21 | #' y = rep(2, 3), 22 | #' z = c("a", "a", "b") 23 | #' ) 24 | #' 25 | #' df %>% 26 | #' mutate(across(c(x, y), ~ .x * 2)) 27 | #' 28 | #' df %>% 29 | #' summarize(across(where(is.numeric), ~ mean(.x)), 30 | #' .by = z) 31 | #' 32 | #' df %>% 33 | #' arrange(across(c(y, z))) 34 | across <- function(.cols = everything(), .fns = NULL, ..., .names = NULL) { 35 | abort("`across()` can only work inside of tidytable verbs") 36 | } 37 | -------------------------------------------------------------------------------- /R/arrange.R: -------------------------------------------------------------------------------- 1 | #' Arrange/reorder rows 2 | #' 3 | #' @description 4 | #' Order rows in ascending or descending order. 5 | #' 6 | #' @param .df A data.frame or data.table 7 | #' @param ... Variables to arrange by 8 | #' 9 | #' @export 10 | #' 11 | #' @examples 12 | #' df <- data.table( 13 | #' a = 1:3, 14 | #' b = 4:6, 15 | #' c = c("a", "a", "b") 16 | #' ) 17 | #' 18 | #' df %>% 19 | #' arrange(c, -a) 20 | #' 21 | #' df %>% 22 | #' arrange(c, desc(a)) 23 | arrange <- function(.df, ...) { 24 | UseMethod("arrange") 25 | } 26 | 27 | #' @export 28 | arrange.tidytable <- function(.df, ...) { 29 | dots <- enquos(...) 30 | 31 | if (length(dots) == 0) return(.df) 32 | 33 | dt_env <- get_dt_env(dots) 34 | 35 | dots <- prep_exprs(dots, .df, dt_env = dt_env) 36 | 37 | is_expr <- map_lgl(dots, ~ !is_symbol(.x) && !is_call(.x, "-", 1)) 38 | 39 | if (any(is_expr)) { 40 | i <- expr(order(!!!dots)) 41 | 42 | dt_expr <- call2_i(.df, i) 43 | } else { 44 | .df <- copy(.df) 45 | 46 | dt_expr <- call2("setorder", quo(.df), !!!dots, na.last = TRUE, .ns = "data.table") 47 | 48 | dt_expr <- call2("[", dt_expr) 49 | } 50 | 51 | eval_tidy(dt_expr, .df, dt_env) 52 | } 53 | 54 | #' @export 55 | arrange.data.frame <- function(.df, ...) { 56 | .df <- as_tidytable(.df) 57 | arrange(.df, ...) 58 | } 59 | -------------------------------------------------------------------------------- /R/between.R: -------------------------------------------------------------------------------- 1 | #' Do the values from x fall between the left and right bounds? 2 | #' 3 | #' @description 4 | #' `between()` utilizes `data.table::between()` in the background 5 | #' 6 | #' @param x A numeric vector 7 | #' @param left,right Boundary values 8 | #' 9 | #' @export 10 | #' 11 | #' @examples 12 | #' df <- data.table( 13 | #' x = 1:5, 14 | #' y = 1:5 15 | #' ) 16 | #' 17 | #' # Typically used in a filter() 18 | #' df %>% 19 | #' filter(between(x, 2, 4)) 20 | #' 21 | #' df %>% 22 | #' filter(x %>% between(2, 4)) 23 | #' 24 | #' # Can also use the %between% operator 25 | #' df %>% 26 | #' filter(x %between% c(2, 4)) 27 | between <- function(x, left, right) { 28 | data.table::between(x = x, lower = left, upper = right) 29 | } 30 | -------------------------------------------------------------------------------- /R/c_across.R: -------------------------------------------------------------------------------- 1 | #' Combine values from multiple columns 2 | #' 3 | #' @description 4 | #' `c_across()` works inside of `mutate_rowwise()`. It uses tidyselect so 5 | #' you can easily select multiple variables. 6 | #' 7 | #' @param cols Columns to transform. 8 | #' 9 | #' @export 10 | #' 11 | #' @examples 12 | #' df <- data.table(x = runif(6), y = runif(6), z = runif(6)) 13 | #' 14 | #' df %>% 15 | #' mutate_rowwise(row_mean = mean(c_across(x:z))) 16 | c_across <- function(cols = everything()) { 17 | abort("c_across() can only be used inside of tidytable verbs") 18 | } 19 | 20 | -------------------------------------------------------------------------------- /R/case_match.R: -------------------------------------------------------------------------------- 1 | #' Vectorized `switch()` 2 | #' 3 | #' @description 4 | #' Allows the user to succinctly create a new vector based off conditions of a single vector. 5 | #' 6 | #' @param .x A vector 7 | #' @param ... A sequence of two-sided formulas. The left hand side gives the old values, 8 | #' the right hand side gives the new value. 9 | #' @param .default The default value if all conditions evaluate to `FALSE`. 10 | #' @param .ptype Optional ptype to specify the output type. 11 | #' 12 | #' @export 13 | #' 14 | #' @examples 15 | #' df <- tidytable(x = c("a", "b", "c", "d")) 16 | #' 17 | #' df %>% 18 | #' mutate( 19 | #' case_x = case_match(x, 20 | #' c("a", "b") ~ "new_1", 21 | #' "c" ~ "new_2", 22 | #' .default = x) 23 | #' ) 24 | case_match <- function(.x, ..., .default = NA, .ptype = NULL) { 25 | .x <- enquo(.x) 26 | dots <- list2(...) 27 | dots <- map(dots, prep_case_match_dot, .x) 28 | case_when(!!!dots, .default = .default, .ptype = .ptype) 29 | } 30 | 31 | prep_case_match_dot <- function(dot, .x) { 32 | lhs <- f_lhs(dot) 33 | if (is.character(lhs) || is.numeric(lhs)) { 34 | lhs <- call2("==", .x, lhs) 35 | } else { 36 | lhs <- call2("%in%", .x, lhs, .ns = "tidytable") 37 | } 38 | f_lhs(dot) <- lhs 39 | dot 40 | } 41 | -------------------------------------------------------------------------------- /R/coalesce.R: -------------------------------------------------------------------------------- 1 | #' Coalesce missing values 2 | #' 3 | #' @description 4 | #' Fill in missing values in a vector by pulling successively from other vectors. 5 | #' 6 | #' @param ... Input vectors. Supports dynamic dots. 7 | #' @param .ptype Optional ptype to override output type 8 | #' @param .size Optional size to override output size 9 | #' 10 | #' @export 11 | #' 12 | #' @examples 13 | #' # Use a single value to replace all missing values 14 | #' x <- c(1:3, NA, NA) 15 | #' coalesce(x, 0) 16 | #' 17 | #' # Or match together a complete vector from missing pieces 18 | #' y <- c(1, 2, NA, NA, 5) 19 | #' z <- c(NA, NA, 3, 4, 5) 20 | #' coalesce(y, z) 21 | #' 22 | #' # Supply lists with dynamic dots 23 | #' vecs <- list( 24 | #' c(1, 2, NA, NA, 5), 25 | #' c(NA, NA, 3, 4, 5) 26 | #' ) 27 | #' coalesce(!!!vecs) 28 | coalesce <- function(..., .ptype = NULL, .size = NULL) { 29 | args <- vec_cast_common(..., .to = .ptype) 30 | 31 | out <- do.call(fcoalesce, args) 32 | 33 | if (!is.null(.size)) { 34 | out <- vec_recycle(out, .size) 35 | } 36 | 37 | out 38 | } 39 | 40 | -------------------------------------------------------------------------------- /R/consecutive_id.R: -------------------------------------------------------------------------------- 1 | #' Generate a unique id for consecutive values 2 | #' 3 | #' @description 4 | #' Generate a unique id for runs of consecutive values 5 | #' 6 | #' @param ... Vectors of values 7 | #' 8 | #' @export 9 | #' 10 | #' @examples 11 | #' x <- c(1, 1, 2, 2, 1, 1) 12 | #' consecutive_id(x) 13 | consecutive_id <- function(...) { 14 | check_dots_unnamed() 15 | 16 | data <- data_frame(..., .name_repair = "minimal") 17 | 18 | rleidv(data) 19 | } 20 | 21 | -------------------------------------------------------------------------------- /R/crossing.R: -------------------------------------------------------------------------------- 1 | #' Create a data.table from all unique combinations of inputs 2 | #' 3 | #' @description 4 | #' `crossing()` is similar to `expand_grid()` but de-duplicates and sorts its inputs. 5 | #' 6 | #' @param ... Variables to get unique combinations of 7 | #' @param .name_repair Treatment of problematic names. See `?vctrs::vec_as_names` for options/details 8 | #' 9 | #' @export 10 | #' 11 | #' @examples 12 | #' x <- 1:2 13 | #' y <- 1:2 14 | #' 15 | #' crossing(x, y) 16 | #' 17 | #' crossing(stuff = x, y) 18 | crossing <- function(..., .name_repair = "check_unique") { 19 | dots <- dots_list(..., .named = TRUE) 20 | dots <- map(dots, sort_unique) 21 | 22 | expand_grid(!!!dots, .name_repair = .name_repair) 23 | } 24 | 25 | sort_unique <- function(x) { 26 | if (is.factor(x)) { 27 | factor(levels(x), levels(x), exclude = NULL, ordered = is.ordered(x)) 28 | } else if (is_bare_list(x)) { 29 | vec_unique(x) 30 | } else if (is.data.frame(x)) { 31 | setorderv(unique(as_tidytable(x)))[] 32 | } else { 33 | f_sort(vec_unique(x)) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /R/desc.R: -------------------------------------------------------------------------------- 1 | #' Descending order 2 | #' 3 | #' @description 4 | #' Arrange in descending order. Can be used inside of `arrange()` 5 | #' 6 | #' @param x Variable to arrange in descending order 7 | #' 8 | #' @export 9 | #' 10 | #' @examples 11 | #' df <- data.table( 12 | #' a = 1:3, 13 | #' b = 4:6, 14 | #' c = c("a", "a", "b") 15 | #' ) 16 | #' 17 | #' df %>% 18 | #' arrange(c, desc(a)) 19 | desc <- function(x) { 20 | -xtfrm(x) 21 | } 22 | 23 | -------------------------------------------------------------------------------- /R/drop_na.R: -------------------------------------------------------------------------------- 1 | #' Drop rows containing missing values 2 | #' 3 | #' @description 4 | #' Drop rows containing missing values 5 | #' 6 | #' @param .df A data.frame or data.table 7 | #' @param ... Optional: A selection of columns. If empty, all variables are selected. 8 | #' `tidyselect` compatible. 9 | #' 10 | #' @export 11 | #' 12 | #' @examples 13 | #' df <- data.table( 14 | #' x = c(1, 2, NA), 15 | #' y = c("a", NA, "b") 16 | #' ) 17 | #' 18 | #' df %>% 19 | #' drop_na() 20 | #' 21 | #' df %>% 22 | #' drop_na(x) 23 | #' 24 | #' df %>% 25 | #' drop_na(where(is.numeric)) 26 | drop_na <- function(.df, ...) { 27 | UseMethod("drop_na") 28 | } 29 | 30 | #' @export 31 | drop_na.tidytable <- function(.df, ...) { 32 | if (missing(...)) { 33 | na.omit(.df) 34 | } else { 35 | cols <- tidyselect_locs(.df, ...) 36 | 37 | na.omit(.df, cols = cols) 38 | } 39 | } 40 | 41 | #' @export 42 | drop_na.data.frame <- function(.df, ...) { 43 | .df <- as_tidytable(.df) 44 | drop_na(.df, ...) 45 | } 46 | 47 | -------------------------------------------------------------------------------- /R/enframe.R: -------------------------------------------------------------------------------- 1 | #' Convert a vector to a data.table/tidytable 2 | #' 3 | #' @description 4 | #' Converts named and unnamed vectors to a data.table/tidytable. 5 | #' 6 | #' @param x A vector 7 | #' @param name Name of the column that stores the names. If `name = NULL`, 8 | #' a one-column tidytable will be returned. 9 | #' @param value Name of the column that stores the values. 10 | #' 11 | #' @export 12 | #' 13 | #' @examples 14 | #' vec <- 1:3 15 | #' names(vec) <- letters[1:3] 16 | #' 17 | #' enframe(vec) 18 | enframe <- function(x, name = "name", value = "value") { 19 | if (is.null(x)) x <- logical() 20 | 21 | if (is.null(value)) abort("`value` can't be NULL") 22 | 23 | if (is.null(name)) { 24 | l <- list(unname(x)) 25 | } else if (is.null(names(x))) { 26 | l <- list(seq_along(x), x) 27 | } else { 28 | l <- list(names(x), unname(x)) 29 | } 30 | 31 | names(l) <- c(name, value) 32 | 33 | new_tidytable(l) 34 | } 35 | -------------------------------------------------------------------------------- /R/expand_grid.R: -------------------------------------------------------------------------------- 1 | #' Create a data.table from all combinations of inputs 2 | #' 3 | #' @description 4 | #' Create a data.table from all combinations of inputs 5 | #' 6 | #' @param ... Variables to get combinations of 7 | #' @param .name_repair Treatment of problematic names. See `?vctrs::vec_as_names` for options/details 8 | #' 9 | #' @export 10 | #' 11 | #' @examples 12 | #' x <- 1:2 13 | #' y <- 1:2 14 | #' 15 | #' expand_grid(x, y) 16 | #' 17 | #' expand_grid(stuff = x, y) 18 | expand_grid <- function(..., .name_repair = "check_unique") { 19 | dots <- dots_list(..., .named = TRUE) 20 | 21 | out <- vec_expand_grid(!!!dots, .name_repair = "minimal") 22 | 23 | unpack(out, .name_repair) 24 | } 25 | 26 | -------------------------------------------------------------------------------- /R/fread-fwrite.R: -------------------------------------------------------------------------------- 1 | #' Read/write files 2 | #' 3 | #' @description 4 | #' `fread()` is a simple wrapper around `data.table::fread()` that returns a tidytable 5 | #' instead of a data.table. 6 | #' 7 | #' @param ... Arguments passed on to `data.table::fread` 8 | #' 9 | #' @export 10 | #' 11 | #' @examples 12 | #' fake_csv <- "A,B 13 | #' 1,2 14 | #' 3,4" 15 | #' 16 | #' fread(fake_csv) 17 | fread <- function(...) { 18 | .df <- data.table::fread(...) 19 | as_tidytable(.df) 20 | } 21 | -------------------------------------------------------------------------------- /R/group_cols.R: -------------------------------------------------------------------------------- 1 | #' Selection helper for grouping columns 2 | #' 3 | #' @description 4 | #' Selection helper for grouping columns 5 | #' 6 | #' @export 7 | #' 8 | #' @examples 9 | #' df <- tidytable( 10 | #' x = c("a", "b", "c"), 11 | #' y = 1:3, 12 | #' z = 1:3 13 | #' ) 14 | #' 15 | #' df %>% 16 | #' group_by(x) %>% 17 | #' select(group_cols(), y) 18 | group_cols <- function() { 19 | all_of(group_vars(peek_data())) 20 | } 21 | -------------------------------------------------------------------------------- /R/if_all-if_any.R: -------------------------------------------------------------------------------- 1 | #' Create conditions on a selection of columns 2 | #' 3 | #' @description 4 | #' Helpers to apply a filter across a selection of columns. 5 | #' 6 | #' @param .cols Selection of columns 7 | #' @param .fns Function to create filter conditions 8 | #' @param ... Other arguments passed to the function 9 | #' 10 | #' @export 11 | #' 12 | #' @examples 13 | #' iris %>% 14 | #' filter(if_any(ends_with("Width"), ~ .x > 4)) 15 | #' 16 | #' iris %>% 17 | #' filter(if_all(ends_with("Width"), ~ .x > 2)) 18 | if_all <- function(.cols = everything(), .fns = NULL, ...) { 19 | abort("if_all() can only work inside of tidytable verbs") 20 | } 21 | 22 | #' @export 23 | #' @rdname if_all 24 | if_any <- function(.cols = everything(), .fns = NULL, ...) { 25 | abort("if_any() can only work inside of tidytable verbs") 26 | } 27 | -------------------------------------------------------------------------------- /R/if_else.R: -------------------------------------------------------------------------------- 1 | #' Fast if_else 2 | #' 3 | #' @description 4 | #' Fast version of `base::ifelse()`. 5 | #' 6 | #' @param condition Conditions to test on 7 | #' @param true Values to return if conditions evaluate to `TRUE` 8 | #' @param false Values to return if conditions evaluate to `FALSE` 9 | #' @param missing Value to return if an element of test is `NA` 10 | #' @inheritParams rlang::args_dots_empty 11 | #' @param ptype Optional ptype to override output type 12 | #' @param size Optional size to override output size 13 | #' 14 | #' @export 15 | #' 16 | #' @examples 17 | #' x <- 1:5 18 | #' if_else(x < 3, 1, 0) 19 | #' 20 | #' # Can also be used inside of mutate() 21 | #' df <- data.table(x = x) 22 | #' 23 | #' df %>% 24 | #' mutate(new_col = if_else(x < 3, 1, 0)) 25 | if_else <- function(condition, true, false, missing = NA, ..., ptype = NULL, size = NULL) { 26 | check_dots_empty0(...) 27 | 28 | args <- vec_cast_common(true = true, false = false, missing = missing, .to = ptype) 29 | 30 | out <- fifelse(condition, args$true, args$false, args$missing) 31 | 32 | if (!is.null(size)) { 33 | out <- vec_recycle(out, size) 34 | } 35 | 36 | out 37 | } 38 | -------------------------------------------------------------------------------- /R/in-notin.R: -------------------------------------------------------------------------------- 1 | #' Fast `%in%` and `%notin%` operators 2 | #' 3 | #' @description 4 | #' Check whether values in a vector are in or not in another vector. 5 | #' 6 | #' Built using `data.table::'%chin%'` and `vctrs::vec_in()` for performance. 7 | #' 8 | #' @param x A vector of values to check if they exist in y 9 | #' @param y A vector of values to check if x values exist in 10 | #' 11 | #' @details 12 | #' Falls back to `base::'%in%'` when x and y don't share a common type. 13 | #' This means that the behaviour of `base::'%in%'` is preserved (e.g. `"1" %in% c(1, 2)` is `TRUE`) 14 | #' but loses the speedup provided by `vctrs::vec_in()`. 15 | #' 16 | #' @export 17 | #' 18 | #' @examples 19 | #' df <- tidytable(x = 1:4, y = 1:4) 20 | #' 21 | #' df %>% 22 | #' filter(x %in% c(2, 4)) 23 | #' 24 | #' df %>% 25 | #' filter(x %notin% c(2, 4)) 26 | #' @rdname in-notin 27 | '%in%' <- function(x, y) { 28 | if (is.character(x) && is.character(y)) { 29 | x %chin% y 30 | } else if (vec_ptype_compatible(x, y)) { 31 | vec_in(x, y) 32 | } else { 33 | # #565/#632 34 | base::'%in%'(x, y) 35 | } 36 | } 37 | 38 | #' @export 39 | #' @rdname in-notin 40 | '%notin%' <- function(x, y) { 41 | !(x %in% y) 42 | } 43 | 44 | 45 | -------------------------------------------------------------------------------- /R/inv_gc.R: -------------------------------------------------------------------------------- 1 | #' Run invisible garbage collection 2 | #' 3 | #' @description 4 | #' Run garbage collection without the `gc()` output. Can also be run in the middle of a long pipe chain. 5 | #' Useful for large datasets or when using parallel processing. 6 | #' 7 | #' @param x Optional. If missing runs `gc()` silently. Else returns the same object unaltered. 8 | #' @export 9 | #' 10 | #' @examples 11 | #' # Can be run with no input 12 | #' inv_gc() 13 | #' 14 | #' df <- tidytable(col1 = 1, col2 = 2) 15 | #' 16 | #' # Or can be used in the middle of a pipe chain (object is unaltered) 17 | #' df %>% 18 | #' filter(col1 < 2, col2 < 4) %>% 19 | #' inv_gc() %>% 20 | #' select(col1) 21 | #' @export 22 | inv_gc <- function(x) { 23 | if(missing(x)) { 24 | invisible(gc()) 25 | } else { 26 | invisible(gc()) 27 | return(x) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /R/is_tidytable.R: -------------------------------------------------------------------------------- 1 | #' Test if the object is a tidytable 2 | #' 3 | #' @description 4 | #' This function returns TRUE for tidytables or subclasses of tidytables, and FALSE for all other objects. 5 | #' 6 | #' @param x An object 7 | #' 8 | #' @export 9 | #' 10 | #' @examples 11 | #' df <- data.frame(x = 1:3, y = 1:3) 12 | #' 13 | #' is_tidytable(df) 14 | #' 15 | #' df <- tidytable(x = 1:3, y = 1:3) 16 | #' 17 | #' is_tidytable(df) 18 | is_tidytable <- function(x) { 19 | inherits(x, "tidytable") 20 | } 21 | -------------------------------------------------------------------------------- /R/lag-lead.R: -------------------------------------------------------------------------------- 1 | #' Get lagging or leading values 2 | #' 3 | #' @description 4 | #' Find the "previous" or "next" values in a vector. 5 | #' Useful for comparing values behind or ahead of the current values. 6 | #' 7 | #' @param x a vector of values 8 | #' @param n a positive integer of length 1, giving the number of positions to lead or lag by 9 | #' @param default value used for non-existent rows. Defaults to NA. 10 | #' 11 | #' @examples 12 | #' x <- 1:5 13 | #' 14 | #' lag(x, 1) 15 | #' lead(x, 1) 16 | #' 17 | #' # Also works inside of `mutate()` 18 | #' df <- tidytable(x = 1:5) 19 | #' 20 | #' df %>% 21 | #' mutate(lag_x = lag(x)) 22 | #' 23 | #' @export 24 | lag <- function(x, n = 1L, default = NA) { 25 | shift(x = x, n = n, fill = default, type = "lag", give.names = FALSE) 26 | } 27 | 28 | #' @export 29 | #' @rdname lag 30 | lead <- function(x, n = 1L, default = NA) { 31 | shift(x = x, n = n, fill = default, type = "lead", give.names = FALSE) 32 | } 33 | 34 | -------------------------------------------------------------------------------- /R/n.R: -------------------------------------------------------------------------------- 1 | #' Number of observations in each group 2 | #' 3 | #' @description 4 | #' Helper function that can be used to find counts by group. 5 | #' 6 | #' Can be used inside `summarize()`, `mutate()`, & `filter()` 7 | #' 8 | #' @export 9 | #' 10 | #' @examples 11 | #' df <- data.table( 12 | #' x = 1:3, 13 | #' y = 4:6, 14 | #' z = c("a","a","b") 15 | #' ) 16 | #' 17 | #' df %>% 18 | #' summarize(count = n(), .by = z) 19 | n <- function() { 20 | abort("n() should only be used inside tidytable verbs") 21 | } 22 | 23 | -------------------------------------------------------------------------------- /R/n_distinct.R: -------------------------------------------------------------------------------- 1 | #' Count the number of unique values in a vector 2 | #' 3 | #' @description 4 | #' This is a faster version of `length(unique(x))` that calls `data.table::uniqueN()`. 5 | #' 6 | #' @param ... vectors of values 7 | #' @param na.rm If `TRUE` missing values don't count 8 | #' 9 | #' @export 10 | #' 11 | #' @examples 12 | #' x <- sample(1:10, 1e5, rep = TRUE) 13 | #' n_distinct(x) 14 | n_distinct <- function(..., na.rm = FALSE) { 15 | dots <- list2(...) 16 | 17 | if (length(dots) == 1) { 18 | x <- dots[[1]] 19 | } else { 20 | x <- new_data_frame(dots) 21 | } 22 | 23 | uniqueN(x, na.rm = na.rm) 24 | } 25 | 26 | -------------------------------------------------------------------------------- /R/na_if.R: -------------------------------------------------------------------------------- 1 | #' Convert values to `NA` 2 | #' 3 | #' @description 4 | #' Convert values to `NA`. 5 | #' 6 | #' @param x A vector 7 | #' @param y Value to replace with `NA` 8 | #' 9 | #' @export 10 | #' 11 | #' @examples 12 | #' vec <- 1:3 13 | #' na_if(vec, 3) 14 | na_if <- function(x, y) { 15 | size <- vec_size(x) 16 | y <- vec_recycle(y, size) 17 | vec_assign(x, x == y, NA) 18 | } 19 | 20 | -------------------------------------------------------------------------------- /R/new_tidytable.R: -------------------------------------------------------------------------------- 1 | #' Create a tidytable from a list 2 | #' 3 | #' @description 4 | #' Create a tidytable from a list 5 | #' 6 | #' @param x A named list of equal-length vectors. The lengths are not checked; it is the responsibility 7 | #' of the caller to make sure they are equal. 8 | #' 9 | #' @export 10 | #' 11 | #' @examples 12 | #' l <- list(x = 1:3, y = c("a", "a", "b")) 13 | #' 14 | #' new_tidytable(l) 15 | new_tidytable <- function(x = list()) { 16 | new_data_frame(x, class = c("tidytable", "tbl", "data.table")) 17 | } 18 | -------------------------------------------------------------------------------- /R/pick.R: -------------------------------------------------------------------------------- 1 | #' Selection version of `across()` 2 | #' 3 | #' @description 4 | #' Select a subset of columns from within functions like `mutate()`, `summarize()`, or `filter()`. 5 | #' 6 | #' @param ... Columns to select. Tidyselect compatible. 7 | #' 8 | #' @export 9 | #' 10 | #' @examples 11 | #' df <- tidytable( 12 | #' x = 1:3, 13 | #' y = 4:6, 14 | #' z = c("a", "a", "b") 15 | #' ) 16 | #' 17 | #' df %>% 18 | #' mutate(row_sum = rowSums(pick(x, y))) 19 | pick <- function(...) { 20 | abort("`pick()` can only work inside of tidytable verbs") 21 | } 22 | -------------------------------------------------------------------------------- /R/print.R: -------------------------------------------------------------------------------- 1 | # tidytable --------------------------- 2 | #' @export 3 | tbl_sum.tidytable <- function(x) { 4 | c("A tidytable" = dim_desc(x)) 5 | } 6 | 7 | #' @export 8 | vec_ptype_abbr.tidytable <- function(x, ..., prefix_named = FALSE, suffix_shape = TRUE) { 9 | "tidytable" 10 | } 11 | 12 | # grouped_tt --------------------------- 13 | #' @export 14 | tbl_sum.grouped_tt <- function(x) { 15 | groups <- glue_collapse(group_vars(x), sep = ", ") 16 | c("A tidytable" = dim_desc(x), "Groups" = groups) 17 | } 18 | 19 | #' @export 20 | vec_ptype_abbr.grouped_tt <- function(x, ..., prefix_named = FALSE, suffix_shape = TRUE) { 21 | "grouped_tt" 22 | } 23 | 24 | # rowwise_tt --------------------------- 25 | #' @export 26 | tbl_sum.rowwise_tt <- function(x) { 27 | c("A rowwise tidytable" = dim_desc(x)) 28 | } 29 | 30 | #' @export 31 | vec_ptype_abbr.rowwise_tt <- function(x, ..., prefix_named = FALSE, suffix_shape = TRUE) { 32 | "rowwise_tt" 33 | } 34 | -------------------------------------------------------------------------------- /R/pull.R: -------------------------------------------------------------------------------- 1 | #' Pull out a single variable 2 | #' 3 | #' @description 4 | #' Pull a single variable from a data.table as a vector. 5 | #' 6 | #' @param .df A data.frame or data.table 7 | #' @param var The column to pull from the data.table as: 8 | #' * a variable name 9 | #' * a positive integer giving the column position 10 | #' * a negative integer giving the column position counting from the right 11 | #' @param name Optional - specifies the column to be used as names for the vector. 12 | #' 13 | #' @export 14 | #' 15 | #' @examples 16 | #' df <- data.table( 17 | #' x = 1:3, 18 | #' y = 1:3 19 | #' ) 20 | #' 21 | #' # Grab column by name 22 | #' df %>% 23 | #' pull(y) 24 | #' 25 | #' # Grab column by position 26 | #' df %>% 27 | #' pull(1) 28 | #' 29 | #' # Defaults to last column 30 | #' df %>% 31 | #' pull() 32 | pull <- function(.df, var = -1, name = NULL) { 33 | vec <- .pull(.df, {{ var }}) 34 | 35 | name <- enquo(name) 36 | if (!quo_is_null(name)) { 37 | names(vec) <- .pull(.df, !!name) 38 | } 39 | 40 | vec 41 | } 42 | 43 | .pull <- function(.df, var) { 44 | vars <- as.list(seq_along(.df)) 45 | 46 | names(vars) <- names(.df) 47 | 48 | var <- eval_tidy(enquo(var), vars) 49 | 50 | if (var < 0) { 51 | var <- length(vars) + var + 1 52 | } 53 | 54 | .df[[var]] 55 | } 56 | -------------------------------------------------------------------------------- /R/reexports.R: -------------------------------------------------------------------------------- 1 | # tidyselect ------------------------ 2 | #' @export 3 | tidyselect::starts_with 4 | 5 | #' @export 6 | tidyselect::contains 7 | 8 | #' @export 9 | tidyselect::ends_with 10 | 11 | #' @export 12 | tidyselect::everything 13 | 14 | #' @export 15 | tidyselect::any_of 16 | 17 | #' @export 18 | tidyselect::all_of 19 | 20 | #' @export 21 | tidyselect::matches 22 | 23 | #' @export 24 | tidyselect::num_range 25 | 26 | #' @export 27 | tidyselect::last_col 28 | 29 | #' @export 30 | tidyselect::where 31 | 32 | # data.table ------------------------ 33 | #' @export 34 | data.table::data.table 35 | 36 | #' @export 37 | data.table::fwrite 38 | 39 | #' @export 40 | data.table::getDTthreads 41 | 42 | #' @export 43 | data.table::setDTthreads 44 | 45 | #' @export 46 | data.table::`%between%` 47 | 48 | #' @export 49 | data.table::`%like%` 50 | 51 | #' @export 52 | data.table::`%chin%` 53 | 54 | # rlang ------------------------ 55 | #' @export 56 | rlang::enexpr 57 | 58 | #' @export 59 | rlang::enexprs 60 | 61 | #' @export 62 | rlang::enquo 63 | 64 | #' @export 65 | rlang::enquos 66 | 67 | #' @export 68 | rlang::expr 69 | 70 | #' @export 71 | rlang::exprs 72 | 73 | #' @export 74 | rlang::quo 75 | 76 | #' @export 77 | rlang::quos 78 | 79 | #' @export 80 | rlang::sym 81 | 82 | #' @export 83 | rlang::syms 84 | 85 | # pillar ------------------------ 86 | #' @export 87 | pillar::glimpse 88 | -------------------------------------------------------------------------------- /R/reframe.R: -------------------------------------------------------------------------------- 1 | #' Reframe a data frame 2 | #' 3 | #' @description 4 | #' Reframe a data frame. Note this is a simple alias for `summarize()` 5 | #' that always returns an ungrouped tidytable. 6 | #' 7 | #' @param .df A data.frame or data.table 8 | #' @param ... Aggregations to perform 9 | #' @param .by Columns to group by 10 | #' 11 | #' @export 12 | #' @examples 13 | #' mtcars %>% 14 | #' reframe(qs = quantile(disp, c(0.25, 0.75)), 15 | #' prob = c(0.25, 0.75), 16 | #' .by = cyl) 17 | reframe <- function(.df, ..., .by = NULL) { 18 | out <- summarize(.df, ..., .by = {{ .by }}, .sort = FALSE) 19 | ungroup(out) 20 | } 21 | -------------------------------------------------------------------------------- /R/rename.R: -------------------------------------------------------------------------------- 1 | #' Rename variables by name 2 | #' 3 | #' @description 4 | #' Rename variables from a data.table. 5 | #' 6 | #' @param .df A data.frame or data.table 7 | #' @param ... `new_name = old_name` pairs to rename columns 8 | #' 9 | #' @export 10 | #' 11 | #' @examples 12 | #' df <- data.table(x = 1:3, y = 4:6) 13 | #' 14 | #' df %>% 15 | #' rename(new_x = x, 16 | #' new_y = y) 17 | rename <- function(.df, ...) { 18 | UseMethod("rename") 19 | } 20 | 21 | #' @export 22 | rename.tidytable <- function(.df, ...) { 23 | .rename(.df, ...) 24 | } 25 | 26 | #' @export 27 | rename.grouped_tt <- function(.df, ...) { 28 | # Ensure "groups" attribute has new names 29 | groups <- group_vars(.df) 30 | groups <- select(.df, all_of(groups)) 31 | groups <- names(.rename(groups, ..., .strict = FALSE)) 32 | 33 | out <- ungroup(.df) 34 | out <- rename(out, ...) 35 | 36 | group_by(out, all_of(groups)) 37 | } 38 | 39 | #' @export 40 | rename.data.frame <- function(.df, ...) { 41 | .df <- as_tidytable(.df) 42 | rename(.df, ...) 43 | } 44 | 45 | .rename <- function(.df, ..., .strict = TRUE) { 46 | locs <- eval_rename(expr(c(...)), .df, strict = .strict) 47 | 48 | names <- names(.df) 49 | names[locs] <- names(locs) 50 | 51 | set_col_names(.df, names) 52 | } 53 | 54 | -------------------------------------------------------------------------------- /R/rowwise.R: -------------------------------------------------------------------------------- 1 | #' Convert to a rowwise tidytable 2 | #' 3 | #' @description 4 | #' Convert to a rowwise tidytable. 5 | #' 6 | #' @param .df A data.frame or data.table 7 | #' 8 | #' @export 9 | #' 10 | #' @examples 11 | #' df <- tidytable(x = 1:3, y = 1:3 * 2, z = 1:3 * 3) 12 | #' 13 | #' # Compute the mean of x, y, z in each row 14 | #' df %>% 15 | #' rowwise() %>% 16 | #' mutate(row_mean = mean(c(x, y, z))) 17 | #' 18 | #' # Use c_across() to more easily select many variables 19 | #' df %>% 20 | #' rowwise() %>% 21 | #' mutate(row_mean = mean(c_across(x:z))) %>% 22 | #' ungroup() 23 | rowwise <- function(.df) { 24 | UseMethod("rowwise") 25 | } 26 | 27 | #' @export 28 | rowwise.tidytable <- function(.df) { 29 | set_class(.df, c("rowwise_tt", tidytable_class())) 30 | } 31 | 32 | #' @export 33 | rowwise.grouped_tt <- function(.df) { 34 | .df <- ungroup(.df) 35 | rowwise(.df) 36 | } 37 | 38 | #' @export 39 | rowwise.rowwise_tt <- function(.df) { 40 | .df 41 | } 42 | 43 | #' @export 44 | rowwise.data.frame <- function(.df) { 45 | .df <- as_tidytable(.df) 46 | rowwise(.df) 47 | } 48 | 49 | -------------------------------------------------------------------------------- /R/separate_longer_delim.R: -------------------------------------------------------------------------------- 1 | #' Split a string into rows 2 | #' 3 | #' @description 4 | #' If a column contains observations with multiple delimited values, separate 5 | #' them each into their own row. 6 | #' 7 | #' @param .df A data.frame or data.table 8 | #' @param cols Columns to separate 9 | #' @param delim Separator delimiting collapsed values 10 | #' @inheritParams rlang::args_dots_empty 11 | #' 12 | #' @export 13 | #' 14 | #' @examples 15 | #' df <- data.table( 16 | #' x = 1:3, 17 | #' y = c("a", "d,e,f", "g,h"), 18 | #' z = c("1", "2,3,4", "5,6") 19 | #' ) 20 | #' 21 | #' df %>% 22 | #' separate_longer_delim(c(y, z), ",") 23 | separate_longer_delim <- function(.df, cols, delim, ...) { 24 | separate_rows(.df, {{ cols }}, sep = delim) 25 | } 26 | -------------------------------------------------------------------------------- /R/standalone-zeallot.R: -------------------------------------------------------------------------------- 1 | # --- 2 | # repo: r-lib/rlang 3 | # file: standalone-zeallot.R 4 | # last-updated: 2020-11-24 5 | # license: https://unlicense.org 6 | # --- 7 | # 8 | # This drop-in file implements a simple version of zeallot::`%<-%`. 9 | # 10 | # nocov start 11 | 12 | `%<-%` <- function(lhs, value) { 13 | lhs <- substitute(lhs) 14 | env <- caller_env() 15 | 16 | if (!is_call(lhs, "c")) { 17 | abort("The left-hand side of `%<-%` must be a call to `c()`.") 18 | } 19 | 20 | vars <- as.list(lhs[-1]) 21 | 22 | if (length(value) != length(vars)) { 23 | abort("The left- and right-hand sides of `%<-%` must be the same length.") 24 | } 25 | 26 | for (i in seq_along(vars)) { 27 | var <- vars[[i]] 28 | if (!is_symbol(var)) { 29 | abort(paste0("Element ", i, " of the left-hand side of `%<-%` must be a symbol.")) 30 | } 31 | 32 | env[[as_string(var)]] <- value[[i]] 33 | } 34 | 35 | invisible(value) 36 | } 37 | 38 | 39 | # nocov end 40 | -------------------------------------------------------------------------------- /R/tidytable-package.R: -------------------------------------------------------------------------------- 1 | # Suppress R CMD check note 2 | #' @import tidyselect 3 | #' @import vctrs 4 | #' @rawNamespace import(data.table, except = c(between, fread)) 5 | #' @rawNamespace import(rlang, except = `:=`) 6 | #' @importFrom glue glue glue_data glue_collapse 7 | #' @importFrom lifecycle deprecate_soft 8 | #' @importFrom magrittr set_attr set_class 9 | #' @importFrom pillar glimpse dim_desc tbl_sum 10 | #' @importFrom stats na.omit 11 | #' @importFrom utils head tail type.convert 12 | NULL 13 | 14 | #' @docType import 15 | -------------------------------------------------------------------------------- /R/tidytable.R: -------------------------------------------------------------------------------- 1 | #' Build a data.table/tidytable 2 | #' 3 | #' @description 4 | #' Constructs a data.table, but one with nice printing features. 5 | #' 6 | #' @param ... A set of name-value pairs 7 | #' @param .name_repair Treatment of duplicate names. See `?vctrs::vec_as_names` for options/details. 8 | #' 9 | #' @export 10 | #' 11 | #' @examples 12 | #' tidytable(x = 1:3, y = c("a", "a", "b")) 13 | tidytable <- function(..., .name_repair = "unique") { 14 | if (missing(...)) { 15 | new_tidytable() 16 | } else { 17 | dots <- dots_list(..., .named = TRUE) 18 | dots <- map(dots, eval_tidy) 19 | unpack(dots, .name_repair) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /R/top_n.R: -------------------------------------------------------------------------------- 1 | #' Select top (or bottom) n rows (by value) 2 | #' 3 | #' @description 4 | #' Select the top or bottom entries in each group, ordered by `wt`. 5 | #' 6 | #' @param .df A data.frame or data.table 7 | #' @param n Number of rows to return 8 | #' @param wt Optional. The variable to use for ordering. If NULL uses the last column in the data.table. 9 | #' @param .by Columns to group by 10 | #' 11 | #' @export 12 | #' 13 | #' @examples 14 | #' df <- data.table( 15 | #' x = 1:5, 16 | #' y = 6:10, 17 | #' z = c(rep("a", 3), rep("b", 2)) 18 | #' ) 19 | #' 20 | #' df %>% 21 | #' top_n(2, wt = y) 22 | #' 23 | #' df %>% 24 | #' top_n(2, wt = y, .by = z) 25 | top_n <- function(.df, n = 5, wt = NULL, .by = NULL) { 26 | UseMethod("top_n") 27 | } 28 | 29 | #' @export 30 | top_n.tidytable <- function(.df, n = 5, wt = NULL, .by = NULL) { 31 | wt <- enquo(wt) 32 | 33 | if (quo_is_null(wt)) { 34 | slice_head(.df, {{ n }}, .by = {{ .by }}) 35 | } else { 36 | slice_max(.df, order_by = !!wt, {{ n }}, .by = {{ .by }}) 37 | } 38 | } 39 | 40 | #' @export 41 | top_n.data.frame <- function(.df, n = 5, wt = NULL, .by = NULL) { 42 | .df <- as_tidytable(.df) 43 | top_n(.df, {{ n }}, {{ wt }}, .by = {{ .by }}) 44 | } 45 | 46 | -------------------------------------------------------------------------------- /R/transmute.R: -------------------------------------------------------------------------------- 1 | #' Add new variables and drop all others 2 | #' 3 | #' @description 4 | #' Unlike `mutate()`, `transmute()` keeps only the variables that you create 5 | #' 6 | #' @param .df A data.frame or data.table 7 | #' @param ... Columns to create/modify 8 | #' @param .by Columns to group by 9 | #' 10 | #' @export 11 | #' 12 | #' @examples 13 | #' df <- data.table( 14 | #' a = 1:3, 15 | #' b = 4:6, 16 | #' c = c("a", "a", "b") 17 | #' ) 18 | #' 19 | #' df %>% 20 | #' transmute(double_a = a * 2) 21 | transmute <- function(.df, ..., .by = NULL) { 22 | mutate(.df, ..., .by = {{ .by }}, .keep = "none") 23 | } 24 | 25 | -------------------------------------------------------------------------------- /R/tribble.R: -------------------------------------------------------------------------------- 1 | #' Rowwise tidytable creation 2 | #' 3 | #' @description 4 | #' Create a tidytable using a rowwise setup. 5 | #' 6 | #' @param ... Column names as formulas, values below. See example. 7 | #' @export 8 | #' 9 | #' @examples 10 | #' tribble( 11 | #' ~ x, ~ y, 12 | #' "a", 1, 13 | #' "b", 2, 14 | #' "c", 3 15 | #' ) 16 | tribble <- function(...) { 17 | dots <- list2(...) 18 | is_name <- map_lgl(dots, is_bare_formula) 19 | col_names <- map(dots[is_name], ~ as_name(f_rhs(.x))) 20 | num_cols <- length(col_names) 21 | dots <- dots[!is_name] 22 | dots_length <- length(dots) 23 | l <- vector("list", num_cols) 24 | l <- set_names(l, col_names) 25 | for (i in seq_len(num_cols)) { 26 | locs <- seq(i, dots_length, num_cols) 27 | l[[i]] <- vec_c(!!!dots[locs]) 28 | } 29 | new_tidytable(l) 30 | } 31 | -------------------------------------------------------------------------------- /R/uncount.R: -------------------------------------------------------------------------------- 1 | #' Uncount a data.table 2 | #' 3 | #' @param .df A data.frame or data.table 4 | #' @param weights A column containing the weights to uncount by 5 | #' @param .remove If TRUE removes the selected `weights` column 6 | #' @param .id A string name for a new column containing a unique identifier for the newly uncounted rows. 7 | #' 8 | #' @export 9 | #' 10 | #' @examples 11 | #' df <- data.table(x = c("a", "b"), n = c(1, 2)) 12 | #' 13 | #' uncount(df, n) 14 | #' 15 | #' uncount(df, n, .id = "id") 16 | uncount <- function(.df, weights, .remove = TRUE, .id = NULL) { 17 | UseMethod("uncount") 18 | } 19 | 20 | #' @export 21 | uncount.tidytable <- function(.df, weights, .remove = TRUE, .id = NULL) { 22 | weights <- enquo(weights) 23 | 24 | .reps <- pull(.df, !!weights) 25 | 26 | out <- vec_rep_each(.df, .reps) 27 | 28 | if (!is.null(.id)) { 29 | out <- dt_j(out, !!.id := sequence(.reps)) 30 | } 31 | 32 | if (.remove) { 33 | out <- dt_j(out, !!weights := NULL) 34 | } 35 | 36 | out 37 | } 38 | 39 | #' @export 40 | uncount.data.frame <- function(.df, weights, .remove = TRUE, .id = NULL) { 41 | .df <- as_tidytable(.df) 42 | uncount(.df, {{ weights }}, .remove, .id) 43 | } 44 | 45 | -------------------------------------------------------------------------------- /R/utils-fast_copy.R: -------------------------------------------------------------------------------- 1 | # Fast copying 2 | # Deep copy of columns that are being overwritten. 3 | # Only does a shallow copy of the other columns. 4 | # Faster than running `copy()` on an entire data frame. 5 | fast_copy <- function(x, cols = character()) { 6 | if (length(cols) == 0) { 7 | return(shallow(x)) 8 | } 9 | 10 | needs_copy <- names(x) %in% cols 11 | 12 | if (any(needs_copy)) { 13 | out <- as.list(x) 14 | out[needs_copy] <- copy(out[needs_copy]) 15 | out <- new_tidytable(out) 16 | out <- tidytable_restore(out, x) 17 | } else { 18 | out <- x 19 | } 20 | 21 | shallow(out) 22 | } 23 | 24 | # Creates a shallow copy 25 | # Can add new columns or rename columns without modify-by-reference 26 | shallow <- function(x) { 27 | x[TRUE] 28 | } 29 | 30 | -------------------------------------------------------------------------------- /R/utils-pipe.R: -------------------------------------------------------------------------------- 1 | #' Pipe operator 2 | #' 3 | #' See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details. 4 | #' 5 | #' @name %>% 6 | #' @rdname pipe 7 | #' @keywords internal 8 | #' @export 9 | #' @importFrom magrittr %>% 10 | #' @usage lhs \%>\% rhs 11 | NULL 12 | -------------------------------------------------------------------------------- /R/utils-tidyselect.R: -------------------------------------------------------------------------------- 1 | # _locs: Get column locations (as an integer vector) 2 | # _names: Get column names (as a character vector) 3 | # _syms: Get column names (as a list of symbols) 4 | 5 | tidyselect_locs <- function(.df, ..., .allow_rename = TRUE) { 6 | eval_select(expr(c(...)), .df, allow_rename = .allow_rename) 7 | } 8 | 9 | tidyselect_names <- function(.df, ..., .allow_rename = TRUE) { 10 | names(tidyselect_locs(.df, ..., .allow_rename = .allow_rename)) 11 | } 12 | 13 | tidyselect_syms <- function(.df, ..., .allow_rename = TRUE) { 14 | syms(tidyselect_names(.df, ..., .allow_rename = .allow_rename)) 15 | } 16 | -------------------------------------------------------------------------------- /R/zzz.R: -------------------------------------------------------------------------------- 1 | .onAttach <- function(...) { 2 | if (vctrs::vec_in("dplyr", .packages())) { 3 | .fn <- "dplyr" 4 | .load_msg <- glue::glue( 5 | "Warning: tidytable was loaded after {.fn}. 6 | This can lead to most {.fn} functions being overwritten by tidytable functions." 7 | ) 8 | packageStartupMessage(.load_msg) 9 | } 10 | if (vctrs::vec_in("tidyr", .packages())) { 11 | .fn <- "tidyr" 12 | .load_msg <- glue::glue( 13 | "Warning: tidytable was loaded after {.fn}. 14 | This can lead to most {.fn} functions being overwritten by tidytable functions." 15 | ) 16 | packageStartupMessage(.load_msg) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /cran-comments.md: -------------------------------------------------------------------------------- 1 | ## Test environments 2 | * local macOS Ventura install, R 4.3.1 3 | * win-builder (devel and release) 4 | 5 | ## R CMD check results 6 | 7 | 0 errors | 0 warnings | 0 notes 8 | 9 | ## revdepcheck results 10 | 11 | We checked 8 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. 12 | 13 | * We saw 0 new problems 14 | 15 | -------------------------------------------------------------------------------- /docs/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/docs/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/docs/apple-touch-icon-152x152.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/docs/apple-touch-icon-180x180.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/docs/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/docs/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /docs/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/docs/apple-touch-icon.png -------------------------------------------------------------------------------- /docs/articles/speed_comparisons_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/speed_comparisons_files/anchor-sections-1.0/anchor-sections.css: -------------------------------------------------------------------------------- 1 | /* Styles for section anchors */ 2 | a.anchor-section {margin-left: 10px; visibility: hidden; color: inherit;} 3 | a.anchor-section::before {content: '#';} 4 | .hasAnchor:hover a.anchor-section {visibility: visible;} 5 | -------------------------------------------------------------------------------- /docs/articles/speed_comparisons_files/anchor-sections-1.0/anchor-sections.js: -------------------------------------------------------------------------------- 1 | // Anchor sections v1.0 written by Atsushi Yasumoto on Oct 3rd, 2020. 2 | document.addEventListener('DOMContentLoaded', function() { 3 | // Do nothing if AnchorJS is used 4 | if (typeof window.anchors === 'object' && anchors.hasOwnProperty('hasAnchorJSLink')) { 5 | return; 6 | } 7 | 8 | const h = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); 9 | 10 | // Do nothing if sections are already anchored 11 | if (Array.from(h).some(x => x.classList.contains('hasAnchor'))) { 12 | return null; 13 | } 14 | 15 | // Use section id when pandoc runs with --section-divs 16 | const section_id = function(x) { 17 | return ((x.classList.contains('section') || (x.tagName === 'SECTION')) 18 | ? x.id : ''); 19 | }; 20 | 21 | // Add anchors 22 | h.forEach(function(x) { 23 | const id = x.id || section_id(x.parentElement); 24 | if (id === '') { 25 | return null; 26 | } 27 | let anchor = document.createElement('a'); 28 | anchor.href = '#' + id; 29 | anchor.classList = ['anchor-section']; 30 | x.classList.add('hasAnchor'); 31 | x.appendChild(anchor); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /docs/articles/speed_comparisons_files/header-attrs-2.10/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/speed_comparisons_files/header-attrs-2.3/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/speed_comparisons_files/header-attrs-2.4/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/speed_comparisons_files/header-attrs-2.5/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/speed_comparisons_files/header-attrs-2.6/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/speed_comparisons_files/header-attrs-2.7/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/speed_comparisons_files/header-attrs-2.8/header-attrs 2.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/speed_comparisons_files/header-attrs-2.8/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/speed_comparisons_files/header-attrs-2.9/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/extra.css: -------------------------------------------------------------------------------- 1 | #logo { 2 | background-color: white; 3 | } 4 | /* 5 | .navbar { 6 | box-shadow: 0 1px 8px rgba(0,0,0,0.3) !important; 7 | } 8 | 9 | .label-default { 10 | color : #9c0000; 11 | font-weight: 400; 12 | font-size: 50%; 13 | padding: 0px; 14 | background-color: #fff; 15 | } 16 | .navbar-default .navbar-link{ 17 | font-weight: 700; 18 | } 19 | .fa{ 20 | -moz-transition:color .3s ease-in; 21 | -o-transition:color .3s ease-in; 22 | -webkit-transition:color .3s ease-in; 23 | transition : color .3s ease-in; 24 | } 25 | a:hover > .fa-linkedin{ 26 | color : #0073b1!important; 27 | } 28 | 29 | h1, .h1 { 30 | font-size: 36px; 31 | } 32 | h2, .h2 { 33 | font-size: 32px; 34 | } 35 | h3, .h3 { 36 | font-size: 28px; 37 | } 38 | body{ 39 | font-size: 16px; 40 | } 41 | code span, pre span{ 42 | font-size: 13px; 43 | } 44 | code a, pre a { 45 | white-space: nowrap; 46 | } 47 | #logo { 48 | background-color: white; 49 | } 50 | /*h1, .h1, h1 > code, .h1>code, 51 | h2, .h2, h2 > code, .h2>code, 52 | h3, .h3, h3 > code, .h3>code, 53 | h4, .h4, h4 > code, .h4>code, 54 | h5, .h5, h5 > code, .h5>code, 55 | h6, .h6, h6 > code, .h6>code { 56 | color: #9c0000; 57 | col 58 | } 59 | h4, .h4 { 60 | font-size: 56px; 61 | } 62 | h5, .h5 { 63 | font-size: 56px; 64 | } 65 | h6, .h6 { 66 | font-size: 56px; 67 | }*/ 68 | -------------------------------------------------------------------------------- /docs/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/docs/favicon-16x16.png -------------------------------------------------------------------------------- /docs/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/docs/favicon-32x32.png -------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/docs/favicon.ico -------------------------------------------------------------------------------- /docs/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /docs/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/docs/logo.png -------------------------------------------------------------------------------- /docs/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: 3.1.1 2 | pkgdown: 2.1.1 3 | pkgdown_sha: ~ 4 | articles: 5 | speed_comparisons: speed_comparisons.html 6 | last_built: 2024-12-10T14:52Z 7 | -------------------------------------------------------------------------------- /docs/reference/Rplot001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/docs/reference/Rplot001.png -------------------------------------------------------------------------------- /docs/reference/figures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/docs/reference/figures/logo.png -------------------------------------------------------------------------------- /man/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/man/.DS_Store -------------------------------------------------------------------------------- /man/across.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/across.R 3 | \name{across} 4 | \alias{across} 5 | \title{Apply a function across a selection of columns} 6 | \usage{ 7 | across(.cols = everything(), .fns = NULL, ..., .names = NULL) 8 | } 9 | \arguments{ 10 | \item{.cols}{vector \code{c()} of unquoted column names. \code{tidyselect} compatible.} 11 | 12 | \item{.fns}{Function to apply. Can be a purrr-style lambda. 13 | Can pass also list of functions.} 14 | 15 | \item{...}{Other arguments for the passed function} 16 | 17 | \item{.names}{A glue specification that helps with renaming output columns. 18 | \code{{.col}} stands for the selected column, and \code{{.fn}} stands for the name of the function being applied. 19 | The default (\code{NULL}) is equivalent to \code{"{.col}"} for a single function case and \code{"{.col}_{.fn}"} 20 | when a list is used for \code{.fns}.} 21 | } 22 | \description{ 23 | Apply a function across a selection of columns. For use in \code{arrange()}, 24 | \code{mutate()}, and \code{summarize()}. 25 | } 26 | \examples{ 27 | df <- data.table( 28 | x = rep(1, 3), 29 | y = rep(2, 3), 30 | z = c("a", "a", "b") 31 | ) 32 | 33 | df \%>\% 34 | mutate(across(c(x, y), ~ .x * 2)) 35 | 36 | df \%>\% 37 | summarize(across(where(is.numeric), ~ mean(.x)), 38 | .by = z) 39 | 40 | df \%>\% 41 | arrange(across(c(y, z))) 42 | } 43 | -------------------------------------------------------------------------------- /man/add_count.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/add_count.R 3 | \name{add_count} 4 | \alias{add_count} 5 | \alias{add_tally} 6 | \title{Add a count column to the data frame} 7 | \usage{ 8 | add_count(.df, ..., wt = NULL, sort = FALSE, name = NULL) 9 | 10 | add_tally(.df, wt = NULL, sort = FALSE, name = NULL) 11 | } 12 | \arguments{ 13 | \item{.df}{A data.frame or data.table} 14 | 15 | \item{...}{Columns to group by. \code{tidyselect} compatible.} 16 | 17 | \item{wt}{Frequency weights. 18 | Can be \code{NULL} or a variable: 19 | \itemize{ 20 | \item If \code{NULL} (the default), counts the number of rows in each group. 21 | \item If a variable, computes \code{sum(wt)} for each group. 22 | }} 23 | 24 | \item{sort}{If \code{TRUE}, will show the largest groups at the top.} 25 | 26 | \item{name}{The name of the new column in the output. 27 | 28 | If omitted, it will default to \code{n}.} 29 | } 30 | \description{ 31 | Add a count column to the data frame. 32 | 33 | \code{df \%>\% add_count(a, b)} is equivalent to using \code{df \%>\% mutate(n = n(), .by = c(a, b))} 34 | } 35 | \examples{ 36 | df <- data.table( 37 | a = c("a", "a", "b"), 38 | b = 1:3 39 | ) 40 | 41 | df \%>\% 42 | add_count(a) 43 | } 44 | -------------------------------------------------------------------------------- /man/arrange.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/arrange.R 3 | \name{arrange} 4 | \alias{arrange} 5 | \title{Arrange/reorder rows} 6 | \usage{ 7 | arrange(.df, ...) 8 | } 9 | \arguments{ 10 | \item{.df}{A data.frame or data.table} 11 | 12 | \item{...}{Variables to arrange by} 13 | } 14 | \description{ 15 | Order rows in ascending or descending order. 16 | } 17 | \examples{ 18 | df <- data.table( 19 | a = 1:3, 20 | b = 4:6, 21 | c = c("a", "a", "b") 22 | ) 23 | 24 | df \%>\% 25 | arrange(c, -a) 26 | 27 | df \%>\% 28 | arrange(c, desc(a)) 29 | } 30 | -------------------------------------------------------------------------------- /man/as_tidytable.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/as_tidytable.R 3 | \name{as_tidytable} 4 | \alias{as_tidytable} 5 | \title{Coerce an object to a data.table/tidytable} 6 | \usage{ 7 | as_tidytable(x, ..., .name_repair = "unique", .keep_rownames = FALSE) 8 | } 9 | \arguments{ 10 | \item{x}{An R object} 11 | 12 | \item{...}{Additional arguments to be passed to or from other methods.} 13 | 14 | \item{.name_repair}{Treatment of duplicate names. See \code{?vctrs::vec_as_names} for options/details.} 15 | 16 | \item{.keep_rownames}{Default is \code{FALSE}. If \code{TRUE}, adds the input object's names as a separate 17 | column named \code{"rn"}. \code{.keep_rownames = "id"} names the column "id" instead.} 18 | } 19 | \description{ 20 | A tidytable object is simply a data.table with nice printing features. 21 | 22 | Note that all tidytable functions automatically convert data.frames & data.tables to tidytables in the background. 23 | As such this function will rarely need to be used by the user. 24 | } 25 | \examples{ 26 | df <- data.frame(x = -2:2, y = c(rep("a", 3), rep("b", 2))) 27 | 28 | df \%>\% 29 | as_tidytable() 30 | } 31 | -------------------------------------------------------------------------------- /man/between.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/between.R 3 | \name{between} 4 | \alias{between} 5 | \title{Do the values from x fall between the left and right bounds?} 6 | \usage{ 7 | between(x, left, right) 8 | } 9 | \arguments{ 10 | \item{x}{A numeric vector} 11 | 12 | \item{left, right}{Boundary values} 13 | } 14 | \description{ 15 | \code{between()} utilizes \code{data.table::between()} in the background 16 | } 17 | \examples{ 18 | df <- data.table( 19 | x = 1:5, 20 | y = 1:5 21 | ) 22 | 23 | # Typically used in a filter() 24 | df \%>\% 25 | filter(between(x, 2, 4)) 26 | 27 | df \%>\% 28 | filter(x \%>\% between(2, 4)) 29 | 30 | # Can also use the \%between\% operator 31 | df \%>\% 32 | filter(x \%between\% c(2, 4)) 33 | } 34 | -------------------------------------------------------------------------------- /man/bind_cols.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/bind.R 3 | \name{bind_cols} 4 | \alias{bind_cols} 5 | \alias{bind_rows} 6 | \title{Bind data.tables by row and column} 7 | \usage{ 8 | bind_cols(..., .name_repair = "unique") 9 | 10 | bind_rows(..., .id = NULL) 11 | } 12 | \arguments{ 13 | \item{...}{data.tables or data.frames to bind} 14 | 15 | \item{.name_repair}{Treatment of duplicate names. See \code{?vctrs::vec_as_names} for options/details.} 16 | 17 | \item{.id}{If TRUE, an integer column is made as a group id} 18 | } 19 | \description{ 20 | Bind multiple data.tables into one row-wise or col-wise. 21 | } 22 | \examples{ 23 | # Binding data together by row 24 | df1 <- data.table(x = 1:3, y = 10:12) 25 | df2 <- data.table(x = 4:6, y = 13:15) 26 | 27 | df1 \%>\% 28 | bind_rows(df2) 29 | 30 | # Can pass a list of data.tables 31 | df_list <- list(df1, df2) 32 | 33 | bind_rows(df_list) 34 | 35 | # Binding data together by column 36 | df1 <- data.table(a = 1:3, b = 4:6) 37 | df2 <- data.table(c = 7:9) 38 | 39 | df1 \%>\% 40 | bind_cols(df2) 41 | 42 | # Can pass a list of data frames 43 | bind_cols(list(df1, df2)) 44 | } 45 | -------------------------------------------------------------------------------- /man/c_across.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/c_across.R 3 | \name{c_across} 4 | \alias{c_across} 5 | \title{Combine values from multiple columns} 6 | \usage{ 7 | c_across(cols = everything()) 8 | } 9 | \arguments{ 10 | \item{cols}{Columns to transform.} 11 | } 12 | \description{ 13 | \code{c_across()} works inside of \code{mutate_rowwise()}. It uses tidyselect so 14 | you can easily select multiple variables. 15 | } 16 | \examples{ 17 | df <- data.table(x = runif(6), y = runif(6), z = runif(6)) 18 | 19 | df \%>\% 20 | mutate_rowwise(row_mean = mean(c_across(x:z))) 21 | } 22 | -------------------------------------------------------------------------------- /man/case.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/case.R 3 | \name{case} 4 | \alias{case} 5 | \title{\code{data.table::fcase()} with vectorized default} 6 | \usage{ 7 | case(..., default = NA, ptype = NULL, size = NULL) 8 | } 9 | \arguments{ 10 | \item{...}{Sequence of condition/value designations} 11 | 12 | \item{default}{Default value. Set to NA by default.} 13 | 14 | \item{ptype}{Optional ptype to specify the output type.} 15 | 16 | \item{size}{Optional size to specify the output size.} 17 | } 18 | \description{ 19 | This function allows you to use multiple if/else statements in one call. 20 | 21 | It is called like \code{data.table::fcase()}, but allows the user to use 22 | a vector as the \code{default} argument. 23 | } 24 | \examples{ 25 | df <- tidytable(x = 1:10) 26 | 27 | df \%>\% 28 | mutate(case_x = case(x < 5, 1, 29 | x < 7, 2, 30 | default = 3)) 31 | } 32 | -------------------------------------------------------------------------------- /man/case_match.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/case_match.R 3 | \name{case_match} 4 | \alias{case_match} 5 | \title{Vectorized \code{switch()}} 6 | \usage{ 7 | case_match(.x, ..., .default = NA, .ptype = NULL) 8 | } 9 | \arguments{ 10 | \item{.x}{A vector} 11 | 12 | \item{...}{A sequence of two-sided formulas. The left hand side gives the old values, 13 | the right hand side gives the new value.} 14 | 15 | \item{.default}{The default value if all conditions evaluate to \code{FALSE}.} 16 | 17 | \item{.ptype}{Optional ptype to specify the output type.} 18 | } 19 | \description{ 20 | Allows the user to succinctly create a new vector based off conditions of a single vector. 21 | } 22 | \examples{ 23 | df <- tidytable(x = c("a", "b", "c", "d")) 24 | 25 | df \%>\% 26 | mutate( 27 | case_x = case_match(x, 28 | c("a", "b") ~ "new_1", 29 | "c" ~ "new_2", 30 | .default = x) 31 | ) 32 | } 33 | -------------------------------------------------------------------------------- /man/case_when.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/case_when.R 3 | \name{case_when} 4 | \alias{case_when} 5 | \title{Case when} 6 | \usage{ 7 | case_when(..., .default = NA, .ptype = NULL, .size = NULL) 8 | } 9 | \arguments{ 10 | \item{...}{A sequence of two-sided formulas. The left hand side gives the conditions, 11 | the right hand side gives the values.} 12 | 13 | \item{.default}{The default value if all conditions evaluate to \code{FALSE}.} 14 | 15 | \item{.ptype}{Optional ptype to specify the output type.} 16 | 17 | \item{.size}{Optional size to specify the output size.} 18 | } 19 | \description{ 20 | This function allows you to use multiple if/else statements in one call. 21 | 22 | It is called like \code{dplyr::case_when()}, but utilizes \code{data.table::fifelse()} 23 | in the background for improved performance. 24 | } 25 | \examples{ 26 | df <- tidytable(x = 1:10) 27 | 28 | df \%>\% 29 | mutate(case_x = case_when(x < 5 ~ 1, 30 | x < 7 ~ 2, 31 | TRUE ~ 3)) 32 | } 33 | -------------------------------------------------------------------------------- /man/coalesce.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/coalesce.R 3 | \name{coalesce} 4 | \alias{coalesce} 5 | \title{Coalesce missing values} 6 | \usage{ 7 | coalesce(..., .ptype = NULL, .size = NULL) 8 | } 9 | \arguments{ 10 | \item{...}{Input vectors. Supports dynamic dots.} 11 | 12 | \item{.ptype}{Optional ptype to override output type} 13 | 14 | \item{.size}{Optional size to override output size} 15 | } 16 | \description{ 17 | Fill in missing values in a vector by pulling successively from other vectors. 18 | } 19 | \examples{ 20 | # Use a single value to replace all missing values 21 | x <- c(1:3, NA, NA) 22 | coalesce(x, 0) 23 | 24 | # Or match together a complete vector from missing pieces 25 | y <- c(1, 2, NA, NA, 5) 26 | z <- c(NA, NA, 3, 4, 5) 27 | coalesce(y, z) 28 | 29 | # Supply lists with dynamic dots 30 | vecs <- list( 31 | c(1, 2, NA, NA, 5), 32 | c(NA, NA, 3, 4, 5) 33 | ) 34 | coalesce(!!!vecs) 35 | } 36 | -------------------------------------------------------------------------------- /man/complete.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/complete.R 3 | \name{complete} 4 | \alias{complete} 5 | \title{Complete a data.table with missing combinations of data} 6 | \usage{ 7 | complete(.df, ..., fill = list(), .by = NULL) 8 | } 9 | \arguments{ 10 | \item{.df}{A data.frame or data.table} 11 | 12 | \item{...}{Columns to expand} 13 | 14 | \item{fill}{A named list of values to fill NAs with.} 15 | 16 | \item{.by}{Columns to group by} 17 | } 18 | \description{ 19 | Turns implicit missing values into explicit missing values. 20 | } 21 | \examples{ 22 | df <- data.table(x = 1:2, y = 1:2, z = 3:4) 23 | 24 | df \%>\% 25 | complete(x, y) 26 | 27 | df \%>\% 28 | complete(x, y, fill = list(z = 10)) 29 | } 30 | -------------------------------------------------------------------------------- /man/consecutive_id.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/consecutive_id.R 3 | \name{consecutive_id} 4 | \alias{consecutive_id} 5 | \title{Generate a unique id for consecutive values} 6 | \usage{ 7 | consecutive_id(...) 8 | } 9 | \arguments{ 10 | \item{...}{Vectors of values} 11 | } 12 | \description{ 13 | Generate a unique id for runs of consecutive values 14 | } 15 | \examples{ 16 | x <- c(1, 1, 2, 2, 1, 1) 17 | consecutive_id(x) 18 | } 19 | -------------------------------------------------------------------------------- /man/context.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/cur-context.R 3 | \name{context} 4 | \alias{context} 5 | \alias{cur_column} 6 | \alias{cur_data} 7 | \alias{cur_group_id} 8 | \alias{cur_group_rows} 9 | \title{Context functions} 10 | \usage{ 11 | cur_column() 12 | 13 | cur_data() 14 | 15 | cur_group_id() 16 | 17 | cur_group_rows() 18 | } 19 | \description{ 20 | These functions give information about the "current" group. 21 | \itemize{ 22 | \item \code{cur_data()} gives the current data for the current group 23 | \item \code{cur_column()} gives the name of the current column (for use in \code{across()} only) 24 | \item \code{cur_group_id()} gives a group identification number 25 | \item \code{cur_group_rows()} gives the row indices for each group 26 | } 27 | 28 | Can be used inside \code{summarize()}, \code{mutate()}, & \code{filter()} 29 | } 30 | \examples{ 31 | df <- data.table( 32 | x = 1:5, 33 | y = c("a", "a", "a", "b", "b") 34 | ) 35 | 36 | df \%>\% 37 | mutate( 38 | across(c(x, y), ~ paste(cur_column(), .x)) 39 | ) 40 | 41 | df \%>\% 42 | summarize(data = list(cur_data()), 43 | .by = y) 44 | 45 | df \%>\% 46 | mutate(group_id = cur_group_id(), 47 | .by = y) 48 | 49 | df \%>\% 50 | mutate(group_rows = cur_group_rows(), 51 | .by = y) 52 | } 53 | -------------------------------------------------------------------------------- /man/cross_join.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/join.R 3 | \name{cross_join} 4 | \alias{cross_join} 5 | \title{Cross join} 6 | \usage{ 7 | cross_join(x, y, ..., suffix = c(".x", ".y")) 8 | } 9 | \arguments{ 10 | \item{x}{A data.frame or data.table} 11 | 12 | \item{y}{A data.frame or data.table} 13 | 14 | \item{...}{Other parameters passed on to methods} 15 | 16 | \item{suffix}{Append created for duplicated column names when using \code{full_join()}} 17 | } 18 | \description{ 19 | Cross join each row of \code{x} to every row in \code{y}. 20 | } 21 | \examples{ 22 | df1 <- tidytable(x = 1:3) 23 | df2 <- tidytable(y = 4:6) 24 | 25 | cross_join(df1, df2) 26 | } 27 | -------------------------------------------------------------------------------- /man/crossing.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/crossing.R 3 | \name{crossing} 4 | \alias{crossing} 5 | \title{Create a data.table from all unique combinations of inputs} 6 | \usage{ 7 | crossing(..., .name_repair = "check_unique") 8 | } 9 | \arguments{ 10 | \item{...}{Variables to get unique combinations of} 11 | 12 | \item{.name_repair}{Treatment of problematic names. See \code{?vctrs::vec_as_names} for options/details} 13 | } 14 | \description{ 15 | \code{crossing()} is similar to \code{expand_grid()} but de-duplicates and sorts its inputs. 16 | } 17 | \examples{ 18 | x <- 1:2 19 | y <- 1:2 20 | 21 | crossing(x, y) 22 | 23 | crossing(stuff = x, y) 24 | } 25 | -------------------------------------------------------------------------------- /man/desc.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/desc.R 3 | \name{desc} 4 | \alias{desc} 5 | \title{Descending order} 6 | \usage{ 7 | desc(x) 8 | } 9 | \arguments{ 10 | \item{x}{Variable to arrange in descending order} 11 | } 12 | \description{ 13 | Arrange in descending order. Can be used inside of \code{arrange()} 14 | } 15 | \examples{ 16 | df <- data.table( 17 | a = 1:3, 18 | b = 4:6, 19 | c = c("a", "a", "b") 20 | ) 21 | 22 | df \%>\% 23 | arrange(c, desc(a)) 24 | } 25 | -------------------------------------------------------------------------------- /man/distinct.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/distinct.R 3 | \name{distinct} 4 | \alias{distinct} 5 | \title{Select distinct/unique rows} 6 | \usage{ 7 | distinct(.df, ..., .keep_all = FALSE) 8 | } 9 | \arguments{ 10 | \item{.df}{A data.frame or data.table} 11 | 12 | \item{...}{Columns to select before determining uniqueness. If omitted, will use all columns. 13 | \code{tidyselect} compatible.} 14 | 15 | \item{.keep_all}{Only relevant if columns are provided to ... arg. 16 | This keeps all columns, but only keeps the first row of each distinct 17 | values of columns provided to ... arg.} 18 | } 19 | \description{ 20 | Retain only unique/distinct rows from an input df. 21 | } 22 | \examples{ 23 | df <- tidytable( 24 | x = 1:3, 25 | y = 4:6, 26 | z = c("a", "a", "b") 27 | ) 28 | 29 | df \%>\% 30 | distinct() 31 | 32 | df \%>\% 33 | distinct(z) 34 | } 35 | -------------------------------------------------------------------------------- /man/drop_na.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/drop_na.R 3 | \name{drop_na} 4 | \alias{drop_na} 5 | \title{Drop rows containing missing values} 6 | \usage{ 7 | drop_na(.df, ...) 8 | } 9 | \arguments{ 10 | \item{.df}{A data.frame or data.table} 11 | 12 | \item{...}{Optional: A selection of columns. If empty, all variables are selected. 13 | \code{tidyselect} compatible.} 14 | } 15 | \description{ 16 | Drop rows containing missing values 17 | } 18 | \examples{ 19 | df <- data.table( 20 | x = c(1, 2, NA), 21 | y = c("a", NA, "b") 22 | ) 23 | 24 | df \%>\% 25 | drop_na() 26 | 27 | df \%>\% 28 | drop_na(x) 29 | 30 | df \%>\% 31 | drop_na(where(is.numeric)) 32 | } 33 | -------------------------------------------------------------------------------- /man/dt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/dt.R 3 | \name{dt} 4 | \alias{dt} 5 | \title{Pipeable data.table call} 6 | \usage{ 7 | dt(.df, i, j, ...) 8 | } 9 | \arguments{ 10 | \item{.df}{A data.frame or data.table} 11 | 12 | \item{i}{i position of a data.table call. See \code{?data.table::data.table}} 13 | 14 | \item{j}{j position of a data.table call. See \code{?data.table::data.table}} 15 | 16 | \item{...}{Other arguments passed to data.table call. See \code{?data.table::data.table}} 17 | } 18 | \description{ 19 | Pipeable data.table call. 20 | 21 | This function does not use data.table's modify-by-reference. 22 | 23 | Has experimental support for tidy evaluation for custom functions. 24 | } 25 | \examples{ 26 | df <- tidytable( 27 | x = 1:3, 28 | y = 4:6, 29 | z = c("a", "a", "b") 30 | ) 31 | 32 | df \%>\% 33 | dt(, double_x := x * 2) \%>\% 34 | dt(order(-double_x)) 35 | 36 | # Experimental support for tidy evaluation for custom functions 37 | add_one <- function(data, col) { 38 | data \%>\% 39 | dt(, new_col := {{ col }} + 1) 40 | } 41 | 42 | df \%>\% 43 | add_one(x) 44 | } 45 | -------------------------------------------------------------------------------- /man/enframe.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/enframe.R 3 | \name{enframe} 4 | \alias{enframe} 5 | \title{Convert a vector to a data.table/tidytable} 6 | \usage{ 7 | enframe(x, name = "name", value = "value") 8 | } 9 | \arguments{ 10 | \item{x}{A vector} 11 | 12 | \item{name}{Name of the column that stores the names. If \code{name = NULL}, 13 | a one-column tidytable will be returned.} 14 | 15 | \item{value}{Name of the column that stores the values.} 16 | } 17 | \description{ 18 | Converts named and unnamed vectors to a data.table/tidytable. 19 | } 20 | \examples{ 21 | vec <- 1:3 22 | names(vec) <- letters[1:3] 23 | 24 | enframe(vec) 25 | } 26 | -------------------------------------------------------------------------------- /man/expand.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/expand.R 3 | \name{expand} 4 | \alias{expand} 5 | \alias{nesting} 6 | \title{Expand a data.table to use all combinations of values} 7 | \usage{ 8 | expand(.df, ..., .name_repair = "check_unique", .by = NULL) 9 | 10 | nesting(..., .name_repair = "check_unique") 11 | } 12 | \arguments{ 13 | \item{.df}{A data.frame or data.table} 14 | 15 | \item{...}{Columns to get combinations of} 16 | 17 | \item{.name_repair}{Treatment of duplicate names. See \code{?vctrs::vec_as_names} for options/details} 18 | 19 | \item{.by}{Columns to group by} 20 | } 21 | \description{ 22 | Generates all combinations of variables found in a dataset. 23 | 24 | \code{expand()} is useful in conjunction with joins: 25 | \itemize{ 26 | \item use with \code{right_join()} to convert implicit missing values to explicit missing values 27 | \item use with \code{anti_join()} to find out which combinations are missing 28 | } 29 | 30 | \code{nesting()} is a helper that only finds combinations already present in the dataset. 31 | } 32 | \examples{ 33 | df <- tidytable(x = c(1, 1, 2), y = c(1, 1, 2)) 34 | 35 | df \%>\% 36 | expand(x, y) 37 | 38 | df \%>\% 39 | expand(nesting(x, y)) 40 | } 41 | -------------------------------------------------------------------------------- /man/expand_grid.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/expand_grid.R 3 | \name{expand_grid} 4 | \alias{expand_grid} 5 | \title{Create a data.table from all combinations of inputs} 6 | \usage{ 7 | expand_grid(..., .name_repair = "check_unique") 8 | } 9 | \arguments{ 10 | \item{...}{Variables to get combinations of} 11 | 12 | \item{.name_repair}{Treatment of problematic names. See \code{?vctrs::vec_as_names} for options/details} 13 | } 14 | \description{ 15 | Create a data.table from all combinations of inputs 16 | } 17 | \examples{ 18 | x <- 1:2 19 | y <- 1:2 20 | 21 | expand_grid(x, y) 22 | 23 | expand_grid(stuff = x, y) 24 | } 25 | -------------------------------------------------------------------------------- /man/figures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/man/figures/logo.png -------------------------------------------------------------------------------- /man/fill.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fill.R 3 | \name{fill} 4 | \alias{fill} 5 | \title{Fill in missing values with previous or next value} 6 | \usage{ 7 | fill(.df, ..., .direction = c("down", "up", "downup", "updown"), .by = NULL) 8 | } 9 | \arguments{ 10 | \item{.df}{A data.frame or data.table} 11 | 12 | \item{...}{A selection of columns. \code{tidyselect} compatible.} 13 | 14 | \item{.direction}{Direction in which to fill missing values. 15 | Currently "down" (the default), "up", "downup" (first down then up), or "updown" (first up and then down)} 16 | 17 | \item{.by}{Columns to group by when filling should be done by group} 18 | } 19 | \description{ 20 | Fills missing values in the selected columns using the next or previous entry. Can be done by group. 21 | 22 | Supports tidyselect 23 | } 24 | \examples{ 25 | df <- data.table( 26 | a = c(1, NA, 3, 4, 5), 27 | b = c(NA, 2, NA, NA, 5), 28 | groups = c("a", "a", "a", "b", "b") 29 | ) 30 | 31 | df \%>\% 32 | fill(a, b) 33 | 34 | df \%>\% 35 | fill(a, b, .by = groups) 36 | 37 | df \%>\% 38 | fill(a, b, .direction = "downup", .by = groups) 39 | } 40 | -------------------------------------------------------------------------------- /man/filter.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/filter.R 3 | \name{filter} 4 | \alias{filter} 5 | \title{Filter rows on one or more conditions} 6 | \usage{ 7 | filter(.df, ..., .by = NULL) 8 | } 9 | \arguments{ 10 | \item{.df}{A data.frame or data.table} 11 | 12 | \item{...}{Conditions to filter by} 13 | 14 | \item{.by}{Columns to group by if filtering with a summary function} 15 | } 16 | \description{ 17 | Filters a dataset to choose rows where conditions are true. 18 | } 19 | \examples{ 20 | df <- tidytable( 21 | a = 1:3, 22 | b = 4:6, 23 | c = c("a", "a", "b") 24 | ) 25 | 26 | df \%>\% 27 | filter(a >= 2, b >= 4) 28 | 29 | df \%>\% 30 | filter(b <= mean(b), .by = c) 31 | } 32 | -------------------------------------------------------------------------------- /man/first.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/first-last-nth.R 3 | \name{first} 4 | \alias{first} 5 | \alias{last} 6 | \alias{nth} 7 | \title{Extract the first, last, or nth value from a vector} 8 | \usage{ 9 | first(x, default = NULL, na_rm = FALSE) 10 | 11 | last(x, default = NULL, na_rm = FALSE) 12 | 13 | nth(x, n, default = NULL, na_rm = FALSE) 14 | } 15 | \arguments{ 16 | \item{x}{A vector} 17 | 18 | \item{default}{The default value if the value doesn't exist.} 19 | 20 | \item{na_rm}{If \code{TRUE} ignores missing values.} 21 | 22 | \item{n}{For \code{nth()}, a number specifying the position to grab.} 23 | } 24 | \description{ 25 | Extract the first, last, or nth value from a vector. 26 | 27 | Note: These are simple wrappers around \code{vctrs::vec_slice()}. 28 | } 29 | \examples{ 30 | vec <- letters 31 | 32 | first(vec) 33 | last(vec) 34 | nth(vec, 4) 35 | } 36 | -------------------------------------------------------------------------------- /man/fread.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fread-fwrite.R 3 | \name{fread} 4 | \alias{fread} 5 | \title{Read/write files} 6 | \usage{ 7 | fread(...) 8 | } 9 | \arguments{ 10 | \item{...}{Arguments passed on to \code{data.table::fread}} 11 | } 12 | \description{ 13 | \code{fread()} is a simple wrapper around \code{data.table::fread()} that returns a tidytable 14 | instead of a data.table. 15 | } 16 | \examples{ 17 | fake_csv <- "A,B 18 | 1,2 19 | 3,4" 20 | 21 | fread(fake_csv) 22 | } 23 | -------------------------------------------------------------------------------- /man/group_by.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/group_by.R 3 | \name{group_by} 4 | \alias{group_by} 5 | \alias{ungroup} 6 | \title{Grouping} 7 | \usage{ 8 | group_by(.df, ..., .add = FALSE) 9 | 10 | ungroup(.df, ...) 11 | } 12 | \arguments{ 13 | \item{.df}{A data.frame or data.table} 14 | 15 | \item{...}{Columns to group by} 16 | 17 | \item{.add}{Should grouping cols specified be added to the current grouping} 18 | } 19 | \description{ 20 | \itemize{ 21 | \item \code{group_by()} adds a grouping structure to a tidytable. Can use tidyselect syntax. 22 | \item \code{ungroup()} removes grouping. 23 | } 24 | } 25 | \examples{ 26 | df <- data.table( 27 | a = 1:3, 28 | b = 4:6, 29 | c = c("a", "a", "b"), 30 | d = c("a", "a", "b") 31 | ) 32 | 33 | df \%>\% 34 | group_by(c, d) \%>\% 35 | summarize(mean_a = mean(a)) \%>\% 36 | ungroup() 37 | 38 | # Can also use tidyselect 39 | df \%>\% 40 | group_by(where(is.character)) \%>\% 41 | summarize(mean_a = mean(a)) \%>\% 42 | ungroup() 43 | } 44 | -------------------------------------------------------------------------------- /man/group_cols.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/group_cols.R 3 | \name{group_cols} 4 | \alias{group_cols} 5 | \title{Selection helper for grouping columns} 6 | \usage{ 7 | group_cols() 8 | } 9 | \description{ 10 | Selection helper for grouping columns 11 | } 12 | \examples{ 13 | df <- tidytable( 14 | x = c("a", "b", "c"), 15 | y = 1:3, 16 | z = 1:3 17 | ) 18 | 19 | df \%>\% 20 | group_by(x) \%>\% 21 | select(group_cols(), y) 22 | } 23 | -------------------------------------------------------------------------------- /man/group_split.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/group_split.R 3 | \name{group_split} 4 | \alias{group_split} 5 | \title{Split data frame by groups} 6 | \usage{ 7 | group_split(.df, ..., .keep = TRUE, .named = FALSE) 8 | } 9 | \arguments{ 10 | \item{.df}{A data.frame or data.table} 11 | 12 | \item{...}{Columns to group and split by. \code{tidyselect} compatible.} 13 | 14 | \item{.keep}{Should the grouping columns be kept} 15 | 16 | \item{.named}{\emph{experimental}: Should the list be named with labels that identify the group} 17 | } 18 | \description{ 19 | Split data frame by groups. Returns a list. 20 | } 21 | \examples{ 22 | df <- tidytable( 23 | a = 1:3, 24 | b = 1:3, 25 | c = c("a", "a", "b"), 26 | d = c("a", "a", "b") 27 | ) 28 | 29 | df \%>\% 30 | group_split(c, d) 31 | 32 | df \%>\% 33 | group_split(c, d, .keep = FALSE) 34 | 35 | df \%>\% 36 | group_split(c, d, .named = TRUE) 37 | } 38 | -------------------------------------------------------------------------------- /man/group_vars.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/group_by.R 3 | \name{group_vars} 4 | \alias{group_vars} 5 | \title{Get the grouping variables} 6 | \usage{ 7 | group_vars(x) 8 | } 9 | \arguments{ 10 | \item{x}{A grouped tidytable} 11 | } 12 | \description{ 13 | Get the grouping variables 14 | } 15 | \examples{ 16 | df <- data.table( 17 | a = 1:3, 18 | b = 4:6, 19 | c = c("a", "a", "b"), 20 | d = c("a", "a", "b") 21 | ) 22 | 23 | df \%>\% 24 | group_by(c, d) \%>\% 25 | group_vars() 26 | } 27 | -------------------------------------------------------------------------------- /man/if_all.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/if_all-if_any.R 3 | \name{if_all} 4 | \alias{if_all} 5 | \alias{if_any} 6 | \title{Create conditions on a selection of columns} 7 | \usage{ 8 | if_all(.cols = everything(), .fns = NULL, ...) 9 | 10 | if_any(.cols = everything(), .fns = NULL, ...) 11 | } 12 | \arguments{ 13 | \item{.cols}{Selection of columns} 14 | 15 | \item{.fns}{Function to create filter conditions} 16 | 17 | \item{...}{Other arguments passed to the function} 18 | } 19 | \description{ 20 | Helpers to apply a filter across a selection of columns. 21 | } 22 | \examples{ 23 | iris \%>\% 24 | filter(if_any(ends_with("Width"), ~ .x > 4)) 25 | 26 | iris \%>\% 27 | filter(if_all(ends_with("Width"), ~ .x > 2)) 28 | } 29 | -------------------------------------------------------------------------------- /man/if_else.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/if_else.R 3 | \name{if_else} 4 | \alias{if_else} 5 | \title{Fast if_else} 6 | \usage{ 7 | if_else(condition, true, false, missing = NA, ..., ptype = NULL, size = NULL) 8 | } 9 | \arguments{ 10 | \item{condition}{Conditions to test on} 11 | 12 | \item{true}{Values to return if conditions evaluate to \code{TRUE}} 13 | 14 | \item{false}{Values to return if conditions evaluate to \code{FALSE}} 15 | 16 | \item{missing}{Value to return if an element of test is \code{NA}} 17 | 18 | \item{...}{These dots are for future extensions and must be empty.} 19 | 20 | \item{ptype}{Optional ptype to override output type} 21 | 22 | \item{size}{Optional size to override output size} 23 | } 24 | \description{ 25 | Fast version of \code{base::ifelse()}. 26 | } 27 | \examples{ 28 | x <- 1:5 29 | if_else(x < 3, 1, 0) 30 | 31 | # Can also be used inside of mutate() 32 | df <- data.table(x = x) 33 | 34 | df \%>\% 35 | mutate(new_col = if_else(x < 3, 1, 0)) 36 | } 37 | -------------------------------------------------------------------------------- /man/in-notin.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/in-notin.R 3 | \name{\%in\%} 4 | \alias{\%in\%} 5 | \alias{\%notin\%} 6 | \title{Fast \code{\%in\%} and \verb{\%notin\%} operators} 7 | \usage{ 8 | x \%in\% y 9 | 10 | x \%notin\% y 11 | } 12 | \arguments{ 13 | \item{x}{A vector of values to check if they exist in y} 14 | 15 | \item{y}{A vector of values to check if x values exist in} 16 | } 17 | \description{ 18 | Check whether values in a vector are in or not in another vector. 19 | 20 | Built using \code{data.table::'\%chin\%'} and \code{vctrs::vec_in()} for performance. 21 | } 22 | \details{ 23 | Falls back to \code{base::'\%in\%'} when x and y don't share a common type. 24 | This means that the behaviour of \code{base::'\%in\%'} is preserved (e.g. \code{"1" \%in\% c(1, 2)} is \code{TRUE}) 25 | but loses the speedup provided by \code{vctrs::vec_in()}. 26 | } 27 | \examples{ 28 | df <- tidytable(x = 1:4, y = 1:4) 29 | 30 | df \%>\% 31 | filter(x \%in\% c(2, 4)) 32 | 33 | df \%>\% 34 | filter(x \%notin\% c(2, 4)) 35 | } 36 | -------------------------------------------------------------------------------- /man/inv_gc.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/inv_gc.R 3 | \name{inv_gc} 4 | \alias{inv_gc} 5 | \title{Run invisible garbage collection} 6 | \usage{ 7 | inv_gc(x) 8 | } 9 | \arguments{ 10 | \item{x}{Optional. If missing runs \code{gc()} silently. Else returns the same object unaltered.} 11 | } 12 | \description{ 13 | Run garbage collection without the \code{gc()} output. Can also be run in the middle of a long pipe chain. 14 | Useful for large datasets or when using parallel processing. 15 | } 16 | \examples{ 17 | # Can be run with no input 18 | inv_gc() 19 | 20 | df <- tidytable(col1 = 1, col2 = 2) 21 | 22 | # Or can be used in the middle of a pipe chain (object is unaltered) 23 | df \%>\% 24 | filter(col1 < 2, col2 < 4) \%>\% 25 | inv_gc() \%>\% 26 | select(col1) 27 | } 28 | -------------------------------------------------------------------------------- /man/is_grouped_df.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/group_by.R 3 | \name{is_grouped_df} 4 | \alias{is_grouped_df} 5 | \title{Check if the tidytable is grouped} 6 | \usage{ 7 | is_grouped_df(x) 8 | } 9 | \arguments{ 10 | \item{x}{An object} 11 | } 12 | \description{ 13 | Check if the tidytable is grouped 14 | } 15 | \examples{ 16 | df <- data.table( 17 | a = 1:3, 18 | b = c("a", "a", "b") 19 | ) 20 | 21 | df \%>\% 22 | group_by(b) \%>\% 23 | is_grouped_df() 24 | } 25 | -------------------------------------------------------------------------------- /man/is_tidytable.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/is_tidytable.R 3 | \name{is_tidytable} 4 | \alias{is_tidytable} 5 | \title{Test if the object is a tidytable} 6 | \usage{ 7 | is_tidytable(x) 8 | } 9 | \arguments{ 10 | \item{x}{An object} 11 | } 12 | \description{ 13 | This function returns TRUE for tidytables or subclasses of tidytables, and FALSE for all other objects. 14 | } 15 | \examples{ 16 | df <- data.frame(x = 1:3, y = 1:3) 17 | 18 | is_tidytable(df) 19 | 20 | df <- tidytable(x = 1:3, y = 1:3) 21 | 22 | is_tidytable(df) 23 | } 24 | -------------------------------------------------------------------------------- /man/lag.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/lag-lead.R 3 | \name{lag} 4 | \alias{lag} 5 | \alias{lead} 6 | \title{Get lagging or leading values} 7 | \usage{ 8 | lag(x, n = 1L, default = NA) 9 | 10 | lead(x, n = 1L, default = NA) 11 | } 12 | \arguments{ 13 | \item{x}{a vector of values} 14 | 15 | \item{n}{a positive integer of length 1, giving the number of positions to lead or lag by} 16 | 17 | \item{default}{value used for non-existent rows. Defaults to NA.} 18 | } 19 | \description{ 20 | Find the "previous" or "next" values in a vector. 21 | Useful for comparing values behind or ahead of the current values. 22 | } 23 | \examples{ 24 | x <- 1:5 25 | 26 | lag(x, 1) 27 | lead(x, 1) 28 | 29 | # Also works inside of `mutate()` 30 | df <- tidytable(x = 1:5) 31 | 32 | df \%>\% 33 | mutate(lag_x = lag(x)) 34 | 35 | } 36 | -------------------------------------------------------------------------------- /man/n.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/n.R 3 | \name{n} 4 | \alias{n} 5 | \title{Number of observations in each group} 6 | \usage{ 7 | n() 8 | } 9 | \description{ 10 | Helper function that can be used to find counts by group. 11 | 12 | Can be used inside \code{summarize()}, \code{mutate()}, & \code{filter()} 13 | } 14 | \examples{ 15 | df <- data.table( 16 | x = 1:3, 17 | y = 4:6, 18 | z = c("a","a","b") 19 | ) 20 | 21 | df \%>\% 22 | summarize(count = n(), .by = z) 23 | } 24 | -------------------------------------------------------------------------------- /man/n_distinct.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/n_distinct.R 3 | \name{n_distinct} 4 | \alias{n_distinct} 5 | \title{Count the number of unique values in a vector} 6 | \usage{ 7 | n_distinct(..., na.rm = FALSE) 8 | } 9 | \arguments{ 10 | \item{...}{vectors of values} 11 | 12 | \item{na.rm}{If \code{TRUE} missing values don't count} 13 | } 14 | \description{ 15 | This is a faster version of \code{length(unique(x))} that calls \code{data.table::uniqueN()}. 16 | } 17 | \examples{ 18 | x <- sample(1:10, 1e5, rep = TRUE) 19 | n_distinct(x) 20 | } 21 | -------------------------------------------------------------------------------- /man/na_if.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/na_if.R 3 | \name{na_if} 4 | \alias{na_if} 5 | \title{Convert values to \code{NA}} 6 | \usage{ 7 | na_if(x, y) 8 | } 9 | \arguments{ 10 | \item{x}{A vector} 11 | 12 | \item{y}{Value to replace with \code{NA}} 13 | } 14 | \description{ 15 | Convert values to \code{NA}. 16 | } 17 | \examples{ 18 | vec <- 1:3 19 | na_if(vec, 3) 20 | } 21 | -------------------------------------------------------------------------------- /man/nest.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/nest.R 3 | \name{nest} 4 | \alias{nest} 5 | \title{Nest columns into a list-column} 6 | \usage{ 7 | nest(.df, ..., .by = NULL, .key = NULL, .names_sep = NULL) 8 | } 9 | \arguments{ 10 | \item{.df}{A data.table or data.frame} 11 | 12 | \item{...}{Columns to be nested.} 13 | 14 | \item{.by}{Columns to nest by} 15 | 16 | \item{.key}{New column name if \code{.by} is used} 17 | 18 | \item{.names_sep}{If NULL, the names will be left alone. If a string, 19 | the names of the columns will be created by pasting together the inner 20 | column names and the outer column names.} 21 | } 22 | \description{ 23 | Nest columns into a list-column 24 | } 25 | \examples{ 26 | df <- data.table( 27 | a = 1:3, 28 | b = 1:3, 29 | c = c("a", "a", "b"), 30 | d = c("a", "a", "b") 31 | ) 32 | 33 | df \%>\% 34 | nest(data = c(a, b)) 35 | 36 | df \%>\% 37 | nest(data = where(is.numeric)) 38 | 39 | df \%>\% 40 | nest(.by = c(c, d)) 41 | } 42 | -------------------------------------------------------------------------------- /man/nest_by.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/nest_by.R 3 | \name{nest_by} 4 | \alias{nest_by} 5 | \title{Nest data.tables} 6 | \usage{ 7 | nest_by(.df, ..., .key = "data", .keep = FALSE) 8 | } 9 | \arguments{ 10 | \item{.df}{A data.frame or data.table} 11 | 12 | \item{...}{Columns to group by. If empty nests the entire data.table. 13 | \code{tidyselect} compatible.} 14 | 15 | \item{.key}{Name of the new column created by nesting.} 16 | 17 | \item{.keep}{Should the grouping columns be kept in the list column.} 18 | } 19 | \description{ 20 | Nest data.tables by group. 21 | 22 | Note: \code{nest_by()} \emph{does not} return a rowwise tidytable. 23 | } 24 | \examples{ 25 | df <- data.table( 26 | a = 1:5, 27 | b = 6:10, 28 | c = c(rep("a", 3), rep("b", 2)), 29 | d = c(rep("a", 3), rep("b", 2)) 30 | ) 31 | 32 | df \%>\% 33 | nest_by() 34 | 35 | df \%>\% 36 | nest_by(c, d) 37 | 38 | df \%>\% 39 | nest_by(where(is.character)) 40 | 41 | df \%>\% 42 | nest_by(c, d, .keep = TRUE) 43 | } 44 | -------------------------------------------------------------------------------- /man/nest_join.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/join.R 3 | \name{nest_join} 4 | \alias{nest_join} 5 | \title{Nest join} 6 | \usage{ 7 | nest_join(x, y, by = NULL, keep = FALSE, name = NULL, ...) 8 | } 9 | \arguments{ 10 | \item{x}{A data.frame or data.table} 11 | 12 | \item{y}{A data.frame or data.table} 13 | 14 | \item{by}{A character vector of variables to join by. If NULL, the default, the join will do a natural join, using all variables with common names across the two tables.} 15 | 16 | \item{keep}{Should the join keys from both \code{x} and \code{y} be preserved in the output?} 17 | 18 | \item{name}{The name of the list-column created by the join. If \code{NULL} the name of \code{y} is used.} 19 | 20 | \item{...}{Other parameters passed on to methods} 21 | } 22 | \description{ 23 | Join the data from y as a list column onto x. 24 | } 25 | \examples{ 26 | df1 <- tidytable(x = 1:3) 27 | df2 <- tidytable(x = c(2, 3, 3), y = c("a", "b", "c")) 28 | 29 | out <- nest_join(df1, df2) 30 | out 31 | out$df2 32 | } 33 | -------------------------------------------------------------------------------- /man/new_tidytable.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/new_tidytable.R 3 | \name{new_tidytable} 4 | \alias{new_tidytable} 5 | \title{Create a tidytable from a list} 6 | \usage{ 7 | new_tidytable(x = list()) 8 | } 9 | \arguments{ 10 | \item{x}{A named list of equal-length vectors. The lengths are not checked; it is the responsibility 11 | of the caller to make sure they are equal.} 12 | } 13 | \description{ 14 | Create a tidytable from a list 15 | } 16 | \examples{ 17 | l <- list(x = 1:3, y = c("a", "a", "b")) 18 | 19 | new_tidytable(l) 20 | } 21 | -------------------------------------------------------------------------------- /man/pick.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/pick.R 3 | \name{pick} 4 | \alias{pick} 5 | \title{Selection version of \code{across()}} 6 | \usage{ 7 | pick(...) 8 | } 9 | \arguments{ 10 | \item{...}{Columns to select. Tidyselect compatible.} 11 | } 12 | \description{ 13 | Select a subset of columns from within functions like \code{mutate()}, \code{summarize()}, or \code{filter()}. 14 | } 15 | \examples{ 16 | df <- tidytable( 17 | x = 1:3, 18 | y = 4:6, 19 | z = c("a", "a", "b") 20 | ) 21 | 22 | df \%>\% 23 | mutate(row_sum = rowSums(pick(x, y))) 24 | } 25 | -------------------------------------------------------------------------------- /man/pipe.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils-pipe.R 3 | \name{\%>\%} 4 | \alias{\%>\%} 5 | \title{Pipe operator} 6 | \usage{ 7 | lhs \%>\% rhs 8 | } 9 | \description{ 10 | See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details. 11 | } 12 | \keyword{internal} 13 | -------------------------------------------------------------------------------- /man/pull.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/pull.R 3 | \name{pull} 4 | \alias{pull} 5 | \title{Pull out a single variable} 6 | \usage{ 7 | pull(.df, var = -1, name = NULL) 8 | } 9 | \arguments{ 10 | \item{.df}{A data.frame or data.table} 11 | 12 | \item{var}{The column to pull from the data.table as: 13 | \itemize{ 14 | \item a variable name 15 | \item a positive integer giving the column position 16 | \item a negative integer giving the column position counting from the right 17 | }} 18 | 19 | \item{name}{Optional - specifies the column to be used as names for the vector.} 20 | } 21 | \description{ 22 | Pull a single variable from a data.table as a vector. 23 | } 24 | \examples{ 25 | df <- data.table( 26 | x = 1:3, 27 | y = 1:3 28 | ) 29 | 30 | # Grab column by name 31 | df \%>\% 32 | pull(y) 33 | 34 | # Grab column by position 35 | df \%>\% 36 | pull(1) 37 | 38 | # Defaults to last column 39 | df \%>\% 40 | pull() 41 | } 42 | -------------------------------------------------------------------------------- /man/rank.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rank.R 3 | \name{row_number} 4 | \alias{row_number} 5 | \alias{min_rank} 6 | \alias{dense_rank} 7 | \alias{percent_rank} 8 | \alias{cume_dist} 9 | \title{Ranking functions} 10 | \usage{ 11 | row_number(x) 12 | 13 | min_rank(x) 14 | 15 | dense_rank(x) 16 | 17 | percent_rank(x) 18 | 19 | cume_dist(x) 20 | } 21 | \arguments{ 22 | \item{x}{A vector to rank} 23 | } 24 | \description{ 25 | Ranking functions: 26 | \itemize{ 27 | \item \code{row_number()}: Gives other row number if empty. 28 | Equivalent to \code{frank(ties.method = "first")} if provided a vector. 29 | \item \code{min_rank()}: Equivalent to \code{frank(ties.method = "min")} 30 | \item \code{dense_rank()}: Equivalent to \code{frank(ties.method = "dense")} 31 | \item \code{percent_rank()}: Ranks by percentage from 0 to 1 32 | \item \code{cume_dist()}: Cumulative distribution 33 | } 34 | } 35 | \examples{ 36 | df <- data.table(x = rep(1, 3), y = c("a", "a", "b")) 37 | 38 | df \%>\% 39 | mutate(row = row_number()) 40 | } 41 | -------------------------------------------------------------------------------- /man/recode.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/recode.R 3 | \name{recode} 4 | \alias{recode} 5 | \title{Recode values} 6 | \usage{ 7 | recode(.x, ..., .default = NULL, .missing = NULL) 8 | } 9 | \arguments{ 10 | \item{.x}{A vector} 11 | 12 | \item{...}{A series of \code{old = new} pairs specifying the new values} 13 | 14 | \item{.default}{The default value if all conditions evaluate to \code{FALSE}} 15 | 16 | \item{.missing}{What missing values should be replaced with} 17 | } 18 | \description{ 19 | \emph{superseded} 20 | 21 | \code{recode()} has been superseded by \code{case_match()}. 22 | 23 | Replace old values of a vector with new values. 24 | } 25 | \examples{ 26 | char_vec <- c("a", "b", "c") 27 | recode(char_vec, a = "Apple", b = "Banana") 28 | 29 | num_vec <- 1:3 30 | recode(num_vec, `1` = 10, `2` = 25, .default = 100) 31 | } 32 | \keyword{internal} 33 | -------------------------------------------------------------------------------- /man/reframe.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/reframe.R 3 | \name{reframe} 4 | \alias{reframe} 5 | \title{Reframe a data frame} 6 | \usage{ 7 | reframe(.df, ..., .by = NULL) 8 | } 9 | \arguments{ 10 | \item{.df}{A data.frame or data.table} 11 | 12 | \item{...}{Aggregations to perform} 13 | 14 | \item{.by}{Columns to group by} 15 | } 16 | \description{ 17 | Reframe a data frame. Note this is a simple alias for \code{summarize()} 18 | that always returns an ungrouped tidytable. 19 | } 20 | \examples{ 21 | mtcars \%>\% 22 | reframe(qs = quantile(disp, c(0.25, 0.75)), 23 | prob = c(0.25, 0.75), 24 | .by = cyl) 25 | } 26 | -------------------------------------------------------------------------------- /man/relocate.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/relocate.R 3 | \name{relocate} 4 | \alias{relocate} 5 | \title{Relocate a column to a new position} 6 | \usage{ 7 | relocate(.df, ..., .before = NULL, .after = NULL) 8 | } 9 | \arguments{ 10 | \item{.df}{A data.frame or data.table} 11 | 12 | \item{...}{A selection of columns to move. \code{tidyselect} compatible.} 13 | 14 | \item{.before}{Column to move selection before} 15 | 16 | \item{.after}{Column to move selection after} 17 | } 18 | \description{ 19 | Move a column or columns to a new position 20 | } 21 | \examples{ 22 | df <- data.table( 23 | a = 1:3, 24 | b = 1:3, 25 | c = c("a", "a", "b"), 26 | d = c("a", "a", "b") 27 | ) 28 | 29 | df \%>\% 30 | relocate(c, .before = b) 31 | 32 | df \%>\% 33 | relocate(a, b, .after = c) 34 | 35 | df \%>\% 36 | relocate(where(is.numeric), .after = c) 37 | } 38 | -------------------------------------------------------------------------------- /man/rename.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rename.R 3 | \name{rename} 4 | \alias{rename} 5 | \title{Rename variables by name} 6 | \usage{ 7 | rename(.df, ...) 8 | } 9 | \arguments{ 10 | \item{.df}{A data.frame or data.table} 11 | 12 | \item{...}{\code{new_name = old_name} pairs to rename columns} 13 | } 14 | \description{ 15 | Rename variables from a data.table. 16 | } 17 | \examples{ 18 | df <- data.table(x = 1:3, y = 4:6) 19 | 20 | df \%>\% 21 | rename(new_x = x, 22 | new_y = y) 23 | } 24 | -------------------------------------------------------------------------------- /man/rename_with.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rename_with.R 3 | \name{rename_with} 4 | \alias{rename_with} 5 | \title{Rename multiple columns} 6 | \usage{ 7 | rename_with(.df, .fn = NULL, .cols = everything(), ...) 8 | } 9 | \arguments{ 10 | \item{.df}{A data.table or data.frame} 11 | 12 | \item{.fn}{Function to transform the names with.} 13 | 14 | \item{.cols}{Columns to rename. Defaults to all columns. \code{tidyselect} compatible.} 15 | 16 | \item{...}{Other parameters to pass to the function} 17 | } 18 | \description{ 19 | Rename multiple columns with the same transformation 20 | } 21 | \examples{ 22 | df <- data.table( 23 | x = 1, 24 | y = 2, 25 | double_x = 2, 26 | double_y = 4 27 | ) 28 | 29 | df \%>\% 30 | rename_with(toupper) 31 | 32 | df \%>\% 33 | rename_with(~ toupper(.x)) 34 | 35 | df \%>\% 36 | rename_with(~ toupper(.x), .cols = c(x, double_x)) 37 | } 38 | -------------------------------------------------------------------------------- /man/replace_na.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/replace_na.R 3 | \name{replace_na} 4 | \alias{replace_na} 5 | \title{Replace missing values} 6 | \usage{ 7 | replace_na(.x, replace) 8 | } 9 | \arguments{ 10 | \item{.x}{A data.frame/data.table or a vector} 11 | 12 | \item{replace}{If \code{.x} is a data frame, a \code{list()} of replacement values for specified columns. 13 | If \code{.x} is a vector, a single replacement value.} 14 | } 15 | \description{ 16 | Replace NAs with specified values 17 | } 18 | \examples{ 19 | df <- data.table( 20 | x = c(1, 2, NA), 21 | y = c(NA, 1, 2) 22 | ) 23 | 24 | # Using replace_na() inside mutate() 25 | df \%>\% 26 | mutate(x = replace_na(x, 5)) 27 | 28 | # Using replace_na() on a data frame 29 | df \%>\% 30 | replace_na(list(x = 5, y = 0)) 31 | } 32 | -------------------------------------------------------------------------------- /man/rowwise.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rowwise.R 3 | \name{rowwise} 4 | \alias{rowwise} 5 | \title{Convert to a rowwise tidytable} 6 | \usage{ 7 | rowwise(.df) 8 | } 9 | \arguments{ 10 | \item{.df}{A data.frame or data.table} 11 | } 12 | \description{ 13 | Convert to a rowwise tidytable. 14 | } 15 | \examples{ 16 | df <- tidytable(x = 1:3, y = 1:3 * 2, z = 1:3 * 3) 17 | 18 | # Compute the mean of x, y, z in each row 19 | df \%>\% 20 | rowwise() \%>\% 21 | mutate(row_mean = mean(c(x, y, z))) 22 | 23 | # Use c_across() to more easily select many variables 24 | df \%>\% 25 | rowwise() \%>\% 26 | mutate(row_mean = mean(c_across(x:z))) \%>\% 27 | ungroup() 28 | } 29 | -------------------------------------------------------------------------------- /man/select.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/select.R 3 | \name{select} 4 | \alias{select} 5 | \title{Select or drop columns} 6 | \usage{ 7 | select(.df, ...) 8 | } 9 | \arguments{ 10 | \item{.df}{A data.frame or data.table} 11 | 12 | \item{...}{Columns to select or drop. 13 | Use named arguments, e.g. new_name = old_name, to rename selected variables. 14 | \code{tidyselect} compatible.} 15 | } 16 | \description{ 17 | Select or drop columns from a data.table 18 | } 19 | \examples{ 20 | df <- data.table( 21 | x1 = 1:3, 22 | x2 = 1:3, 23 | y = c("a", "b", "c"), 24 | z = c("a", "b", "c") 25 | ) 26 | 27 | df \%>\% 28 | select(x1, y) 29 | 30 | df \%>\% 31 | select(x1:y) 32 | 33 | df \%>\% 34 | select(-y, -z) 35 | 36 | df \%>\% 37 | select(starts_with("x"), z) 38 | 39 | df \%>\% 40 | select(where(is.character), x1) 41 | 42 | df \%>\% 43 | select(new = x1, y) 44 | } 45 | -------------------------------------------------------------------------------- /man/separate_longer_delim.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/separate_longer_delim.R 3 | \name{separate_longer_delim} 4 | \alias{separate_longer_delim} 5 | \title{Split a string into rows} 6 | \usage{ 7 | separate_longer_delim(.df, cols, delim, ...) 8 | } 9 | \arguments{ 10 | \item{.df}{A data.frame or data.table} 11 | 12 | \item{cols}{Columns to separate} 13 | 14 | \item{delim}{Separator delimiting collapsed values} 15 | 16 | \item{...}{These dots are for future extensions and must be empty.} 17 | } 18 | \description{ 19 | If a column contains observations with multiple delimited values, separate 20 | them each into their own row. 21 | } 22 | \examples{ 23 | df <- data.table( 24 | x = 1:3, 25 | y = c("a", "d,e,f", "g,h"), 26 | z = c("1", "2,3,4", "5,6") 27 | ) 28 | 29 | df \%>\% 30 | separate_longer_delim(c(y, z), ",") 31 | } 32 | -------------------------------------------------------------------------------- /man/separate_rows.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/separate_rows.R 3 | \name{separate_rows} 4 | \alias{separate_rows} 5 | \title{Separate a collapsed column into multiple rows} 6 | \usage{ 7 | separate_rows(.df, ..., sep = "[^[:alnum:].]+", convert = FALSE) 8 | } 9 | \arguments{ 10 | \item{.df}{A data.frame or data.table} 11 | 12 | \item{...}{Columns to separate across multiple rows. \code{tidyselect} compatible} 13 | 14 | \item{sep}{Separator delimiting collapsed values} 15 | 16 | \item{convert}{If TRUE, runs \code{type.convert()} on the resulting column. 17 | Useful if the resulting column should be type integer/double.} 18 | } 19 | \description{ 20 | \emph{Superseded} 21 | 22 | \code{separate_rows()} has been superseded by \code{separate_longer_delim()}. 23 | 24 | If a column contains observations with multiple delimited values, 25 | separate them each into their own row. 26 | } 27 | \examples{ 28 | df <- data.table( 29 | x = 1:3, 30 | y = c("a", "d,e,f", "g,h"), 31 | z = c("1", "2,3,4", "5,6") 32 | ) 33 | 34 | separate_rows(df, y, z) 35 | 36 | separate_rows(df, y, z, convert = TRUE) 37 | } 38 | -------------------------------------------------------------------------------- /man/separate_wider_regex.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/separate_wider_regex.R 3 | \name{separate_wider_regex} 4 | \alias{separate_wider_regex} 5 | \title{Separate a character column into multiple columns using regex patterns} 6 | \usage{ 7 | separate_wider_regex( 8 | .df, 9 | cols, 10 | patterns, 11 | ..., 12 | names_sep = NULL, 13 | names_repair = "check_unique", 14 | too_few = "error", 15 | cols_remove = TRUE 16 | ) 17 | } 18 | \arguments{ 19 | \item{.df}{A data frame} 20 | 21 | \item{cols}{Columns to separate} 22 | 23 | \item{patterns}{patterns} 24 | 25 | \item{...}{These dots are for future extensions and must be empty.} 26 | 27 | \item{names_sep}{Names separator} 28 | 29 | \item{names_repair}{Treatment of duplicate names. See \code{?vctrs::vec_as_names} for options/details.} 30 | 31 | \item{too_few}{What to do when too few column names are supplied} 32 | 33 | \item{cols_remove}{Should old columns be removed} 34 | } 35 | \description{ 36 | Separate a character column into multiple columns using regex patterns 37 | } 38 | \examples{ 39 | df <- tidytable(id = 1:3, x = c("m-123", "f-455", "f-123")) 40 | 41 | df \%>\% 42 | separate_wider_regex(x, c(gender = ".", ".", unit = "\\\\d+")) 43 | } 44 | -------------------------------------------------------------------------------- /man/tidytable-vctrs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/vctrs-tidytable.R 3 | \name{tidytable-vctrs} 4 | \alias{tidytable-vctrs} 5 | \title{Internal vctrs methods} 6 | \description{ 7 | These methods are the extensions that allow tidytable objects to 8 | work with vctrs. 9 | } 10 | \keyword{internal} 11 | -------------------------------------------------------------------------------- /man/tidytable.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tidytable.R 3 | \name{tidytable} 4 | \alias{tidytable} 5 | \title{Build a data.table/tidytable} 6 | \usage{ 7 | tidytable(..., .name_repair = "unique") 8 | } 9 | \arguments{ 10 | \item{...}{A set of name-value pairs} 11 | 12 | \item{.name_repair}{Treatment of duplicate names. See \code{?vctrs::vec_as_names} for options/details.} 13 | } 14 | \description{ 15 | Constructs a data.table, but one with nice printing features. 16 | } 17 | \examples{ 18 | tidytable(x = 1:3, y = c("a", "a", "b")) 19 | } 20 | -------------------------------------------------------------------------------- /man/top_n.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/top_n.R 3 | \name{top_n} 4 | \alias{top_n} 5 | \title{Select top (or bottom) n rows (by value)} 6 | \usage{ 7 | top_n(.df, n = 5, wt = NULL, .by = NULL) 8 | } 9 | \arguments{ 10 | \item{.df}{A data.frame or data.table} 11 | 12 | \item{n}{Number of rows to return} 13 | 14 | \item{wt}{Optional. The variable to use for ordering. If NULL uses the last column in the data.table.} 15 | 16 | \item{.by}{Columns to group by} 17 | } 18 | \description{ 19 | Select the top or bottom entries in each group, ordered by \code{wt}. 20 | } 21 | \examples{ 22 | df <- data.table( 23 | x = 1:5, 24 | y = 6:10, 25 | z = c(rep("a", 3), rep("b", 2)) 26 | ) 27 | 28 | df \%>\% 29 | top_n(2, wt = y) 30 | 31 | df \%>\% 32 | top_n(2, wt = y, .by = z) 33 | } 34 | -------------------------------------------------------------------------------- /man/transmute.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/transmute.R 3 | \name{transmute} 4 | \alias{transmute} 5 | \title{Add new variables and drop all others} 6 | \usage{ 7 | transmute(.df, ..., .by = NULL) 8 | } 9 | \arguments{ 10 | \item{.df}{A data.frame or data.table} 11 | 12 | \item{...}{Columns to create/modify} 13 | 14 | \item{.by}{Columns to group by} 15 | } 16 | \description{ 17 | Unlike \code{mutate()}, \code{transmute()} keeps only the variables that you create 18 | } 19 | \examples{ 20 | df <- data.table( 21 | a = 1:3, 22 | b = 4:6, 23 | c = c("a", "a", "b") 24 | ) 25 | 26 | df \%>\% 27 | transmute(double_a = a * 2) 28 | } 29 | -------------------------------------------------------------------------------- /man/tribble.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tribble.R 3 | \name{tribble} 4 | \alias{tribble} 5 | \title{Rowwise tidytable creation} 6 | \usage{ 7 | tribble(...) 8 | } 9 | \arguments{ 10 | \item{...}{Column names as formulas, values below. See example.} 11 | } 12 | \description{ 13 | Create a tidytable using a rowwise setup. 14 | } 15 | \examples{ 16 | tribble( 17 | ~ x, ~ y, 18 | "a", 1, 19 | "b", 2, 20 | "c", 3 21 | ) 22 | } 23 | -------------------------------------------------------------------------------- /man/uncount.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/uncount.R 3 | \name{uncount} 4 | \alias{uncount} 5 | \title{Uncount a data.table} 6 | \usage{ 7 | uncount(.df, weights, .remove = TRUE, .id = NULL) 8 | } 9 | \arguments{ 10 | \item{.df}{A data.frame or data.table} 11 | 12 | \item{weights}{A column containing the weights to uncount by} 13 | 14 | \item{.remove}{If TRUE removes the selected \code{weights} column} 15 | 16 | \item{.id}{A string name for a new column containing a unique identifier for the newly uncounted rows.} 17 | } 18 | \description{ 19 | Uncount a data.table 20 | } 21 | \examples{ 22 | df <- data.table(x = c("a", "b"), n = c(1, 2)) 23 | 24 | uncount(df, n) 25 | 26 | uncount(df, n, .id = "id") 27 | } 28 | -------------------------------------------------------------------------------- /man/unite.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/unite.R 3 | \name{unite} 4 | \alias{unite} 5 | \title{Unite multiple columns by pasting strings together} 6 | \usage{ 7 | unite(.df, col = ".united", ..., sep = "_", remove = TRUE, na.rm = FALSE) 8 | } 9 | \arguments{ 10 | \item{.df}{A data.frame or data.table} 11 | 12 | \item{col}{Name of the new column, as a string.} 13 | 14 | \item{...}{Selection of columns. If empty all variables are selected. 15 | \code{tidyselect} compatible.} 16 | 17 | \item{sep}{Separator to use between values} 18 | 19 | \item{remove}{If TRUE, removes input columns from the data.table.} 20 | 21 | \item{na.rm}{If TRUE, NA values will be not be part of the concatenation} 22 | } 23 | \description{ 24 | Convenience function to paste together multiple columns into one. 25 | } 26 | \examples{ 27 | df <- tidytable( 28 | a = c("a", "a", "a"), 29 | b = c("b", "b", "b"), 30 | c = c("c", "c", NA) 31 | ) 32 | 33 | df \%>\% 34 | unite("new_col", b, c) 35 | 36 | df \%>\% 37 | unite("new_col", where(is.character)) 38 | 39 | df \%>\% 40 | unite("new_col", b, c, remove = FALSE) 41 | 42 | df \%>\% 43 | unite("new_col", b, c, na.rm = TRUE) 44 | 45 | df \%>\% 46 | unite() 47 | } 48 | -------------------------------------------------------------------------------- /pkgdown/extra.css: -------------------------------------------------------------------------------- 1 | #logo { 2 | background-color: white; 3 | } 4 | /* 5 | .navbar { 6 | box-shadow: 0 1px 8px rgba(0,0,0,0.3) !important; 7 | } 8 | 9 | .label-default { 10 | color : #9c0000; 11 | font-weight: 400; 12 | font-size: 50%; 13 | padding: 0px; 14 | background-color: #fff; 15 | } 16 | .navbar-default .navbar-link{ 17 | font-weight: 700; 18 | } 19 | .fa{ 20 | -moz-transition:color .3s ease-in; 21 | -o-transition:color .3s ease-in; 22 | -webkit-transition:color .3s ease-in; 23 | transition : color .3s ease-in; 24 | } 25 | a:hover > .fa-linkedin{ 26 | color : #0073b1!important; 27 | } 28 | 29 | h1, .h1 { 30 | font-size: 36px; 31 | } 32 | h2, .h2 { 33 | font-size: 32px; 34 | } 35 | h3, .h3 { 36 | font-size: 28px; 37 | } 38 | body{ 39 | font-size: 16px; 40 | } 41 | code span, pre span{ 42 | font-size: 13px; 43 | } 44 | code a, pre a { 45 | white-space: nowrap; 46 | } 47 | #logo { 48 | background-color: white; 49 | } 50 | /*h1, .h1, h1 > code, .h1>code, 51 | h2, .h2, h2 > code, .h2>code, 52 | h3, .h3, h3 > code, .h3>code, 53 | h4, .h4, h4 > code, .h4>code, 54 | h5, .h5, h5 > code, .h5>code, 55 | h6, .h6, h6 > code, .h6>code { 56 | color: #9c0000; 57 | col 58 | } 59 | h4, .h4 { 60 | font-size: 56px; 61 | } 62 | h5, .h5 { 63 | font-size: 56px; 64 | } 65 | h6, .h6 { 66 | font-size: 56px; 67 | }*/ 68 | -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/pkgdown/favicon/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/pkgdown/favicon/apple-touch-icon-152x152.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/pkgdown/favicon/apple-touch-icon-180x180.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/pkgdown/favicon/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/pkgdown/favicon/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/pkgdown/favicon/apple-touch-icon.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/pkgdown/favicon/favicon-16x16.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/pkgdown/favicon/favicon-32x32.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/pkgdown/favicon/favicon.ico -------------------------------------------------------------------------------- /revdep/checks.noindex/ConfZIC/ConfZIC_1.0.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/revdep/checks.noindex/ConfZIC/ConfZIC_1.0.1.tar.gz -------------------------------------------------------------------------------- /revdep/checks.noindex/ConfZIC/new/ConfZIC.Rcheck/00install.out: -------------------------------------------------------------------------------- 1 | * installing *source* package ‘ConfZIC’ ... 2 | ** package ‘ConfZIC’ successfully unpacked and MD5 sums checked 3 | ** using staged installation 4 | ** R 5 | ** data 6 | *** moving datasets to lazyload DB 7 | ** inst 8 | ** byte-compile and prepare package for lazy loading 9 | ** help 10 | *** installing help indices 11 | ** building package indices 12 | ** installing vignettes 13 | ** testing if installed package can be loaded from temporary location 14 | ** testing if installed package can be loaded from final location 15 | ** testing if installed package keeps a record of temporary installation path 16 | * DONE (ConfZIC) 17 | -------------------------------------------------------------------------------- /revdep/checks.noindex/ConfZIC/new/ConfZIC.Rcheck/ConfZIC-Ex.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/revdep/checks.noindex/ConfZIC/new/ConfZIC.Rcheck/ConfZIC-Ex.pdf -------------------------------------------------------------------------------- /revdep/checks.noindex/ConfZIC/old/ConfZIC.Rcheck/00install.out: -------------------------------------------------------------------------------- 1 | * installing *source* package ‘ConfZIC’ ... 2 | ** package ‘ConfZIC’ successfully unpacked and MD5 sums checked 3 | ** using staged installation 4 | ** R 5 | ** data 6 | *** moving datasets to lazyload DB 7 | ** inst 8 | ** byte-compile and prepare package for lazy loading 9 | ** help 10 | *** installing help indices 11 | ** building package indices 12 | ** installing vignettes 13 | ** testing if installed package can be loaded from temporary location 14 | ** testing if installed package can be loaded from final location 15 | ** testing if installed package keeps a record of temporary installation path 16 | * DONE (ConfZIC) 17 | -------------------------------------------------------------------------------- /revdep/checks.noindex/ConfZIC/old/ConfZIC.Rcheck/ConfZIC-Ex.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/revdep/checks.noindex/ConfZIC/old/ConfZIC.Rcheck/ConfZIC-Ex.pdf -------------------------------------------------------------------------------- /revdep/checks.noindex/CooRTweet/CooRTweet_2.0.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markfairbanks/tidytable/a99665c84410e9451b8717f1b1157177ba1f9852/revdep/checks.noindex/CooRTweet/CooRTweet_2.0.2.tar.gz -------------------------------------------------------------------------------- /revdep/checks.noindex/CooRTweet/new/CooRTweet.Rcheck/00install.out: -------------------------------------------------------------------------------- 1 | * installing *source* package ‘CooRTweet’ ... 2 | ** package ‘CooRTweet’ successfully unpacked and MD5 sums checked 3 | ** using staged installation 4 | ** R 5 | ** data 6 | *** moving datasets to lazyload DB 7 | ** inst 8 | ** byte-compile and prepare package for lazy loading 9 | ** help 10 | *** installing help indices 11 | ** building package indices 12 | ** installing vignettes 13 | ** testing if installed package can be loaded from temporary location 14 | ** testing if installed package can be loaded from final location 15 | ** testing if installed package keeps a record of temporary installation path 16 | * DONE (CooRTweet) 17 | -------------------------------------------------------------------------------- /revdep/checks.noindex/CooRTweet/new/CooRTweet.Rcheck/CooRTweet-Ex.R: -------------------------------------------------------------------------------- 1 | pkgname <- "CooRTweet" 2 | source(file.path(R.home("share"), "R", "examples-header.R")) 3 | options(warn = 1) 4 | library('CooRTweet') 5 | 6 | base::assign(".oldSearch", base::search(), pos = 'CheckExEnv') 7 | base::assign(".old_wd", base::getwd(), pos = 'CheckExEnv') 8 | cleanEx() 9 | nameEx("prep_data") 10 | ### * prep_data 11 | 12 | flush(stderr()); flush(stdout()) 13 | 14 | ### Name: prep_data 15 | ### Title: prep_data 16 | ### Aliases: prep_data 17 | 18 | ### ** Examples 19 | 20 | dt <- data.table::data.table(old_object_id = 1:3, old_account_id_y = 4:6) 21 | dt <- prep_data(dt, object_id = "old_object_id", account_id = "old_account_id_y") 22 | 23 | 24 | 25 | 26 | ### *