Skip to content

One table verbs

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
glimpse
Get a glimpse of your data
mutate() transmute()
Create, modify, and delete columns
pull()
Extract a single column
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

bind_rows() bind_cols()
Efficiently bind multiple data frames by row and column
reexports
Objects exported from other packages
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

group_by() ungroup()
Group by one or more variables
group_cols()
Select grouping variables
rowwise()
Group input by rows

Vector functions

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

band_members band_instruments band_instruments2
Band membership
starwars
Starwars characters
storms
Storm tracks data

Remote tables

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.

Experimental

Experimental functions are a testing ground for new approaches that we believe to be worthy of greater exposure. There is no guarantee that these functions will stay around in the future, so please reach out if you find them useful.

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_append() rows_update() rows_patch() rows_upsert() rows_delete()
Manipulate individual rows

Questioning

We have our doubts about questioning functions. We’re not certain that they’re inadequate, or we don’t have a good replacement in mind, but these functions are at risk of removal in the future.

all_equal()
Flexible equality comparison for data frames

Superseded

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