Skip to contents

Return keys nearest to a given statistics or summary.

Usage

keys_near(.data, ...)

# S3 method for default
keys_near(.data, ...)

Arguments

.data

tsibble

...

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

Value

data.frame containing keys closest to a given statistic.

Examples

keys_near(heights, height_cm)
#> # A tibble: 18 × 5
#>    country          height_cm stat  stat_value stat_diff
#>    <chr>                <dbl> <fct>      <dbl>     <dbl>
#>  1 Denmark               183. max         183.   0      
#>  2 Ethiopia              167. med         167.   0.00900
#>  3 Ghana                 164. q_25        164.   0      
#>  4 Hungary               164. q_25        164.   0      
#>  5 Italy                 164. q_25        164.   0      
#>  6 Italy                 164. q_25        164.   0      
#>  7 Liberia               167. med         167.   0.00900
#>  8 Morocco               170. q_75        170.   0.00392
#>  9 Mozambique            164. q_25        164.   0      
#> 10 Mozambique            164. q_25        164.   0      
#> 11 Pakistan              164. q_25        164.   0      
#> 12 Papua New Guinea      152. min         152.   0      
#> 13 Romania               164. q_25        164.   0      
#> 14 Romania               164. q_25        164.   0      
#> 15 Sierra Leone          164. q_25        164.   0      
#> 16 Slovakia              164. q_25        164.   0      
#> 17 Ukraine               164. q_25        164.   0      
#> 18 Ukraine               164. q_25        164.   0