sample-n-frac-keys: Sample a number or fraction of keys to explore

sample-n-frac-keysR Documentation

Sample a number or fraction of keys to explore

Description

Sample a number or fraction of keys to explore

Usage

sample_n_keys(.data, size)

sample_frac_keys(.data, size)

Arguments

.data

tsibble object

size

The number or fraction of observations, depending on the function used. In sample_n_keys, it is a number > 0, and in sample_frac_keys it is a fraction, between 0 and 1.

Value

tsibble with fewer observations of key

Examples

library(ggplot2)
sample_n_keys(heights,
             size = 10) %>%
  ggplot(aes(x = year,
             y = height_cm,
             group = country)) + 
  geom_line()
library(ggplot2)
sample_frac_keys(wages,
                0.1) %>%
  ggplot(aes(x = xp,
             y = unemploy_rate,
             group = id)) + 
  geom_line()

brolgar documentation built on June 22, 2024, 11:24 a.m.