Single-table verbs

arrange

Arrange rows by variables

distinct

Select distinct/unique rows

do

Do anything

filter

Return rows with matching conditions

group_by ungroup

Group by one or more variables

mutate transmute

Add new variables

select rename

Select/rename variables by name

current_vars starts_with ends_with contains matches num_range one_of everything

Select helpers

sample_n sample_frac

Sample n rows from a table

summarise summarize

Reduces multiple values down to a single value

pull

Pull out a single variable

slice

Select rows by position

Single-table helpers

tally count add_tally add_count

Count/tally observations by group

top_n

Select top (or bottom) n rows (by value)

scoped

Operate on a selection of variables

filter_all filter_if filter_at

Filter within a selection of variables

group_by_all group_by_at group_by_if

Group by a selection of variables

select_all rename_all select_if rename_if select_at rename_at

Select and rename a selection of variables

summarise_all summarise_if summarise_at summarize_all summarize_if summarize_at mutate_all mutate_if mutate_at transmute_all transmute_if transmute_at

Summarise and mutate multiple columns.

all_vars any_vars

Apply predicate to all variables

vars

Select variables

funs

Create a list of functions calls.

Two-table verbs

all_equal all.equal

Flexible equality comparison for data frames

bind_rows bind_cols combine

Efficiently bind multiple data frames by row and column

intersect union union_all setdiff setequal

Set operations

inner_join left_join right_join full_join semi_join anti_join

Join two tbls together

inner_join left_join right_join full_join semi_join anti_join

Join data frame tbls

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 as.tbl

Create a table from a data source

src_mysql src_postgres src_sqlite

Source for database backends

sql

SQL escaping.

Metadata

groups group_vars

Return grouping variables

Vector functions

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

lead lag

Lead and lag.

order_by

A helper function for ordering window function output

n

The number of observations in the current group.

n_distinct

Efficiently count the number of unique values in a set of vector

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 membership

nasa

NASA spatio-temporal data

starwars

Starwars characters

storms

Storm tracks data

Other backends

tbl_cube

A data cube tbl

as.table as.data.frame as_data_frame

Coerce a tbl_cube to other data structures

as.tbl_cube

Coerce an existing data structure into a tbl_cube

rowwise

Group input by rows