arrange() Order rows using column values distinct() Keep distinct/unique rows filter() Keep rows that match a condition slice() slice_head() slice_tail() slice_min() slice_max() slice_sample() Subset rows using their positions
Verbs that principally operate on columns.
glimpse Get a glimpse of your data mutate() Create, modify, and delete columns pull() Extract a single column relocate() Change column order rename() rename_with() Rename columns select() Keep or drop columns using their names and types
Verbs that principally operate on groups of rows.
count() tally() add_count() add_tally() Count the observations in each group group_by() ungroup() Group by one or more variables dplyr_by Per-operation grouping with .by / by rowwise() Group input by rows summarise() summarize() Summarise each group down to one row reframe() Transform each group to an arbitrary number of rows n() cur_group() cur_group_id() cur_group_rows() cur_column() Information about the "current" group or variable
Verbs that principally operate on pairs of data frames.
Pair these functions with mutate() , summarise() , filter() , and group_by() to operate on multiple columns simultaneously.
across() if_any() if_all() Apply a function (or functions) across multiple columns c_across() Combine values from multiple columns pick() Select a subset of columns
Unlike other dplyr functions, these functions work on individual vectors, not data frames.
between() Detect where values fall in a specified range case_match() A general vectorised switch() case_when() A general vectorised if-else coalesce() Find the first non-missing element consecutive_id() Generate a unique identifier for consecutive combinations cumall() cumany() cummean() Cumulativate versions of any, all, and mean desc() Descending order if_else() Vectorised if-else lag() lead() Compute lagged or leading values n_distinct() Count unique combinations na_if() Convert values to NA near() Compare two numeric vectors nth() first() last() Extract the first, last, or nth value from a vector ntile() Bucket a numeric vector into n groups order_by() A helper function for ordering window function output percent_rank() cume_dist() Proportional ranking functions recode() recode_factor() Recode values row_number() min_rank() dense_rank() Integer ranking functions
This (mostly) experimental family of functions are used to manipulate groups in various ways.
group_cols() Select grouping variables group_map() group_modify() group_walk() Apply a function to each group group_trim() Trim grouping structure
Superseded functions have been replaced by new approaches that we believe to be superior, but we don’t want to force you to change until you’re ready, so the existing functions will stay around for several years.
sample_n() sample_frac() Sample n rows from a table top_n() top_frac() Select top (or bottom) n rows (by value) scoped Operate on a selection of variables all_vars() any_vars() Apply predicate to all variables vars() Select variables with_groups() Perform an operation with temporary groups
auto_copy() Copy tables to same source, if necessary compute() collect() collapse() Force computation of a database query copy_to() Copy a local data frame to a remote src ident() Flag a character vector as SQL identifiers explain() show_query() Explain details of a tbl tbl() is.tbl() Create a table from a data source sql() SQL escaping.
Site built with pkgdown 2.0.7.