sample_row: Sampling one row from a nested dataframe. The sampling could...

View source: R/samplesubset.R

sample_rowR Documentation

Sampling one row from a nested dataframe. The sampling could be done either randomly or a specific row could be indicated.

Description

The default type of return is list, which will return the data frame as the first item, and grouping variables as other items in the list. If the return type is indicated as df, this function can also return a dataframe with the nested data, and grouping variables will be transformed as columns with identical values.

Usage

sample_row(nest_df, index, type = "list")

Arguments

nest_df

The nested dataframe to be sampled from. The right-most column must be a dataframe type with name 'data'.

index

Optional. The index of the dataframe to be sampled from. If no index is provided, a random subset will be returned.

type

Optional. 'list' or 'df'. The type of return data structure. List is the default.


wanjiag/ezPurrr documentation built on May 10, 2022, 9:32 p.m.