Challenge: Clean Data
Follow the instructions to solve the challenge.
We'll cover the following
Find the total age
In this exercise, you need to calculate the total age of the people in the final data frame produced as a result of the instructions below. We use the infert
dataset in this exercise. Follow the instructions step by step to reach the result:
- Call the dataset by typing
infert
. - Convert the data in the
case
column into logical data types. - Create a new column named
age_status
. Set the value in the new column asBA
for every row in which the age of the person is below average. Otherwise, set the value asAA
. - Filter all rows with the
age_status
column equal toBA
, thecase
column equal toTRUE
, and theparity
column not less than 4. - Select the age column of the filtered data.
Finally, sum up all the values, and name the outcome result
.
Get hands-on with 1400+ tech skills courses.