Closed njtierney closed 5 years ago
It is a very handy function, and I find that the other ways of getting the same piece of information are somewhat cumbersome:
library(brolgar) library(tsibble) l_n_obs(wages_ts) #> # A tibble: 888 x 2 #> id n_obs #> <int> <int> #> 1 31 8 #> 2 36 10 #> 3 53 8 #> 4 122 10 #> 5 134 12 #> 6 145 9 #> 7 155 11 #> 8 173 6 #> 9 206 3 #> 10 207 11 #> # … with 878 more rows wages_ts %>% features(id, length) #> # A tibble: 888 x 2 #> id V1 #> <int> <int> #> 1 31 8 #> 2 36 10 #> 3 53 8 #> 4 122 10 #> 5 134 12 #> 6 145 9 #> 7 155 11 #> 8 173 6 #> 9 206 3 #> 10 207 11 #> # … with 878 more rows wages_ts %>% features(!!index(wages_ts), length) #> # A tibble: 888 x 2 #> id V1 #> <int> <int> #> 1 31 8 #> 2 36 10 #> 3 53 8 #> 4 122 10 #> 5 134 12 #> 6 145 9 #> 7 155 11 #> 8 173 6 #> 9 206 3 #> 10 207 11 #> # … with 878 more rows wages_ts %>% features(!!index(wages_ts), list(n_obs = length)) #> # A tibble: 888 x 2 #> id n_obs #> <int> <int> #> 1 31 8 #> 2 36 10 #> 3 53 8 #> 4 122 10 #> 5 134 12 #> 6 145 9 #> 7 155 11 #> 8 173 6 #> 9 206 3 #> 10 207 11 #> # … with 878 more rows
Created on 2019-07-11 by the reprex package (v0.2.1)
So then, what can I call it?
How about n_key_obs()?
n_key_obs()
It is a very handy function, and I find that the other ways of getting the same piece of information are somewhat cumbersome:
Created on 2019-07-11 by the reprex package (v0.2.1)
So then, what can I call it?