R/count_keys.R
count_keys.Rd
Give this function as many data frames as you want and the key and it tells you how many unique values are in each data frame for the keys you specify.
count_keys(..., df_names = NULL, keys)
... | enter as many data frames as you would like |
---|---|
df_names | the data frame names |
keys | the primary key or other key you wish to analyze |
count_keys(demographics, math, ell, keys = c("student_id", "year"))#> # A tibble: 30,000 x 5 #> student_id year demographics math ell #> <chr> <dbl> <int> <int> <int> #> 1 S1000227 2015 1 1 0 #> 2 S1000227 2016 1 0 0 #> 3 S1000227 2017 1 1 0 #> 4 S1002738 2015 1 1 0 #> 5 S1002738 2016 1 1 0 #> 6 S1002738 2017 1 1 0 #> 7 S1003071 2015 1 1 0 #> 8 S1003071 2016 1 0 0 #> 9 S1003071 2017 1 1 0 #> 10 S100408 2015 1 0 0 #> # ... with 29,990 more rowscount_keys(list(demographics, math, ell), df_names = c("demographics", "math", "ell"), keys = c("student_id", "year"))#> # A tibble: 30,000 x 5 #> student_id year demographics math ell #> <chr> <dbl> <int> <int> <int> #> 1 S1000227 2015 1 1 0 #> 2 S1000227 2016 1 0 0 #> 3 S1000227 2017 1 1 0 #> 4 S1002738 2015 1 1 0 #> 5 S1002738 2016 1 1 0 #> 6 S1002738 2017 1 1 0 #> 7 S1003071 2015 1 1 0 #> 8 S1003071 2016 1 0 0 #> 9 S1003071 2017 1 1 0 #> 10 S100408 2015 1 0 0 #> # ... with 29,990 more rows