Dplyr
Reference of datar.dplyr
Reference map of r-tidyverse-dplyr can be found here.
Legend:
| Sample | Status |
|---|---|
| normal | API that is regularly ported |
| API that is not ported, or not an API originally | |
| bold | API that is unique in datar |
| italic | Working in process |
One table verbs
| API | Description | Notebook example |
|---|---|---|
| arrange() | Arrange rows by column values | |
| count() tally() add_count() add_tally() | Count observations by group | |
| distinct() | Subset distinct/unique rows | |
| filter() | Subset rows using column values | |
| mutate() transmute() | Create, modify, and delete columns | |
| pull() | Extract a single column | |
| reframe() | Reframe a data frame | |
| relocate() | Change column order | |
| rename() rename_with() | Rename columns | |
| select() | Subset columns using their names and types | |
| summarise() summarize() | Summarise each group to fewer rows | |
| slice() slice_head() slice_tail() slice_min() slice_max() slice_sample() | Subset rows using their positions |
Two table verbs
| API | Description | Notebook example |
|---|---|---|
| bind_rows() bind_cols() | Efficiently bind multiple data frames by row and column | |
| intersect() setdiff() setequal() union() | Set operations on data frame | |
| all_of() any_of() contains() ends_with() everything() last_col() matches() num_range() one_of() starts_with() | Select variables from character vectors | |
| union_all() | Set operations | |
| inner_join() left_join() right_join() full_join() | Mutating joins | |
| nest_join() | Nest join | |
| semi_join() anti_join() | Filtering joins |
Grouping
| API | Description | Notebook example |
|---|---|---|
| group_by() ungroup() | Group by one or more variables | |
| group_cols() group_vars() | Select grouping variables | |
| rowwise() | Group input by rows |
Vector functions
| API | Description | Notebook example |
|---|---|---|
| across() if_any() if_all() | Apply a function (or functions) across multiple columns | |
| c_across() | Combine values from multiple columns | |
| between() | Do values in a numeric vector fall in specified range? | |
| case_when() | A general vectorised if | |
| coalesce() | Find first non-missing element | |
| cumall() cumany() cummean() | Cumulativate versions of any, all, and mean | |
| desc() | Descending order | |
| if_else() | Vectorised if | |
| lag() lead() | Compute lagged or leading values | |
| order_by() | A helper function for ordering window function output | |
| n() cur_data() cur_data_all() cur_group() cur_group_id() cur_group_rows() cur_column() | Context dependent expressions | |
| n_distinct() | Efficiently count the number of unique values in a set of vectors | |
| na_if() | Convert values to NA | |
| near() | Compare two numeric vectors | |
| nth() first() last() | Extract the first, last or nth value from a vector | |
| row_number() ntile() min_rank() dense_rank() percent_rank() cume_dist() | Windowed rank functions. | |
| recode() recode_factor() | Recode values |
Data
See datasets
Remote tables
Experimental
| API | Description | Notebook example |
|---|---|---|
| group_map() group_modify() group_walk() | Apply a function to each group | |
| group_trim() | Trim grouping structure | |
| group_split() | Split data frame by groups | |
| with_groups() | Perform an operation with temporary groups | |
| rows_insert() rows_update() rows_patch() rows_upsert() rows_delete() | Manipulate individual rows |