Description Usage Arguments Value Examples
View source: R/reshape_for_binomials.R
reshape dataframe from long format to wide format.
1 | reshape_for_binomials(data_df, gender_col, level)
|
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. |
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
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.