keys_near.tbl_ts: Return keys nearest to a given statistics or summary.

View source: R/keys_near.R

keys_near.tbl_tsR Documentation

Return keys nearest to a given statistics or summary.

Description

Return keys nearest to a given statistics or summary.

Usage

## S3 method for class 'tbl_ts'
keys_near(.data, var, top_n = 1, funs = l_five_num, stat_as_factor = TRUE, ...)

Arguments

.data

tsibble

var

variable to summarise

top_n

top number of closest observations to return - default is 1, which will also return ties.

funs

named list of functions to summarise by. Default is a given list of the five number summary, l_five_num.

stat_as_factor

coerce stat variable into a factor? Default is TRUE.

...

extra arguments to pass to mutate_at when performing the summary as given by funs.

Examples

               
# Return observations closest to the five number summary of height_cm
heights %>%
  keys_near(var = height_cm)
               

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