Skip to contents

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.