Data Set II - Time Use by Gender and Country

This data set was posted by Nicholas Schettini. “I found this dataset on time use by gender and by country. Some of the variables include eating, sleeping, employment, travel, school, study, walking the dog, etc. It seems you could analyze how males vs. females spend their time, and how each countries males and females compare to each other. Maybe certain countries spend more time doing something more than another country; same goes for gender.”

My goals with this data set are as follows:

(-) Load, Tidy, and transform the data set.
(-) Investigate the eating habits by gender and country.
(-) Investigate the dish washing habits by gender and country.

Load Libraries

library("tidyverse")
## -- Attaching packages ------------------------------------------------------------------------------------------------------------------------ tidyverse 1.2.1 --
## v ggplot2 2.2.1     v purrr   0.2.4
## v tibble  1.4.2     v dplyr   0.7.4
## v tidyr   0.8.0     v stringr 1.2.0
## v readr   1.1.1     v forcats 0.2.0
## -- Conflicts --------------------------------------------------------------------------------------------------------------------------- tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library("DT")

Load Data

data <- read.csv("data/TimeUse.csv", sep = ",", header = TRUE, stringsAsFactors = FALSE,fileEncoding = "UTF-8-BOM")

Preview Data

str(data)
## 'data.frame':    28 obs. of  58 variables:
##  $ SEX                                                                            : chr  "Males" "Males" "Males" "Males" ...
##  $ GEO.ACL00                                                                      : chr  "Belgium" "Bulgaria" "Germany (including  former GDR from 1991)" "Estonia" ...
##  $ Total                                                                          : chr  "24:00" "24:00" "24:00" "24:00" ...
##  $ Personal.care                                                                  : chr  "10:45" "11:54" "10:40" "10:35" ...
##  $ Sleep                                                                          : chr  "8:15" "9:08" "8:08" "8:24" ...
##  $ Eating                                                                         : chr  "1:49" "2:07" "1:43" "1:19" ...
##  $ Other.and.or.unspecified.personal.care                                         : chr  "0:42" "0:39" "0:49" "0:52" ...
##  $ Employment..related.activities.and.travel.as.part.of.during.main.and.second.job: chr  "3:07" "3:32" "3:27" "4:27" ...
##  $ Main.and.second.job.and.related.travel                                         : chr  "3:05" "3:27" "3:21" "4:20" ...
##  $ Activities.related.to.employment.and.unspecified.employment                    : chr  "0:02" "0:04" "0:06" "0:07" ...
##  $ Study                                                                          : chr  "0:11" "0:03" "0:15" "0:06" ...
##  $ School.and.university.except.homework                                          : chr  "0:05" "0:02" "0:06" "0:03" ...
##  $ Homework                                                                       : chr  "0:03" "0:01" "0:05" "0:02" ...
##  $ Free.time.study                                                                : chr  "0:03" "0:00" "0:04" "0:02" ...
##  $ Household.and.family.care                                                      : chr  "2:28" "2:37" "2:22" "2:33" ...
##  $ Food.management.except.dish.washing                                            : chr  "0:22" "0:15" "0:16" "0:21" ...
##  $ Dish.washing                                                                   : chr  "0:10" "0:05" "0:08" "0:06" ...
##  $ Cleaning.dwelling                                                              : chr  "0:08" "0:06" "0:11" "0:09" ...
##  $ Household.upkeep.except.cleaning.dwelling                                      : chr  "0:18" "0:22" "0:14" "0:22" ...
##  $ Laundry                                                                        : chr  "0:01" "0:01" "0:02" "0:01" ...
##  $ Ironing                                                                        : chr  "0:01" "0:00" "0:01" "0:00" ...
##  $ Handicraft.and.producing.textiles.and.other.care.for.textiles                  : chr  "0:00" "0:00" "0:00" "0:01" ...
##  $ Gardening..other.pet.care                                                      : chr  "0:19" "0:36" "0:17" "0:16" ...
##  $ Tending.domestic.animals                                                       : chr  "0:00" "0:32" "0:01" "0:04" ...
##  $ Caring.for.pets                                                                : chr  "0:03" "0:01" "0:03" "0:01" ...
##  $ Walking.the.dog                                                                : chr  "0:05" "0:02" "0:03" "0:05" ...
##  $ Construction.and.repairs                                                       : chr  "0:19" "0:16" "0:19" "0:29" ...
##  $ Shopping.and.services                                                          : chr  "0:24" "0:13" "0:29" "0:20" ...
##  $ Childcare..except.teaching..reading.and.talking                                : chr  "0:05" "0:02" "0:05" "0:06" ...
##  $ Teaching..reading.and.talking.with.child                                       : chr  "0:04" "0:05" "0:05" "0:04" ...
##  $ Household.management.and.help.family.member                                    : chr  "0:08" "0:01" "0:09" "0:06" ...
##  $ Leisure..social.and.associative.life                                           : chr  "5:58" "4:46" "5:42" "5:02" ...
##  $ Organisational.work                                                            : chr  "0:07" "0:00" "0:09" "0:02" ...
##  $ Informal.help.to.other.households                                              : chr  "0:00" "0:09" "0:08" "0:15" ...
##  $ Participatory.activities                                                       : chr  "0:03" "0:01" "0:04" "0:01" ...
##  $ Visiting.and.feasts                                                            : chr  "0:32" "0:04" "0:17" "0:04" ...
##  $ Other.social.life                                                              : chr  "0:23" "0:37" "0:45" "0:26" ...
##  $ Entertainment.and.culture                                                      : chr  "0:10" "0:01" "0:14" "0:05" ...
##  $ Resting                                                                        : chr  "0:27" "0:10" "0:16" "0:21" ...
##  $ Walking.and.hiking                                                             : chr  "0:12" "0:16" "0:13" "0:10" ...
##  $ Sports.and.outdoor.activities.except.walking.and.hiking                        : chr  "0:15" "0:10" "0:15" "0:13" ...
##  $ Computer.games                                                                 : chr  "0:05" "0:00" "0:05" "0:01" ...
##  $ Computing                                                                      : chr  "0:22" "0:01" "0:16" "0:02" ...
##  $ Hobbies.and.games.except.computing.and.computer.games                          : chr  "0:13" "0:11" "0:18" "0:05" ...
##  $ Reading.books                                                                  : chr  "0:06" "0:06" "0:06" "0:14" ...
##  $ Reading..except.books                                                          : chr  "0:22" "0:15" "0:31" "0:23" ...
##  $ TV.and.video                                                                   : chr  "2:35" "2:41" "1:58" "2:29" ...
##  $ Radio.and.music                                                                : chr  "0:05" "0:06" "0:05" "0:11" ...
##  $ Unspecified.leisure                                                            : chr  "0:01" "0:01" "0:00" "0:00" ...
##  $ Travel.except.travel.related.to.jobs                                           : chr  "1:30" "1:07" "1:29" "1:12" ...
##  $ Travel.to.from.work                                                            : chr  "0:25" "0:23" "0:27" "0:28" ...
##  $ Travel.related.to.study                                                        : chr  "0:02" "0:00" "0:02" "0:01" ...
##  $ Travel.related.to.shopping.and.services                                        : chr  "0:16" "0:12" "0:16" "0:13" ...
##  $ Transporting.a.child                                                           : chr  "0:03" "0:01" "0:02" "0:01" ...
##  $ Travel.related.to.other.household.purposes                                     : chr  "0:00" "0:06" "0:05" "0:07" ...
##  $ Travel.related.to.leisure..social.and.associative.life                         : chr  "0:15" "0:21" "0:34" "0:22" ...
##  $ Unspecified.travel                                                             : chr  "0:30" "0:03" "0:03" "0:01" ...
##  $ Unspecified.time.use                                                           : chr  "0:01" "0:02" "0:05" "0:04" ...

This data set has a whopping 58 variables. Majority of them represent the time spent on certain activities.
The first order of business is to convert this data set from a “wide” structure to a more tidy version.

Data Cleaning

  1. Use the gather function to create row inputs for these activities under a variable called TimeSpent.
data <- gather(data, "Activity", "TimeSpent", 4:58)
datatable(data, options = list(filter = FALSE),filter="top")

The TimeSpent variable is not easily quantifiable, as it is not numerical.
The variable Total is not necessary anymore as it only shows the total hours in the day, but we will leave it as is.

  1. Use mutate to create a variable that represents TimeSpent in minutes.
data <- mutate(data, TimeSpentMinutes = strtoi(as.difftime(TimeSpent, format = "%H:%M", units = "mins")))
datatable(data, options = list(filter = FALSE),filter="top")

Data Analysis

  1. Investigate the eating habits across gender and country.
pData <- select(data,everything()) %>% 
          filter(`Activity` == 'Eating') %>% # filter data to get time spent eating
          group_by(`GEO.ACL00`,`SEX`) %>% # group data by country, gender 
          summarise(`time`=sum(`TimeSpentMinutes`) ) # calculate total minutes for each group 

# plot the data, flip axis so the countries are legible
ggplot(data = pData, aes(x = `GEO.ACL00`, y = `time`,fill=`SEX`, label = time)) + 
                geom_bar(stat = "identity") + 
                geom_text(size = 3, position = position_stack(vjust = 0.5)) + 
                coord_flip() +
                xlab("Country") +
                ylab("Time Spent (minutes)") +
                scale_fill_brewer(palette = "Set1") +
                labs(title = "Timp Spent Eating", fill = "Gender")

The plot shows that the French spend the most time eating, this is true for both males and females. Estonia spend the least time eating, for both males and females.

Overall, do males or eat sleep more?

Total time spent eating - Males:

sum(filter(pData, SEX == 'Males')$time)
## [1] 1403

Total time spent eating - Females:

sum(filter(pData, SEX == 'Females')$time)
## [1] 1347

Overall, males sleep more than females, but the difference is only 56 minutes.

  1. Investigate the dish washing habits across gender and country.
pData <- select(data,everything()) %>% 
          filter(`Activity` == 'Dish.washing') %>% # filter data to get time spent dish washing
          group_by(`GEO.ACL00`,`SEX`) %>% # group data by country, gender 
          summarise(`time`=sum(`TimeSpentMinutes`) ) # calculate total minutes for each group 

# plot the data, flip axis so the countries are legible
ggplot(data = pData, aes(x = `GEO.ACL00`, y = `time`,fill=`SEX`, label = time)) + 
                geom_bar(stat = "identity") + 
                geom_text(size = 3, position = position_stack(vjust = 0.5)) + 
                coord_flip() +
                xlab("Country") +
                ylab("Time Spent (minutes)") +
                scale_fill_brewer(palette = "Set2") +
                labs(title = "Time Spent Dish Washing", fill = "Gender")

The plot shows that Italy and Bulgaria spend the most time dish washing.

The most interesting (although not surprising) thing about this plot is the distribution of time spent dish washing across genders. What is the overall female to male ratio of time spent dish washing?

sum(filter(pData, SEX == 'Females')$time)/sum(filter(pData, SEX == 'Males')$time)
## [1] 4.070588

Overall, there is a 4:1 female to male ratio of minutes spent doing dishes.

Conclusion

In conclusion the analysis show that overall, males spend more time eating than females, but they seem to prefer the ladies do the dishes. Maybe they clean the dishes very quickly?

The results also show that these habits vary across both gender and country. Not surprisingly, habits vary across Europe, due to different cultures.

It must be noted that this small sample may not be representative of the European population.

This was a very fun data set to work with!