g_sample: Sample groups from a table

Description Usage Arguments See Also Examples

Description

using group_by with sample returns a sample of the observations within a group. This function instead returns all observations for a sample of groups.

Usage

1
2
3

Arguments

tbl

tbl of data

group

grouping variable

...

Arguments passed on to dplyr::sample_frac

size

For sample_n(), the number of rows to select. For sample_frac(), the fraction of rows to select. If tbl is grouped, size applies to each group.

replace

Sample with or without replacement?

weight

Sampling weights. This must evaluate to a vector of non-negative numbers the same length as the input. Weights are automatically standardised to sum to 1.

This argument is automatically quoted and later evaluated in the context of the data frame. It supports unquoting. See vignette("programming") for an introduction to these concepts.

See Also

See sample for details on sample function.

Examples

1
2

williamlief/liefTools documentation built on Jan. 1, 2020, 6:48 p.m.