Calculating the percentage of women in a county
The dataset includes columns for the total number (not percentage) of men and women in each county. You could use this, along with the population variable, to compute the fraction of men (or women) within each county.
In this exercise, you'll select the relevant columns yourself.
Ця вправа є частиною курсу
Data Manipulation with dplyr
Інструкції до вправи
- Select the columns
state,county,population,men, andwomen. - Add a new variable called
proportion_womenwith the fraction of the county's population made up of women.
Інтерактивна практична вправа
Спробуйте виконати цю вправу, доповнивши цей зразок коду.
counties_selected <- counties %>%
# Select the columns state, county, population, men, and women
___
counties_selected %>%
# Calculate proportion_women as the fraction of the population made up of women
___