reshape_for_binomials {GenderInfer} | R Documentation |
Reshape the dataframe to make it easier to carry out binomial calculations.
Description
reshape dataframe from long format to wide format.
Usage
reshape_for_binomials(data_df, gender_col, level)
Arguments
data_df |
dataframe containing the columns gender and counts |
gender_col |
the name of the column containing the gender values. |
level |
variable to compare for the baseline. |
Value
The output is a dataframe containing more columns than the input one, such as:
level : the variable used to perform the binomials total_for_level: the total amount of each gender including unknowns total_female_male: the total amount of male and female female_percentage: the percentage of female in the total_female_male male_percentage: the percentage of male in the total_female_male
Examples
authors_df <- assign_gender(data_df = authors, first_name_col = "first_name")
female_count <- dplyr::count(authors_df, gender)
## create a new data frame to be used for the binomial calculation.
df_gender <- reshape_for_binomials(data = female_count, gender_col = "gender",
level = 2020)
[Package GenderInfer version 0.1.0 Index]