sample_n_groups: Sample random groups from a dataframe with NSE

Description Usage Arguments Value Examples

View source: R/data_frames.R

Description

Groups a dataframe by the specified feature, selects n of these groups and discards the rest. Returned dataframe is ungrouped.

Usage

1
sample_n_groups(df, group_var, n)

Arguments

df

A data frame or data frame like object recognized by dplyr

group_var

Feature to group by. Uses NSE like dplyr verbs.

n

Number of groups to take. If there are fewer than n groups, uses the

Value

Dataframe with n random groups selected according to specified grouping feature.

Examples

1

alexpghayes/hayeslib documentation built on May 5, 2019, 4:47 p.m.