reshape_for_binomials: Reshape the dataframe to make it easier to carry out binomial...

Description Usage Arguments Value Examples

View source: R/reshape_for_binomials.R

Description

reshape dataframe from long format to wide format.

Usage

1
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

1
2
3
4
5
6
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)

GenderInfer documentation built on Sept. 29, 2021, 9:07 a.m.