ff_summ_count_unique_by_groups: By Multiple Groups, Count the Number of Unique Observations...

Description Usage Arguments Value Author(s) References Examples

View source: R/ff_summ_count.R

Description

We have multiple groups (country, village), we want to know the number of unique observations within these groups. In addition, we also want to generate the total number of observations for each variable within these country/village groups, these total observations includes multiple values for each unique individual.

Usage

1
2
3
4
5
ff_summ_count_unique_by_groups(
  df,
  ar_svr_group = c("S.country", "vil.id"),
  svr_unique_identifier = "indi.id"
)

Arguments

df

dataframe input dataframe of interest

ar_svr_group

array string array of variables to group by

svr_unique_identifier

string variable that has the unique key of interest

Value

a dataframe with stats outputs.

Author(s)

Fan Wang, http://fanwangecon.github.io

References

https://fanwangecon.github.io/REconTools/reference/ff_summ_count_unique_by_groups.html https://github.com/FanWangEcon/REconTools/blob/master/R/ff_summ_count.R

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
df_uniques_count_by_vil <- ff_summ_count_unique_by_groups(df_hgt_wgt,
                         ar_svr_group=c('S.country', 'vil.id'),
                         svr_unique_identifier = 'indi.id')
print(df_uniques_count_by_vil, n=50)
df_uniques_count_by_mth <- ff_summ_count_unique_by_groups(df_hgt_wgt,
                         ar_svr_group=c('S.country', 'svymthRound'),
                         svr_unique_identifier = 'indi.id')
print(df_uniques_count_by_mth, n=50)
df_uniques_count_by_country <- ff_summ_count_unique_by_groups(df_hgt_wgt,
                         ar_svr_group=c('S.country'),
                         svr_unique_identifier = 'indi.id')
print(df_uniques_count_by_country)

FanWangEcon/REconTools documentation built on Jan. 21, 2022, 10:28 p.m.