A wrapper around ind_plots that first draws a
sample of n individuals (9 by default, enough to fill a 3x3 page)
rather than plotting every individual in the dataset. If stratify is
provided, the sample is drawn proportionally from each level (or
combination of levels) of the tidyselect-ed column(s), so the sample
remains as representative as the data and n allow.
ind_plots_sample(
xpdb,
n = 9,
stratify = NULL,
seed = NULL,
facets,
.problem,
quiet,
...
)The desired plot
<xp_xtras> or <xpose_data> object
<integer> Number of individuals to sample. Defaults to 9. If
fewer individuals than n are available, all of them are used.
<tidyselect> Optional column(s), other than the id
column, to stratify the sample by.
<integer> Optional seed, set (and restored on exit) for
reproducible sampling.
As in ind_plots. Defaults to the id
column (and stratify column(s), if given) added to
xpdb$xp_theme$facets.
<numeric> Problem number to use.
<logical> Silence extra output.
Passed on to ind_plots
When stratify is used, the stratifying column(s) are appended to the
facet formula (in addition to the id column that ind_plots
already facets by), so that the stratum each sampled individual belongs
to is visible in the plot.
Stratified sample sizes are allocated proportionally to stratum size
using the largest-remainder method, so the total sampled always equals
min(n, sum(individuals available across all strata)).
ind_roc()
xpdb_x %>% ind_plots_sample(n = 6)
xpdb_x %>% ind_plots_sample(n = 6, stratify = SEX)
Run the code above in your browser using DataLab