This noteboook reproduces step by step the figures avialable in the original Statistics Explaind page and in the source excel file.
We define the year in a variable yr<-2010
so if i want to rerun the code for a different year we have to change only this line. In addition we will retrieve the EU28 country names which will be used in later steps.
library(restatapi)
library(data.table)
library(ggplot2)
library(chron)
yr<-"2010"
eu_ctry_names<-do.call(rbind,lapply(get("cc",envir=.restatapi_env)$EU28,search_eurostat_dsd,dsd=get_eurostat_dsd("tus_00age"),exact_match=TRUE))$name
eu_ctry_names<-gsub(" \\(.*\\)","",eu_ctry_names)
restatapi: - config file with the API version 1 loaded from GitHub (the 'current' API version number is 1). - 4 from the 32 cores are used for parallel computing, can be changed with 'options(restatapi_cores=...)' - 'auto' method will be used for file download, can be changed with 'options(restatapi_dmethod=...)' - the Table of contents (TOC) was not pre-loaded into the deafult cache ('.restatapi_env').
The data is in the tus_00age dataset. We use the restatapi package to download the data. We apply filter to the data for the year (date_filter=yr
) . We also filter for the other values in the graph (filters=list(unit="spent",age="total",sex="total",acl00=c("sleep","eat","^employ"," (family|personal) care","^leisure","^study","except travel"))
. If we use the REST SDMX service to get the filtered dataset, then we get no data because all the values are NaN (Not a Number) as the values are time spans. In order to get the data we have to apply the filter locally (force_local_filter=T
) on the dataset retrieved from the bulk download facility.
#dt<-get_eurostat_data("tus_00age",filters=list(unit="spent",age="total",sex="total",acl00="^(?!total).*$",geo="be"),date_filter=2010,label=F,ignore.case=T,exact_match=F,force_local_filter=T,perl=T)
#dt<-get_eurostat_data("tus_00age",filters=list(unit="spent",age="total",sex="total",acl00=c("ac01","ac02","ac03","ac1a","ac1b","ac2$","ac3$","ac4-8$","ac9a"),geo="be"),date_filter=2010,label=T,ignore.case=T,exact_match=F,force_local_filter=T,perl=T)
#dt<-get_eurostat_data("tus_00age",filters=list(unit="spent",age="total",sex="total",geo="be"),date_filter=2010,label=T,ignore.case=T,exact_match=F,force_local_filter=T,perl=T)
dt<-get_eurostat_data("tus_00age",filters=list(unit="spent",age="total",sex="total",acl00=c("sleep","eat","^employ"," (family|personal) care","^leisure","^study","except travel")),date_filter=eval(yr),label=T,ignore.case=T,exact_match=F,perl=T)
dt
dt<-get_eurostat_data("tus_00age",filters=list(unit="spent",age="total",sex="total",acl00=c("sleep","eat","^employ"," (family|personal) care","^leisure","^study","except travel")),date_filter=eval(yr),label=T,ignore.case=T,exact_match=F,perl=T,stringsAsFactors=F,force_local_filter=T)
dt
unit | sex | acl00 | age | geo | time | values |
---|---|---|---|---|---|---|
<fct> | <fct> | <fct> | <fct> | <fct> | <fct> | <dbl> |
Forcing to apply filter locally. The whole dataset is downloaded through the raw download and the filters are applied locally.
unit | sex | age | acl00 | geo | time | values |
---|---|---|---|---|---|---|
<chr> | <chr> | <chr> | <chr> | <chr> | <chr> | <chr> |
Time spent (hh:mm) | Total | Total | Sleep | Austria | 2010 | 8:31 |
Time spent (hh:mm) | Total | Total | Sleep | Belgium | 2010 | 8:36 |
Time spent (hh:mm) | Total | Total | Sleep | Germany (until 1990 former territory of the FRG) | 2010 | 8:26 |
Time spent (hh:mm) | Total | Total | Sleep | Estonia | 2010 | 8:50 |
Time spent (hh:mm) | Total | Total | Sleep | Greece | 2010 | 8:36 |
Time spent (hh:mm) | Total | Total | Sleep | Spain | 2010 | 8:38 |
Time spent (hh:mm) | Total | Total | Sleep | Finland | 2010 | 8:35 |
Time spent (hh:mm) | Total | Total | Sleep | France | 2010 | 8:30 |
Time spent (hh:mm) | Total | Total | Sleep | Hungary | 2010 | 8:34 |
Time spent (hh:mm) | Total | Total | Sleep | Italy | 2010 | 8:32 |
Time spent (hh:mm) | Total | Total | Sleep | Luxembourg | 2010 | 8:40 |
Time spent (hh:mm) | Total | Total | Sleep | Netherlands | 2010 | 8:26 |
Time spent (hh:mm) | Total | Total | Sleep | Norway | 2010 | 8:07 |
Time spent (hh:mm) | Total | Total | Sleep | Poland | 2010 | 8:37 |
Time spent (hh:mm) | Total | Total | Sleep | Romania | 2010 | 8:52 |
Time spent (hh:mm) | Total | Total | Sleep | Serbia | 2010 | 8:21 |
Time spent (hh:mm) | Total | Total | Sleep | Turkey | 2010 | 8:42 |
Time spent (hh:mm) | Total | Total | Sleep | United Kingdom | 2010 | 8:22 |
Time spent (hh:mm) | Total | Total | Eating | Austria | 2010 | 1:24 |
Time spent (hh:mm) | Total | Total | Eating | Belgium | 2010 | 1:44 |
Time spent (hh:mm) | Total | Total | Eating | Germany (until 1990 former territory of the FRG) | 2010 | 1:43 |
Time spent (hh:mm) | Total | Total | Eating | Estonia | 2010 | 1:21 |
Time spent (hh:mm) | Total | Total | Eating | Greece | 2010 | 2:13 |
Time spent (hh:mm) | Total | Total | Eating | Spain | 2010 | 1:59 |
Time spent (hh:mm) | Total | Total | Eating | Finland | 2010 | 1:23 |
Time spent (hh:mm) | Total | Total | Eating | France | 2010 | 2:12 |
Time spent (hh:mm) | Total | Total | Eating | Hungary | 2010 | 1:42 |
Time spent (hh:mm) | Total | Total | Eating | Italy | 2010 | 1:57 |
Time spent (hh:mm) | Total | Total | Eating | Luxembourg | 2010 | 1:54 |
Time spent (hh:mm) | Total | Total | Eating | Netherlands | 2010 | 1:57 |
⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ |
Time spent (hh:mm) | Total | Total | Leisure, social and associative life | Finland | 2010 | 6:05 |
Time spent (hh:mm) | Total | Total | Leisure, social and associative life | France | 2010 | 5:03 |
Time spent (hh:mm) | Total | Total | Leisure, social and associative life | Hungary | 2010 | 5:00 |
Time spent (hh:mm) | Total | Total | Leisure, social and associative life | Italy | 2010 | 4:54 |
Time spent (hh:mm) | Total | Total | Leisure, social and associative life | Luxembourg | 2010 | 4:35 |
Time spent (hh:mm) | Total | Total | Leisure, social and associative life | Netherlands | 2010 | 5:34 |
Time spent (hh:mm) | Total | Total | Leisure, social and associative life | Norway | 2010 | 5:53 |
Time spent (hh:mm) | Total | Total | Leisure, social and associative life | Poland | 2010 | 5:02 |
Time spent (hh:mm) | Total | Total | Leisure, social and associative life | Romania | 2010 | 4:26 |
Time spent (hh:mm) | Total | Total | Leisure, social and associative life | Serbia | 2010 | 5:29 |
Time spent (hh:mm) | Total | Total | Leisure, social and associative life | Turkey | 2010 | 5:27 |
Time spent (hh:mm) | Total | Total | Leisure, social and associative life | United Kingdom | 2010 | 5:15 |
Time spent (hh:mm) | Total | Total | Travel except travel related to jobs | Austria | 2010 | 1:09 |
Time spent (hh:mm) | Total | Total | Travel except travel related to jobs | Belgium | 2010 | 1:20 |
Time spent (hh:mm) | Total | Total | Travel except travel related to jobs | Germany (until 1990 former territory of the FRG) | 2010 | 1:17 |
Time spent (hh:mm) | Total | Total | Travel except travel related to jobs | Estonia | 2010 | 1:16 |
Time spent (hh:mm) | Total | Total | Travel except travel related to jobs | Greece | 2010 | 1:02 |
Time spent (hh:mm) | Total | Total | Travel except travel related to jobs | Spain | 2010 | 1:10 |
Time spent (hh:mm) | Total | Total | Travel except travel related to jobs | Finland | 2010 | 1:22 |
Time spent (hh:mm) | Total | Total | Travel except travel related to jobs | France | 2010 | 1:23 |
Time spent (hh:mm) | Total | Total | Travel except travel related to jobs | Hungary | 2010 | 1:03 |
Time spent (hh:mm) | Total | Total | Travel except travel related to jobs | Italy | 2010 | 1:19 |
Time spent (hh:mm) | Total | Total | Travel except travel related to jobs | Luxembourg | 2010 | 1:32 |
Time spent (hh:mm) | Total | Total | Travel except travel related to jobs | Netherlands | 2010 | 1:31 |
Time spent (hh:mm) | Total | Total | Travel except travel related to jobs | Norway | 2010 | 1:26 |
Time spent (hh:mm) | Total | Total | Travel except travel related to jobs | Poland | 2010 | 1:06 |
Time spent (hh:mm) | Total | Total | Travel except travel related to jobs | Romania | 2010 | 0:58 |
Time spent (hh:mm) | Total | Total | Travel except travel related to jobs | Serbia | 2010 | 1:07 |
Time spent (hh:mm) | Total | Total | Travel except travel related to jobs | Turkey | 2010 | 1:04 |
Time spent (hh:mm) | Total | Total | Travel except travel related to jobs | United Kingdom | 2010 | 2:09 |
Then we convert the values from characters/factors to time values using the chron package and keep only the columns with activities, countries and values. Before plotting the values, we need to sum the eating and other personal care for each country and cut the brackets from the name of Germany.
dt$geo<-gsub(" \\(.*\\)","",dt$geo)
if (is.factor(dt$values)|is.character(dt$values)) dt<-dt[,values:=chron::times(paste0(values,":00"))]
dt<-dt[,c("acl00","geo","values")]
sdt<-dt[grepl("(ating|ther)",acl00),.(acl00="Eating and other personal care",values=sum(values)),by=geo]
sdt
dt<-rbind(dt[!grepl("(ating|ther)",acl00)],sdt)
geo | acl00 | values |
---|---|---|
<chr> | <chr> | <times> |
Austria | Eating and other personal care | 02:14:00 |
Belgium | Eating and other personal care | 02:37:00 |
Germany | Eating and other personal care | 02:38:00 |
Estonia | Eating and other personal care | 02:16:00 |
Greece | Eating and other personal care | 03:10:00 |
Spain | Eating and other personal care | 02:50:00 |
Finland | Eating and other personal care | 02:12:00 |
France | Eating and other personal care | 03:05:00 |
Hungary | Eating and other personal care | 02:58:00 |
Italy | Eating and other personal care | 02:52:00 |
Luxembourg | Eating and other personal care | 02:50:00 |
Netherlands | Eating and other personal care | 02:50:00 |
Norway | Eating and other personal care | 02:20:00 |
Poland | Eating and other personal care | 02:33:00 |
Romania | Eating and other personal care | 02:58:00 |
Serbia | Eating and other personal care | 02:48:00 |
Turkey | Eating and other personal care | 02:46:00 |
United Kingdom | Eating and other personal care | 02:21:00 |
Then plot the data using the ggplot2 library, and using the color codes of the original figure.
fig1_colors<-c("#F6A26B","#F06423","#71A8DF","#286EB4","#FDDBA3","#FCC975","#FAA519")
ggplot(dt, aes(x=geo, y=values,fill=acl00)) +
geom_bar(position="stack",stat="identity")+
scale_y_chron(format="%H:%M") +
scale_fill_manual(values = fig1_colors)+
ggtitle("Figure 1") +
ylab ("")+
xlab("")+
theme(axis.text.x = element_text(angle = 90, hjust = 1))
The graph not exactly as in the SE article, because in our case it is sorted alphabetically. We have to add the empty spaces before the EFTA and accession countries and reorder the values. Finally adjust scaling, remove vertical grid lines, column width and resize the plotting area to better see the figure.
dt_sep<-data.table::data.table(acl00=c("Sleep","Sleep"),geo=c(" "," "),values=c(chron::times(NA),chron::times(NA)))
dt<-rbind(dt,dt_sep)
acls_ord<-c('Travel except travel related to jobs','Leisure, social and associative life','Household and family care','Study','Employment, related activities and travel as part of/during main and second job','Eating and other personal care','Sleep')
dt$acl00<-factor(dt$acl00,levels=acls_ord)
geo_ord<-c('Belgium','Germany','Estonia','Greece','Spain','France','Italy','Luxembourg','Hungary','Netherlands','Austria','Poland','Romania','Finland','United Kingdom',' ','Norway',' ','Serbia','Turkey')
dt$geo<-factor(dt$geo,levels=geo_ord)
options(repr.plot.width=9, repr.plot.height=6,repr.plot.res=300)
ggplot(dt, aes(x=geo, y=values,fill=acl00)) + theme_minimal() +
geom_bar(position="stack",stat="identity",width=0.5)+
scale_y_chron(format="%H:%M",breaks=seq(0,1,4/24)) +
scale_fill_manual(values = fig1_colors)+
ggtitle("Figure 1: Mean time spent on daily activities, all individuals by country, (hh:mm; 2008 to 2015)") +
ylab("")+
xlab("")+
theme(legend.title = element_blank(),
axis.text.x = element_text(angle = 90, hjust = 1),
panel.grid.major.x = element_blank())
Warning message: "Removed 2 rows containing missing values (position_stack)."
The data is again in the tus_00age dataset. We use the same method as for Figure 1. We apply the same filter to the data for the year (date_filter=yr
) and a modified one for the values in the graph (filters=list(unit="Participation time",age="total",sex="total",acl00=c("^study","^empl"))
. Again in order to get the data we have to apply the filter locally (force_local_filter=T
) on the dataset retrieved from the bulk download facility.
dt<-get_eurostat_data("tus_00age",filters=list(unit="Participation time",age="total",sex="total",acl00=c("^study","^empl")),date_filter=eval(yr),label=T,ignore.case=T,exact_match=F,perl=T,stringsAsFactors=F,force_local_filter=T)
dt
Forcing to apply filter locally. The whole dataset is downloaded through the raw download and the filters are applied locally.
unit | sex | age | acl00 | geo | time | values |
---|---|---|---|---|---|---|
<chr> | <chr> | <chr> | <chr> | <chr> | <chr> | <chr> |
Participation time (hh:mm) | Total | Total | Employment, related activities and travel as part of/during main and second job | Austria | 2010 | 7:45 |
Participation time (hh:mm) | Total | Total | Employment, related activities and travel as part of/during main and second job | Belgium | 2010 | 7:24 |
Participation time (hh:mm) | Total | Total | Employment, related activities and travel as part of/during main and second job | Germany (until 1990 former territory of the FRG) | 2010 | 7:02 |
Participation time (hh:mm) | Total | Total | Employment, related activities and travel as part of/during main and second job | Estonia | 2010 | 7:52 |
Participation time (hh:mm) | Total | Total | Employment, related activities and travel as part of/during main and second job | Greece | 2010 | 7:20 |
Participation time (hh:mm) | Total | Total | Employment, related activities and travel as part of/during main and second job | Spain | 2010 | 7:24 |
Participation time (hh:mm) | Total | Total | Employment, related activities and travel as part of/during main and second job | Finland | 2010 | 7:17 |
Participation time (hh:mm) | Total | Total | Employment, related activities and travel as part of/during main and second job | France | 2010 | 6:51 |
Participation time (hh:mm) | Total | Total | Employment, related activities and travel as part of/during main and second job | Hungary | 2010 | 7:12 |
Participation time (hh:mm) | Total | Total | Employment, related activities and travel as part of/during main and second job | Italy | 2010 | 7:33 |
Participation time (hh:mm) | Total | Total | Employment, related activities and travel as part of/during main and second job | Luxembourg | 2010 | 7:29 |
Participation time (hh:mm) | Total | Total | Employment, related activities and travel as part of/during main and second job | Netherlands | 2010 | 6:42 |
Participation time (hh:mm) | Total | Total | Employment, related activities and travel as part of/during main and second job | Norway | 2010 | 6:59 |
Participation time (hh:mm) | Total | Total | Employment, related activities and travel as part of/during main and second job | Poland | 2010 | 7:38 |
Participation time (hh:mm) | Total | Total | Employment, related activities and travel as part of/during main and second job | Romania | 2010 | 7:08 |
Participation time (hh:mm) | Total | Total | Employment, related activities and travel as part of/during main and second job | Serbia | 2010 | 6:44 |
Participation time (hh:mm) | Total | Total | Employment, related activities and travel as part of/during main and second job | Turkey | 2010 | 7:41 |
Participation time (hh:mm) | Total | Total | Employment, related activities and travel as part of/during main and second job | United Kingdom | 2010 | 6:54 |
Participation time (hh:mm) | Total | Total | Study | Austria | 2010 | 5:11 |
Participation time (hh:mm) | Total | Total | Study | Belgium | 2010 | 5:30 |
Participation time (hh:mm) | Total | Total | Study | Germany (until 1990 former territory of the FRG) | 2010 | 4:14 |
Participation time (hh:mm) | Total | Total | Study | Estonia | 2010 | 5:02 |
Participation time (hh:mm) | Total | Total | Study | Greece | 2010 | 6:13 |
Participation time (hh:mm) | Total | Total | Study | Spain | 2010 | 4:48 |
Participation time (hh:mm) | Total | Total | Study | Finland | 2010 | 4:24 |
Participation time (hh:mm) | Total | Total | Study | France | 2010 | 5:16 |
Participation time (hh:mm) | Total | Total | Study | Hungary | 2010 | 5:14 |
Participation time (hh:mm) | Total | Total | Study | Italy | 2010 | 5:41 |
Participation time (hh:mm) | Total | Total | Study | Luxembourg | 2010 | 5:23 |
Participation time (hh:mm) | Total | Total | Study | Netherlands | 2010 | 4:00 |
Participation time (hh:mm) | Total | Total | Study | Norway | 2010 | 4:44 |
Participation time (hh:mm) | Total | Total | Study | Poland | 2010 | 5:13 |
Participation time (hh:mm) | Total | Total | Study | Romania | 2010 | 5:44 |
Participation time (hh:mm) | Total | Total | Study | Serbia | 2010 | 5:05 |
Participation time (hh:mm) | Total | Total | Study | Turkey | 2010 | 4:46 |
Participation time (hh:mm) | Total | Total | Study | United Kingdom | 2010 | 4:36 |
Then again we convert the values from characters/factors to time values using the chron package and keep only the columns with activities, countries and values. Before plotting the values we need to cut the brackets from the name of Germany.
dt$geo<-gsub(" \\(.*\\)","",dt$geo)
if (is.factor(dt$values)|is.character(dt$values)) dt<-dt[,values:=chron::times(paste0(values,":00"))]
dt<-dt[,c("acl00","geo","values")]
dt
acl00 | geo | values |
---|---|---|
<chr> | <chr> | <times> |
Employment, related activities and travel as part of/during main and second job | Austria | 07:45:00 |
Employment, related activities and travel as part of/during main and second job | Belgium | 07:24:00 |
Employment, related activities and travel as part of/during main and second job | Germany | 07:02:00 |
Employment, related activities and travel as part of/during main and second job | Estonia | 07:52:00 |
Employment, related activities and travel as part of/during main and second job | Greece | 07:20:00 |
Employment, related activities and travel as part of/during main and second job | Spain | 07:24:00 |
Employment, related activities and travel as part of/during main and second job | Finland | 07:17:00 |
Employment, related activities and travel as part of/during main and second job | France | 06:51:00 |
Employment, related activities and travel as part of/during main and second job | Hungary | 07:12:00 |
Employment, related activities and travel as part of/during main and second job | Italy | 07:33:00 |
Employment, related activities and travel as part of/during main and second job | Luxembourg | 07:29:00 |
Employment, related activities and travel as part of/during main and second job | Netherlands | 06:42:00 |
Employment, related activities and travel as part of/during main and second job | Norway | 06:59:00 |
Employment, related activities and travel as part of/during main and second job | Poland | 07:38:00 |
Employment, related activities and travel as part of/during main and second job | Romania | 07:08:00 |
Employment, related activities and travel as part of/during main and second job | Serbia | 06:44:00 |
Employment, related activities and travel as part of/during main and second job | Turkey | 07:41:00 |
Employment, related activities and travel as part of/during main and second job | United Kingdom | 06:54:00 |
Study | Austria | 05:11:00 |
Study | Belgium | 05:30:00 |
Study | Germany | 04:14:00 |
Study | Estonia | 05:02:00 |
Study | Greece | 06:13:00 |
Study | Spain | 04:48:00 |
Study | Finland | 04:24:00 |
Study | France | 05:16:00 |
Study | Hungary | 05:14:00 |
Study | Italy | 05:41:00 |
Study | Luxembourg | 05:23:00 |
Study | Netherlands | 04:00:00 |
Study | Norway | 04:44:00 |
Study | Poland | 05:13:00 |
Study | Romania | 05:44:00 |
Study | Serbia | 05:05:00 |
Study | Turkey | 04:46:00 |
Study | United Kingdom | 04:36:00 |
We make the graph again with ggplot. We have to order by increasing value of Employment, add the empty spaces before the EFTA and accession countries. Finally adjust scaling, remove vertical grid lines, column width and resize the plotting area to better see the figure.
dt_sep<-data.table::data.table(acl00=c("Study","Study"),geo=c(" "," "),values=c(chron::times(NA),chron::times(NA)))
dt<-rbind(dt,dt_sep)
geo_ord<-dt[(geo %in% eu_ctry_names)&grepl("Empl",acl00)]
geo_ord<-geo_ord[order(values)]$geo
geo_ord<-c(geo_ord,' ','Norway',' ','Serbia','Turkey')
dt$geo<-factor(dt$geo,levels=geo_ord)
fig2_colors<-c("#FAA519","#286EB4")
options(repr.plot.width=9, repr.plot.height=6,repr.plot.res=300)
ggplot(dt, aes(x=geo, y=values,fill=acl00)) + theme_minimal() +
geom_bar(position="dodge",stat="identity",width=0.7)+
scale_y_chron(format="%H:%M",breaks=seq(0,1,1/24)) +
scale_fill_manual(values = fig2_colors)+
ggtitle("Figure 2: Participation time per day in study and employment, only individuals taking part in the activity, by country, (hh mm; 2008 to 2015)") +
ylab("")+
xlab("")+
theme(legend.title = element_blank(),
legend.position= "bottom",
axis.text.x = element_text(angle = 90, hjust = 1),
panel.grid.major.x = element_blank(),
panel.grid.minor.y = element_blank())
Warning message: "Removed 2 rows containing missing values (geom_bar)."
The data is again in the tus_00age dataset. We use the same method as for Figure 1. We apply the same filter to the data for the year (date_filter=yr
) and a modified one for the values in the graph (filters=list(unit="Participation time",age="total",acl00="household.*care")
. Again in order to get the data we have to apply the filter locally (force_local_filter=T
) on the dataset retrieved from the bulk download facility.
dt<-get_eurostat_data("tus_00age",filters=list(unit="Participation time",age="total",acl00="household.*care"),date_filter=eval(yr),label=T,ignore.case=T,exact_match=F,perl=T,stringsAsFactors=F,force_local_filter=T)
dt
Forcing to apply filter locally. The whole dataset is downloaded through the raw download and the filters are applied locally.
unit | sex | age | acl00 | geo | time | values |
---|---|---|---|---|---|---|
<chr> | <chr> | <chr> | <chr> | <chr> | <chr> | <chr> |
Participation time (hh:mm) | Females | Total | Household and family care | Austria | 2010 | 4:32 |
Participation time (hh:mm) | Females | Total | Household and family care | Belgium | 2010 | 3:58 |
Participation time (hh:mm) | Females | Total | Household and family care | Germany (until 1990 former territory of the FRG) | 2010 | 3:50 |
Participation time (hh:mm) | Females | Total | Household and family care | Estonia | 2010 | 4:05 |
Participation time (hh:mm) | Females | Total | Household and family care | Greece | 2010 | 4:28 |
Participation time (hh:mm) | Females | Total | Household and family care | Spain | 2010 | 4:36 |
Participation time (hh:mm) | Females | Total | Household and family care | Finland | 2010 | 3:41 |
Participation time (hh:mm) | Females | Total | Household and family care | France | 2010 | 4:04 |
Participation time (hh:mm) | Females | Total | Household and family care | Hungary | 2010 | 4:43 |
Participation time (hh:mm) | Females | Total | Household and family care | Italy | 2010 | 5:09 |
Participation time (hh:mm) | Females | Total | Household and family care | Luxembourg | 2010 | 3:54 |
Participation time (hh:mm) | Females | Total | Household and family care | Netherlands | 2010 | 3:29 |
Participation time (hh:mm) | Females | Total | Household and family care | Norway | 2010 | 3:30 |
Participation time (hh:mm) | Females | Total | Household and family care | Poland | 2010 | 4:33 |
Participation time (hh:mm) | Females | Total | Household and family care | Romania | 2010 | 5:02 |
Participation time (hh:mm) | Females | Total | Household and family care | Serbia | 2010 | 4:48 |
Participation time (hh:mm) | Females | Total | Household and family care | Turkey | 2010 | 4:59 |
Participation time (hh:mm) | Females | Total | Household and family care | United Kingdom | 2010 | 3:50 |
Participation time (hh:mm) | Males | Total | Household and family care | Austria | 2010 | 2:47 |
Participation time (hh:mm) | Males | Total | Household and family care | Belgium | 2010 | 2:42 |
Participation time (hh:mm) | Males | Total | Household and family care | Germany (until 1990 former territory of the FRG) | 2010 | 2:35 |
Participation time (hh:mm) | Males | Total | Household and family care | Estonia | 2010 | 2:52 |
Participation time (hh:mm) | Males | Total | Household and family care | Greece | 2010 | 2:07 |
Participation time (hh:mm) | Males | Total | Household and family care | Spain | 2010 | 2:36 |
Participation time (hh:mm) | Males | Total | Household and family care | Finland | 2010 | 2:32 |
Participation time (hh:mm) | Males | Total | Household and family care | France | 2010 | 2:53 |
Participation time (hh:mm) | Males | Total | Household and family care | Hungary | 2010 | 2:55 |
Participation time (hh:mm) | Males | Total | Household and family care | Italy | 2010 | 2:22 |
Participation time (hh:mm) | Males | Total | Household and family care | Luxembourg | 2010 | 2:14 |
Participation time (hh:mm) | Males | Total | Household and family care | Netherlands | 2010 | 2:27 |
Participation time (hh:mm) | Males | Total | Household and family care | Norway | 2010 | 2:43 |
Participation time (hh:mm) | Males | Total | Household and family care | Poland | 2010 | 2:48 |
Participation time (hh:mm) | Males | Total | Household and family care | Romania | 2010 | 2:45 |
Participation time (hh:mm) | Males | Total | Household and family care | Serbia | 2010 | 2:33 |
Participation time (hh:mm) | Males | Total | Household and family care | Turkey | 2010 | 1:43 |
Participation time (hh:mm) | Males | Total | Household and family care | United Kingdom | 2010 | 2:27 |
Participation time (hh:mm) | Total | Total | Household and family care | Austria | 2010 | 3:46 |
Participation time (hh:mm) | Total | Total | Household and family care | Belgium | 2010 | 3:23 |
Participation time (hh:mm) | Total | Total | Household and family care | Germany (until 1990 former territory of the FRG) | 2010 | 3:15 |
Participation time (hh:mm) | Total | Total | Household and family care | Estonia | 2010 | 3:35 |
Participation time (hh:mm) | Total | Total | Household and family care | Greece | 2010 | 3:31 |
Participation time (hh:mm) | Total | Total | Household and family care | Spain | 2010 | 3:43 |
Participation time (hh:mm) | Total | Total | Household and family care | Finland | 2010 | 3:08 |
Participation time (hh:mm) | Total | Total | Household and family care | France | 2010 | 3:33 |
Participation time (hh:mm) | Total | Total | Household and family care | Hungary | 2010 | 3:56 |
Participation time (hh:mm) | Total | Total | Household and family care | Italy | 2010 | 4:01 |
Participation time (hh:mm) | Total | Total | Household and family care | Luxembourg | 2010 | 3:07 |
Participation time (hh:mm) | Total | Total | Household and family care | Netherlands | 2010 | 2:59 |
Participation time (hh:mm) | Total | Total | Household and family care | Norway | 2010 | 3:07 |
Participation time (hh:mm) | Total | Total | Household and family care | Poland | 2010 | 3:46 |
Participation time (hh:mm) | Total | Total | Household and family care | Romania | 2010 | 4:03 |
Participation time (hh:mm) | Total | Total | Household and family care | Serbia | 2010 | 3:51 |
Participation time (hh:mm) | Total | Total | Household and family care | Turkey | 2010 | 3:50 |
Participation time (hh:mm) | Total | Total | Household and family care | United Kingdom | 2010 | 3:11 |
Then again we convert the values from characters/factors to time values using the chron package and keep only the columns with sex, countries and values. Before plotting the values we need to cut the brackets from the name of Germany.
dt$geo<-gsub(" \\(.*\\)","",dt$geo)
if (is.factor(dt$values)|is.character(dt$values)) dt<-dt[,values:=chron::times(paste0(values,":00"))]
dt<-dt[,c("sex","geo","values")]
dt
sex | geo | values |
---|---|---|
<chr> | <chr> | <times> |
Females | Austria | 04:32:00 |
Females | Belgium | 03:58:00 |
Females | Germany | 03:50:00 |
Females | Estonia | 04:05:00 |
Females | Greece | 04:28:00 |
Females | Spain | 04:36:00 |
Females | Finland | 03:41:00 |
Females | France | 04:04:00 |
Females | Hungary | 04:43:00 |
Females | Italy | 05:09:00 |
Females | Luxembourg | 03:54:00 |
Females | Netherlands | 03:29:00 |
Females | Norway | 03:30:00 |
Females | Poland | 04:33:00 |
Females | Romania | 05:02:00 |
Females | Serbia | 04:48:00 |
Females | Turkey | 04:59:00 |
Females | United Kingdom | 03:50:00 |
Males | Austria | 02:47:00 |
Males | Belgium | 02:42:00 |
Males | Germany | 02:35:00 |
Males | Estonia | 02:52:00 |
Males | Greece | 02:07:00 |
Males | Spain | 02:36:00 |
Males | Finland | 02:32:00 |
Males | France | 02:53:00 |
Males | Hungary | 02:55:00 |
Males | Italy | 02:22:00 |
Males | Luxembourg | 02:14:00 |
Males | Netherlands | 02:27:00 |
Males | Norway | 02:43:00 |
Males | Poland | 02:48:00 |
Males | Romania | 02:45:00 |
Males | Serbia | 02:33:00 |
Males | Turkey | 01:43:00 |
Males | United Kingdom | 02:27:00 |
Total | Austria | 03:46:00 |
Total | Belgium | 03:23:00 |
Total | Germany | 03:15:00 |
Total | Estonia | 03:35:00 |
Total | Greece | 03:31:00 |
Total | Spain | 03:43:00 |
Total | Finland | 03:08:00 |
Total | France | 03:33:00 |
Total | Hungary | 03:56:00 |
Total | Italy | 04:01:00 |
Total | Luxembourg | 03:07:00 |
Total | Netherlands | 02:59:00 |
Total | Norway | 03:07:00 |
Total | Poland | 03:46:00 |
Total | Romania | 04:03:00 |
Total | Serbia | 03:51:00 |
Total | Turkey | 03:50:00 |
Total | United Kingdom | 03:11:00 |
We make the graph again with ggplot. We have to order by increasing total value of sex, add the empty spaces before the EFTA and accession countries. Finally adjust scaling, remove vertical grid lines, column width and resize the plotting area to better see the figure.
dt_sep<-data.table::data.table(sex=c("Males","Males"),geo=c(" "," "),values=c(chron::times(NA),chron::times(NA)))
dt<-rbind(dt,dt_sep)
geo_ord<-dt[(geo %in% eu_ctry_names)&grepl("Total",sex)]
geo_ord<-geo_ord[order(values)]$geo
geo_ord<-c(geo_ord,' ','Norway',' ','Serbia','Turkey')
dt$geo<-factor(dt$geo,levels=geo_ord)
sex_ord<-c('Males','Females',"Total")
dt$sex<-factor(dt$sex,levels=sex_ord)
fig3_colors<-c("#FAA519","#286EB4","#F06423")
options(repr.plot.width=9, repr.plot.height=6,repr.plot.res=300)
ggplot(dt,aes(x=geo,y=values)) + theme_minimal() +
geom_bar(data=dt[sex!="Total"], aes(fill=sex),position="dodge",stat="identity",width=0.6)+
geom_point(data=dt[grepl("Total",sex)],aes(shape=sex),colour="#F06423",fill="#F06423",size=3)+
scale_y_chron(format="%H:%M",breaks=seq(0,1,1/24)) +
scale_fill_manual(values = fig3_colors)+
scale_shape_manual(values=c("Males"=NA,"Females"=NA,"Total"=23))+
ggtitle("Figure 3: Participation time per day in household and family care, by gender, (hh mm; 2008 to 2015)") +
ylab("")+
xlab("")+
theme(legend.title = element_blank(),
legend.position= "bottom",
axis.text.x = element_text(angle = 90, hjust = 1),
panel.grid.major.x = element_blank(),
panel.grid.minor.y = element_blank())
Warning message: "Removed 2 rows containing missing values (geom_bar)."
The data is this time in the tus_00educ dataset. We apply the same filter to the data for the year (date_filter=yr
) and a modified one for the values in the graph (filters=list(unit="Participation rate",age="total",acl00="household.*care",sex="male",isced97="^all")
. This time we can use the SDMX REST API to get the data as it is numeric.
dt<-get_eurostat_data("tus_00educ",filters=list(unit="Participation rate",age="total",acl00="household.*care",sex="male",isced97="^all"),date_filter=eval(yr),label=T,ignore.case=T,exact_match=F,perl=T,stringsAsFactors=F)
dt
unit | sex | acl00 | isced97 | geo | time | values |
---|---|---|---|---|---|---|
<chr> | <chr> | <chr> | <chr> | <chr> | <chr> | <dbl> |
Participation rate (%) | Females | Household and family care | All ISCED 1997 levels | Austria | 2010 | 96.4 |
Participation rate (%) | Females | Household and family care | All ISCED 1997 levels | Belgium | 2010 | 95.6 |
Participation rate (%) | Females | Household and family care | All ISCED 1997 levels | Germany (until 1990 former territory of the FRG) | 2010 | 96.3 |
Participation rate (%) | Females | Household and family care | All ISCED 1997 levels | Estonia | 2010 | 95.7 |
Participation rate (%) | Females | Household and family care | All ISCED 1997 levels | Greece | 2010 | 94.6 |
Participation rate (%) | Females | Household and family care | All ISCED 1997 levels | Spain | 2010 | 94.8 |
Participation rate (%) | Females | Household and family care | All ISCED 1997 levels | Finland | 2010 | 97.3 |
Participation rate (%) | Females | Household and family care | All ISCED 1997 levels | France | 2010 | 94.8 |
Participation rate (%) | Females | Household and family care | All ISCED 1997 levels | Hungary | 2010 | 97.4 |
Participation rate (%) | Females | Household and family care | All ISCED 1997 levels | Italy | 2010 | 95.4 |
Participation rate (%) | Females | Household and family care | All ISCED 1997 levels | Luxembourg | 2010 | 94.2 |
Participation rate (%) | Females | Household and family care | All ISCED 1997 levels | Netherlands | 2010 | 96.3 |
Participation rate (%) | Females | Household and family care | All ISCED 1997 levels | Norway | 2010 | 98.3 |
Participation rate (%) | Females | Household and family care | All ISCED 1997 levels | Poland | 2010 | 97.9 |
Participation rate (%) | Females | Household and family care | All ISCED 1997 levels | Romania | 2010 | 96.3 |
Participation rate (%) | Females | Household and family care | All ISCED 1997 levels | Serbia | 2010 | 96.6 |
Participation rate (%) | Females | Household and family care | All ISCED 1997 levels | Turkey | 2010 | 95.0 |
Participation rate (%) | Females | Household and family care | All ISCED 1997 levels | United Kingdom | 2010 | 96.8 |
Participation rate (%) | Males | Household and family care | All ISCED 1997 levels | Austria | 2010 | 81.5 |
Participation rate (%) | Males | Household and family care | All ISCED 1997 levels | Belgium | 2010 | 86.5 |
Participation rate (%) | Males | Household and family care | All ISCED 1997 levels | Germany (until 1990 former territory of the FRG) | 2010 | 88.5 |
Participation rate (%) | Males | Household and family care | All ISCED 1997 levels | Estonia | 2010 | 83.1 |
Participation rate (%) | Males | Household and family care | All ISCED 1997 levels | Greece | 2010 | 71.6 |
Participation rate (%) | Males | Household and family care | All ISCED 1997 levels | Spain | 2010 | 77.2 |
Participation rate (%) | Males | Household and family care | All ISCED 1997 levels | Finland | 2010 | 93.0 |
Participation rate (%) | Males | Household and family care | All ISCED 1997 levels | France | 2010 | 82.1 |
Participation rate (%) | Males | Household and family care | All ISCED 1997 levels | Hungary | 2010 | 85.9 |
Participation rate (%) | Males | Household and family care | All ISCED 1997 levels | Italy | 2010 | 69.7 |
Participation rate (%) | Males | Household and family care | All ISCED 1997 levels | Luxembourg | 2010 | 80.8 |
Participation rate (%) | Males | Household and family care | All ISCED 1997 levels | Netherlands | 2010 | 88.8 |
Participation rate (%) | Males | Household and family care | All ISCED 1997 levels | Norway | 2010 | 91.8 |
Participation rate (%) | Males | Household and family care | All ISCED 1997 levels | Poland | 2010 | 86.4 |
Participation rate (%) | Males | Household and family care | All ISCED 1997 levels | Romania | 2010 | 78.9 |
Participation rate (%) | Males | Household and family care | All ISCED 1997 levels | Serbia | 2010 | 77.5 |
Participation rate (%) | Males | Household and family care | All ISCED 1997 levels | Turkey | 2010 | 53.4 |
Participation rate (%) | Males | Household and family care | All ISCED 1997 levels | United Kingdom | 2010 | 88.9 |
Then again we keep only the columns with sex, countries and values. Before plotting the values we need to cut the brackets from the name of Germany.
dt$geo<-gsub(" \\(.*\\)","",dt$geo)
dt<-dt[,c("sex","geo","values")]
dt
sex | geo | values |
---|---|---|
<chr> | <chr> | <dbl> |
Females | Austria | 96.4 |
Females | Belgium | 95.6 |
Females | Germany | 96.3 |
Females | Estonia | 95.7 |
Females | Greece | 94.6 |
Females | Spain | 94.8 |
Females | Finland | 97.3 |
Females | France | 94.8 |
Females | Hungary | 97.4 |
Females | Italy | 95.4 |
Females | Luxembourg | 94.2 |
Females | Netherlands | 96.3 |
Females | Norway | 98.3 |
Females | Poland | 97.9 |
Females | Romania | 96.3 |
Females | Serbia | 96.6 |
Females | Turkey | 95.0 |
Females | United Kingdom | 96.8 |
Males | Austria | 81.5 |
Males | Belgium | 86.5 |
Males | Germany | 88.5 |
Males | Estonia | 83.1 |
Males | Greece | 71.6 |
Males | Spain | 77.2 |
Males | Finland | 93.0 |
Males | France | 82.1 |
Males | Hungary | 85.9 |
Males | Italy | 69.7 |
Males | Luxembourg | 80.8 |
Males | Netherlands | 88.8 |
Males | Norway | 91.8 |
Males | Poland | 86.4 |
Males | Romania | 78.9 |
Males | Serbia | 77.5 |
Males | Turkey | 53.4 |
Males | United Kingdom | 88.9 |
We make the graph again with ggplot. We have to order by increasing value of Females, add the empty spaces before the EFTA and accession countries. Finally adjust scaling, remove vertical grid lines, column width and resize the plotting area to better see the figure.
dt_sep<-data.table::data.table(sex=c("Males","Males"),geo=c(" "," "),values=c(NA,NA))
dt<-rbind(dt,dt_sep)
geo_ord<-dt[(geo %in% eu_ctry_names)&grepl("Females",sex)]
geo_ord<-geo_ord[order(values)]$geo
geo_ord<-c(geo_ord,' ','Norway',' ','Turkey','Serbia')
dt$geo<-factor(dt$geo,levels=geo_ord)
sex_ord<-c('Males','Females')
dt$sex<-factor(dt$sex,levels=sex_ord)
fig4_colors<-c("#FAA519","#286EB4")
options(repr.plot.width=9, repr.plot.height=6,repr.plot.res=300)
ggplot(dt,aes(x=geo,y=values)) + theme_minimal() +
geom_bar(aes(fill=sex),position="dodge",stat="identity",width=0.6)+
scale_fill_manual(values = fig4_colors)+
scale_y_continuous(breaks=seq(0,100,10)) +
ggtitle("Figure 4: Participation rate per day in household and family care,\n main activity, %, by gender (2008 to 2015)") +
ylab("")+
xlab("")+
theme(legend.title = element_blank(),
legend.position= "bottom",
axis.text.x = element_text(angle = 90, hjust = 1),
panel.grid.major.x = element_blank(),
panel.grid.minor.y = element_blank())
Warning message: "Removed 2 rows containing missing values (geom_bar)."
The data is again in the tus_00educ dataset as in Figure 4. We apply the same filter to the data for the year (date_filter=yr
) and a modified one for the values in the graph (filters=list(unit="Participation rate",age="total",acl00="^food|^clean",sex="male",isced97="^all")
. This time we can use again the SDMX REST API to get the values are it is numeric.
dt<-get_eurostat_data("tus_00educ",filters=list(unit="Participation rate",age="total",acl00="^food|^clean",sex="male",isced97="^all"),date_filter=eval(yr),label=T,ignore.case=T,exact_match=F,perl=T,stringsAsFactors=F)
dt
unit | sex | acl00 | isced97 | geo | time | values |
---|---|---|---|---|---|---|
<chr> | <chr> | <chr> | <chr> | <chr> | <chr> | <dbl> |
Participation rate (%) | Females | Food management except dish washing | All ISCED 1997 levels | Austria | 2010 | 81.1 |
Participation rate (%) | Females | Food management except dish washing | All ISCED 1997 levels | Belgium | 2010 | 77.0 |
Participation rate (%) | Females | Food management except dish washing | All ISCED 1997 levels | Germany (until 1990 former territory of the FRG) | 2010 | 76.6 |
Participation rate (%) | Females | Food management except dish washing | All ISCED 1997 levels | Estonia | 2010 | 85.0 |
Participation rate (%) | Females | Food management except dish washing | All ISCED 1997 levels | Greece | 2010 | 85.5 |
Participation rate (%) | Females | Food management except dish washing | All ISCED 1997 levels | Spain | 2010 | 81.3 |
Participation rate (%) | Females | Food management except dish washing | All ISCED 1997 levels | Finland | 2010 | 84.4 |
Participation rate (%) | Females | Food management except dish washing | All ISCED 1997 levels | France | 2010 | 79.7 |
Participation rate (%) | Females | Food management except dish washing | All ISCED 1997 levels | Hungary | 2010 | 85.1 |
Participation rate (%) | Females | Food management except dish washing | All ISCED 1997 levels | Italy | 2010 | 87.9 |
Participation rate (%) | Females | Food management except dish washing | All ISCED 1997 levels | Luxembourg | 2010 | 78.4 |
Participation rate (%) | Females | Food management except dish washing | All ISCED 1997 levels | Netherlands | 2010 | 78.5 |
Participation rate (%) | Females | Food management except dish washing | All ISCED 1997 levels | Norway | 2010 | 86.2 |
Participation rate (%) | Females | Food management except dish washing | All ISCED 1997 levels | Poland | 2010 | 90.9 |
Participation rate (%) | Females | Food management except dish washing | All ISCED 1997 levels | Romania | 2010 | 86.9 |
Participation rate (%) | Females | Food management except dish washing | All ISCED 1997 levels | Serbia | 2010 | 88.5 |
Participation rate (%) | Females | Food management except dish washing | All ISCED 1997 levels | Turkey | 2010 | 88.1 |
Participation rate (%) | Females | Food management except dish washing | All ISCED 1997 levels | United Kingdom | 2010 | 80.4 |
Participation rate (%) | Females | Cleaning dwelling | All ISCED 1997 levels | Austria | 2010 | 68.6 |
Participation rate (%) | Females | Cleaning dwelling | All ISCED 1997 levels | Belgium | 2010 | 30.9 |
Participation rate (%) | Females | Cleaning dwelling | All ISCED 1997 levels | Germany (until 1990 former territory of the FRG) | 2010 | 59.8 |
Participation rate (%) | Females | Cleaning dwelling | All ISCED 1997 levels | Estonia | 2010 | 50.3 |
Participation rate (%) | Females | Cleaning dwelling | All ISCED 1997 levels | Greece | 2010 | 62.1 |
Participation rate (%) | Females | Cleaning dwelling | All ISCED 1997 levels | Spain | 2010 | 56.0 |
Participation rate (%) | Females | Cleaning dwelling | All ISCED 1997 levels | Finland | 2010 | 51.8 |
Participation rate (%) | Females | Cleaning dwelling | All ISCED 1997 levels | France | 2010 | 65.6 |
Participation rate (%) | Females | Cleaning dwelling | All ISCED 1997 levels | Hungary | 2010 | 54.1 |
Participation rate (%) | Females | Cleaning dwelling | All ISCED 1997 levels | Italy | 2010 | 79.8 |
Participation rate (%) | Females | Cleaning dwelling | All ISCED 1997 levels | Luxembourg | 2010 | 33.7 |
Participation rate (%) | Females | Cleaning dwelling | All ISCED 1997 levels | Netherlands | 2010 | 51.6 |
⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ |
Participation rate (%) | Males | Food management except dish washing | All ISCED 1997 levels | Finland | 2010 | 60.9 |
Participation rate (%) | Males | Food management except dish washing | All ISCED 1997 levels | France | 2010 | 43.2 |
Participation rate (%) | Males | Food management except dish washing | All ISCED 1997 levels | Hungary | 2010 | 43.3 |
Participation rate (%) | Males | Food management except dish washing | All ISCED 1997 levels | Italy | 2010 | 40.5 |
Participation rate (%) | Males | Food management except dish washing | All ISCED 1997 levels | Luxembourg | 2010 | 42.3 |
Participation rate (%) | Males | Food management except dish washing | All ISCED 1997 levels | Netherlands | 2010 | 52.0 |
Participation rate (%) | Males | Food management except dish washing | All ISCED 1997 levels | Norway | 2010 | 69.5 |
Participation rate (%) | Males | Food management except dish washing | All ISCED 1997 levels | Poland | 2010 | 53.6 |
Participation rate (%) | Males | Food management except dish washing | All ISCED 1997 levels | Romania | 2010 | 29.8 |
Participation rate (%) | Males | Food management except dish washing | All ISCED 1997 levels | Serbia | 2010 | 31.4 |
Participation rate (%) | Males | Food management except dish washing | All ISCED 1997 levels | Turkey | 2010 | 19.0 |
Participation rate (%) | Males | Food management except dish washing | All ISCED 1997 levels | United Kingdom | 2010 | 56.0 |
Participation rate (%) | Males | Cleaning dwelling | All ISCED 1997 levels | Austria | 2010 | 24.5 |
Participation rate (%) | Males | Cleaning dwelling | All ISCED 1997 levels | Belgium | 2010 | 10.9 |
Participation rate (%) | Males | Cleaning dwelling | All ISCED 1997 levels | Germany (until 1990 former territory of the FRG) | 2010 | 28.9 |
Participation rate (%) | Males | Cleaning dwelling | All ISCED 1997 levels | Estonia | 2010 | 18.3 |
Participation rate (%) | Males | Cleaning dwelling | All ISCED 1997 levels | Greece | 2010 | 9.2 |
Participation rate (%) | Males | Cleaning dwelling | All ISCED 1997 levels | Spain | 2010 | 18.8 |
Participation rate (%) | Males | Cleaning dwelling | All ISCED 1997 levels | Finland | 2010 | 23.9 |
Participation rate (%) | Males | Cleaning dwelling | All ISCED 1997 levels | France | 2010 | 25.5 |
Participation rate (%) | Males | Cleaning dwelling | All ISCED 1997 levels | Hungary | 2010 | 16.4 |
Participation rate (%) | Males | Cleaning dwelling | All ISCED 1997 levels | Italy | 2010 | 16.8 |
Participation rate (%) | Males | Cleaning dwelling | All ISCED 1997 levels | Luxembourg | 2010 | 10.8 |
Participation rate (%) | Males | Cleaning dwelling | All ISCED 1997 levels | Netherlands | 2010 | 22.6 |
Participation rate (%) | Males | Cleaning dwelling | All ISCED 1997 levels | Norway | 2010 | 35.7 |
Participation rate (%) | Males | Cleaning dwelling | All ISCED 1997 levels | Poland | 2010 | 25.9 |
Participation rate (%) | Males | Cleaning dwelling | All ISCED 1997 levels | Romania | 2010 | 16.4 |
Participation rate (%) | Males | Cleaning dwelling | All ISCED 1997 levels | Serbia | 2010 | 16.5 |
Participation rate (%) | Males | Cleaning dwelling | All ISCED 1997 levels | Turkey | 2010 | 7.0 |
Participation rate (%) | Males | Cleaning dwelling | All ISCED 1997 levels | United Kingdom | 2010 | 20.2 |
Then we keep only the columns with sex, activities, countries and values. Before plotting the values we need to merge the columns sex and activities and cut the brackets from the name of Germany.
dt$geo<-gsub(" \\(.*\\)","",dt$geo)
dt<-dt[,c("sex","acl00","geo","values")]
dt[,bd:=paste0(acl00,", ",tolower(sex))][,c("acl00","sex"):=NULL]
dt
geo | values | bd |
---|---|---|
<chr> | <dbl> | <chr> |
Austria | 81.1 | Food management except dish washing, females |
Belgium | 77.0 | Food management except dish washing, females |
Germany | 76.6 | Food management except dish washing, females |
Estonia | 85.0 | Food management except dish washing, females |
Greece | 85.5 | Food management except dish washing, females |
Spain | 81.3 | Food management except dish washing, females |
Finland | 84.4 | Food management except dish washing, females |
France | 79.7 | Food management except dish washing, females |
Hungary | 85.1 | Food management except dish washing, females |
Italy | 87.9 | Food management except dish washing, females |
Luxembourg | 78.4 | Food management except dish washing, females |
Netherlands | 78.5 | Food management except dish washing, females |
Norway | 86.2 | Food management except dish washing, females |
Poland | 90.9 | Food management except dish washing, females |
Romania | 86.9 | Food management except dish washing, females |
Serbia | 88.5 | Food management except dish washing, females |
Turkey | 88.1 | Food management except dish washing, females |
United Kingdom | 80.4 | Food management except dish washing, females |
Austria | 68.6 | Cleaning dwelling, females |
Belgium | 30.9 | Cleaning dwelling, females |
Germany | 59.8 | Cleaning dwelling, females |
Estonia | 50.3 | Cleaning dwelling, females |
Greece | 62.1 | Cleaning dwelling, females |
Spain | 56.0 | Cleaning dwelling, females |
Finland | 51.8 | Cleaning dwelling, females |
France | 65.6 | Cleaning dwelling, females |
Hungary | 54.1 | Cleaning dwelling, females |
Italy | 79.8 | Cleaning dwelling, females |
Luxembourg | 33.7 | Cleaning dwelling, females |
Netherlands | 51.6 | Cleaning dwelling, females |
⋮ | ⋮ | ⋮ |
Finland | 60.9 | Food management except dish washing, males |
France | 43.2 | Food management except dish washing, males |
Hungary | 43.3 | Food management except dish washing, males |
Italy | 40.5 | Food management except dish washing, males |
Luxembourg | 42.3 | Food management except dish washing, males |
Netherlands | 52.0 | Food management except dish washing, males |
Norway | 69.5 | Food management except dish washing, males |
Poland | 53.6 | Food management except dish washing, males |
Romania | 29.8 | Food management except dish washing, males |
Serbia | 31.4 | Food management except dish washing, males |
Turkey | 19.0 | Food management except dish washing, males |
United Kingdom | 56.0 | Food management except dish washing, males |
Austria | 24.5 | Cleaning dwelling, males |
Belgium | 10.9 | Cleaning dwelling, males |
Germany | 28.9 | Cleaning dwelling, males |
Estonia | 18.3 | Cleaning dwelling, males |
Greece | 9.2 | Cleaning dwelling, males |
Spain | 18.8 | Cleaning dwelling, males |
Finland | 23.9 | Cleaning dwelling, males |
France | 25.5 | Cleaning dwelling, males |
Hungary | 16.4 | Cleaning dwelling, males |
Italy | 16.8 | Cleaning dwelling, males |
Luxembourg | 10.8 | Cleaning dwelling, males |
Netherlands | 22.6 | Cleaning dwelling, males |
Norway | 35.7 | Cleaning dwelling, males |
Poland | 25.9 | Cleaning dwelling, males |
Romania | 16.4 | Cleaning dwelling, males |
Serbia | 16.5 | Cleaning dwelling, males |
Turkey | 7.0 | Cleaning dwelling, males |
United Kingdom | 20.2 | Cleaning dwelling, males |
We make the graph again with ggplot. We have to order by increasing value of Food management except dish washing, females, add the empty spaces before the EFTA and accession countries. Finally adjust scaling, remove vertical grid lines, column width and resize the plotting area to better see the figure.
dt_sep<-data.table::data.table(bd=c("Cleaning dwelling, males","Cleaning dwelling, males"),geo=c(" "," "),values=c(NA,NA))
dt<-rbind(dt,dt_sep)
geo_ord<-dt[(geo %in% eu_ctry_names)&grepl("Food management except dish washing, females",bd)]
geo_ord<-geo_ord[order(values)]$geo
geo_ord<-c(geo_ord,' ','Norway',' ','Turkey','Serbia')
dt$geo<-factor(dt$geo,levels=geo_ord)
bd_ord<-sort(unique(dt$bd),decreasing=TRUE)
dt$bd<-factor(dt$bd,levels=bd_ord)
fig5_colors<-c("#FAA519","#FCC975","#286EB4","#71A8DF")
options(repr.plot.width=9, repr.plot.height=6,repr.plot.res=300)
ggplot(dt,aes(x=geo,y=values)) + theme_minimal() +
geom_bar(data=dt, aes(fill=bd),position="dodge",stat="identity",width=0.6)+
scale_fill_manual(values = fig5_colors)+
scale_y_continuous(breaks=seq(0,100,10)) +
ggtitle("Figure 5: Participation rate per day in cleaning and food management, by gender, % (2008 to 2015)") +
ylab("")+
xlab("")+
theme(legend.title = element_blank(),
legend.position= "bottom",
axis.text.x = element_text(angle = 90, hjust = 1),
panel.grid.major.x = element_blank(),
panel.grid.minor.y = element_blank())
Warning message: "Removed 2 rows containing missing values (geom_bar)."
The data is again in the tus_00educ dataset as in Figure 5. We apply the same filter to the data for the year (date_filter=yr
) and a modified one for the values in the graph (filters=list(unit="Participation rate",age="total",acl00="^iron|^laund",sex="male",isced97="^all")
. This time we can use again the SDMX REST API to get the values are it is numeric.
dt<-get_eurostat_data("tus_00educ",filters=list(unit="Participation rate",age="total",acl00="^iron|^laund",sex="male",isced97="^all"),date_filter=eval(yr),label=T,ignore.case=T,exact_match=F,perl=T,stringsAsFactors=F)
dt
unit | sex | acl00 | isced97 | geo | time | values |
---|---|---|---|---|---|---|
<chr> | <chr> | <chr> | <chr> | <chr> | <chr> | <dbl> |
Participation rate (%) | Females | Laundry | All ISCED 1997 levels | Austria | 2010 | 32.8 |
Participation rate (%) | Females | Laundry | All ISCED 1997 levels | Belgium | 2010 | 23.5 |
Participation rate (%) | Females | Laundry | All ISCED 1997 levels | Germany (until 1990 former territory of the FRG) | 2010 | 30.1 |
Participation rate (%) | Females | Laundry | All ISCED 1997 levels | Estonia | 2010 | 13.8 |
Participation rate (%) | Females | Laundry | All ISCED 1997 levels | Greece | 2010 | 27.8 |
Participation rate (%) | Females | Laundry | All ISCED 1997 levels | Spain | 2010 | 27.8 |
Participation rate (%) | Females | Laundry | All ISCED 1997 levels | Finland | 2010 | 33.5 |
Participation rate (%) | Females | Laundry | All ISCED 1997 levels | France | 2010 | 19.3 |
Participation rate (%) | Females | Laundry | All ISCED 1997 levels | Hungary | 2010 | 28.7 |
Participation rate (%) | Females | Laundry | All ISCED 1997 levels | Italy | 2010 | 22.7 |
Participation rate (%) | Females | Laundry | All ISCED 1997 levels | Luxembourg | 2010 | 26.0 |
Participation rate (%) | Females | Laundry | All ISCED 1997 levels | Netherlands | 2010 | 34.8 |
Participation rate (%) | Females | Laundry | All ISCED 1997 levels | Norway | 2010 | 39.5 |
Participation rate (%) | Females | Laundry | All ISCED 1997 levels | Poland | 2010 | 23.2 |
Participation rate (%) | Females | Laundry | All ISCED 1997 levels | Romania | 2010 | 30.2 |
Participation rate (%) | Females | Laundry | All ISCED 1997 levels | Serbia | 2010 | 29.1 |
Participation rate (%) | Females | Laundry | All ISCED 1997 levels | Turkey | 2010 | 18.7 |
Participation rate (%) | Females | Laundry | All ISCED 1997 levels | United Kingdom | 2010 | 30.0 |
Participation rate (%) | Females | Ironing | All ISCED 1997 levels | Austria | 2010 | 28.3 |
Participation rate (%) | Females | Ironing | All ISCED 1997 levels | Belgium | 2010 | 24.2 |
Participation rate (%) | Females | Ironing | All ISCED 1997 levels | Germany (until 1990 former territory of the FRG) | 2010 | 13.4 |
Participation rate (%) | Females | Ironing | All ISCED 1997 levels | Estonia | 2010 | 7.8 |
Participation rate (%) | Females | Ironing | All ISCED 1997 levels | Greece | 2010 | 26.7 |
Participation rate (%) | Females | Ironing | All ISCED 1997 levels | Spain | 2010 | 17.0 |
Participation rate (%) | Females | Ironing | All ISCED 1997 levels | Finland | 2010 | 8.1 |
Participation rate (%) | Females | Ironing | All ISCED 1997 levels | France | 2010 | 17.5 |
Participation rate (%) | Females | Ironing | All ISCED 1997 levels | Hungary | 2010 | 13.8 |
Participation rate (%) | Females | Ironing | All ISCED 1997 levels | Italy | 2010 | 24.6 |
Participation rate (%) | Females | Ironing | All ISCED 1997 levels | Luxembourg | 2010 | 29.1 |
Participation rate (%) | Females | Ironing | All ISCED 1997 levels | Netherlands | 2010 | 9.7 |
⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ |
Participation rate (%) | Males | Laundry | All ISCED 1997 levels | Finland | 2010 | 7.7 |
Participation rate (%) | Males | Laundry | All ISCED 1997 levels | France | 2010 | 2.7 |
Participation rate (%) | Males | Laundry | All ISCED 1997 levels | Hungary | 2010 | 2.4 |
Participation rate (%) | Males | Laundry | All ISCED 1997 levels | Italy | 2010 | 1.1 |
Participation rate (%) | Males | Laundry | All ISCED 1997 levels | Luxembourg | 2010 | 3.9 |
Participation rate (%) | Males | Laundry | All ISCED 1997 levels | Netherlands | 2010 | 6.5 |
Participation rate (%) | Males | Laundry | All ISCED 1997 levels | Norway | 2010 | 11.5 |
Participation rate (%) | Males | Laundry | All ISCED 1997 levels | Poland | 2010 | 2.8 |
Participation rate (%) | Males | Laundry | All ISCED 1997 levels | Romania | 2010 | 2.3 |
Participation rate (%) | Males | Laundry | All ISCED 1997 levels | Serbia | 2010 | 2.1 |
Participation rate (%) | Males | Laundry | All ISCED 1997 levels | Turkey | 2010 | 0.6 |
Participation rate (%) | Males | Laundry | All ISCED 1997 levels | United Kingdom | 2010 | 7.0 |
Participation rate (%) | Males | Ironing | All ISCED 1997 levels | Austria | 2010 | 3.6 |
Participation rate (%) | Males | Ironing | All ISCED 1997 levels | Belgium | 2010 | 2.8 |
Participation rate (%) | Males | Ironing | All ISCED 1997 levels | Germany (until 1990 former territory of the FRG) | 2010 | 1.9 |
Participation rate (%) | Males | Ironing | All ISCED 1997 levels | Estonia | 2010 | 1.0 |
Participation rate (%) | Males | Ironing | All ISCED 1997 levels | Greece | 2010 | 1.0 |
Participation rate (%) | Males | Ironing | All ISCED 1997 levels | Spain | 2010 | 1.1 |
Participation rate (%) | Males | Ironing | All ISCED 1997 levels | Finland | 2010 | 1.4 |
Participation rate (%) | Males | Ironing | All ISCED 1997 levels | France | 2010 | 1.6 |
Participation rate (%) | Males | Ironing | All ISCED 1997 levels | Hungary | 2010 | 0.1 |
Participation rate (%) | Males | Ironing | All ISCED 1997 levels | Italy | 2010 | 0.4 |
Participation rate (%) | Males | Ironing | All ISCED 1997 levels | Luxembourg | 2010 | 7.9 |
Participation rate (%) | Males | Ironing | All ISCED 1997 levels | Netherlands | 2010 | 1.4 |
Participation rate (%) | Males | Ironing | All ISCED 1997 levels | Norway | 2010 | 1.5 |
Participation rate (%) | Males | Ironing | All ISCED 1997 levels | Poland | 2010 | 1.7 |
Participation rate (%) | Males | Ironing | All ISCED 1997 levels | Romania | 2010 | 1.2 |
Participation rate (%) | Males | Ironing | All ISCED 1997 levels | Serbia | 2010 | 0.6 |
Participation rate (%) | Males | Ironing | All ISCED 1997 levels | Turkey | 2010 | 0.5 |
Participation rate (%) | Males | Ironing | All ISCED 1997 levels | United Kingdom | 2010 | 3.3 |
Then we keep only the columns with sex, activities, countries and values. Before plotting the values we need to merge the columns sex and activities and cut the brackets from the name of Germany.
dt$geo<-gsub(" \\(.*\\)","",dt$geo)
dt<-dt[,c("sex","acl00","geo","values")]
dt[,bd:=paste0(acl00,", ",tolower(sex))][,c("acl00","sex"):=NULL]
dt
geo | values | bd |
---|---|---|
<chr> | <dbl> | <chr> |
Austria | 32.8 | Laundry, females |
Belgium | 23.5 | Laundry, females |
Germany | 30.1 | Laundry, females |
Estonia | 13.8 | Laundry, females |
Greece | 27.8 | Laundry, females |
Spain | 27.8 | Laundry, females |
Finland | 33.5 | Laundry, females |
France | 19.3 | Laundry, females |
Hungary | 28.7 | Laundry, females |
Italy | 22.7 | Laundry, females |
Luxembourg | 26.0 | Laundry, females |
Netherlands | 34.8 | Laundry, females |
Norway | 39.5 | Laundry, females |
Poland | 23.2 | Laundry, females |
Romania | 30.2 | Laundry, females |
Serbia | 29.1 | Laundry, females |
Turkey | 18.7 | Laundry, females |
United Kingdom | 30.0 | Laundry, females |
Austria | 28.3 | Ironing, females |
Belgium | 24.2 | Ironing, females |
Germany | 13.4 | Ironing, females |
Estonia | 7.8 | Ironing, females |
Greece | 26.7 | Ironing, females |
Spain | 17.0 | Ironing, females |
Finland | 8.1 | Ironing, females |
France | 17.5 | Ironing, females |
Hungary | 13.8 | Ironing, females |
Italy | 24.6 | Ironing, females |
Luxembourg | 29.1 | Ironing, females |
Netherlands | 9.7 | Ironing, females |
⋮ | ⋮ | ⋮ |
Finland | 7.7 | Laundry, males |
France | 2.7 | Laundry, males |
Hungary | 2.4 | Laundry, males |
Italy | 1.1 | Laundry, males |
Luxembourg | 3.9 | Laundry, males |
Netherlands | 6.5 | Laundry, males |
Norway | 11.5 | Laundry, males |
Poland | 2.8 | Laundry, males |
Romania | 2.3 | Laundry, males |
Serbia | 2.1 | Laundry, males |
Turkey | 0.6 | Laundry, males |
United Kingdom | 7.0 | Laundry, males |
Austria | 3.6 | Ironing, males |
Belgium | 2.8 | Ironing, males |
Germany | 1.9 | Ironing, males |
Estonia | 1.0 | Ironing, males |
Greece | 1.0 | Ironing, males |
Spain | 1.1 | Ironing, males |
Finland | 1.4 | Ironing, males |
France | 1.6 | Ironing, males |
Hungary | 0.1 | Ironing, males |
Italy | 0.4 | Ironing, males |
Luxembourg | 7.9 | Ironing, males |
Netherlands | 1.4 | Ironing, males |
Norway | 1.5 | Ironing, males |
Poland | 1.7 | Ironing, males |
Romania | 1.2 | Ironing, males |
Serbia | 0.6 | Ironing, males |
Turkey | 0.5 | Ironing, males |
United Kingdom | 3.3 | Ironing, males |
We make the graph again with ggplot. We have to order by increasing value of Laundry, females, add the empty spaces before the EFTA and accession countries. Finally adjust scaling, remove vertical grid lines, column width and resize the plotting area to better see the figure.
dt_sep<-data.table::data.table(bd=c("Laundry, males","Laundry, males"),geo=c(" "," "),values=c(NA,NA))
dt<-rbind(dt,dt_sep)
geo_ord<-dt[(geo %in% eu_ctry_names)&grepl("Laundry, females",bd)]
geo_ord<-geo_ord[order(values)]$geo
geo_ord<-c(geo_ord,' ','Norway',' ','Turkey','Serbia')
dt$geo<-factor(dt$geo,levels=geo_ord)
bd_ord<-sort(unique(dt$bd),decreasing=TRUE)
dt$bd<-factor(dt$bd,levels=bd_ord)
fig6_colors<-c("#FAA519","#FCC975","#286EB4","#71A8DF")
options(repr.plot.width=9, repr.plot.height=6,repr.plot.res=300)
ggplot(dt,aes(x=geo,y=values)) + theme_minimal() +
geom_bar(data=dt, aes(fill=bd),position="dodge",stat="identity",width=0.6)+
scale_fill_manual(values = fig6_colors)+
scale_y_continuous(breaks=seq(0,40,5)) +
ggtitle("Figure 6: Participation rate per day in laundry and ironing, by gender, % (2008 to 2015)") +
ylab("")+
xlab("")+
theme(legend.title = element_blank(),
legend.position= "bottom",
axis.text.x = element_text(angle = 90, hjust = 1),
panel.grid.major.x = element_blank(),
panel.grid.minor.y = element_blank())
Warning message: "Removed 2 rows containing missing values (geom_bar)."
The data is again in the tus_00educ dataset as in Figure 5. We apply the same filter to the data for the year (date_filter=yr
) and a modified one for the values in the graph (filters=list(unit="Participation rate",age="total",acl00="^shop",sex="male",isced97="^all")
. This time we can use again the SDMX REST API to get the values are it is numeric.
dt<-get_eurostat_data("tus_00educ",filters=list(unit="Participation rate",age="total",acl00="^shop",sex="male",isced97="^all"),date_filter=eval(yr),label=T,ignore.case=T,exact_match=F,perl=T,stringsAsFactors=F)
dt
unit | sex | acl00 | isced97 | geo | time | values |
---|---|---|---|---|---|---|
<chr> | <chr> | <chr> | <chr> | <chr> | <chr> | <dbl> |
Participation rate (%) | Females | Shopping and services | All ISCED 1997 levels | Austria | 2010 | 54.1 |
Participation rate (%) | Females | Shopping and services | All ISCED 1997 levels | Belgium | 2010 | 50.1 |
Participation rate (%) | Females | Shopping and services | All ISCED 1997 levels | Germany (until 1990 former territory of the FRG) | 2010 | 54.2 |
Participation rate (%) | Females | Shopping and services | All ISCED 1997 levels | Estonia | 2010 | 55.2 |
Participation rate (%) | Females | Shopping and services | All ISCED 1997 levels | Greece | 2010 | 35.3 |
Participation rate (%) | Females | Shopping and services | All ISCED 1997 levels | Spain | 2010 | 51.2 |
Participation rate (%) | Females | Shopping and services | All ISCED 1997 levels | Finland | 2010 | 55.2 |
Participation rate (%) | Females | Shopping and services | All ISCED 1997 levels | France | 2010 | 39.4 |
Participation rate (%) | Females | Shopping and services | All ISCED 1997 levels | Hungary | 2010 | 50.0 |
Participation rate (%) | Females | Shopping and services | All ISCED 1997 levels | Italy | 2010 | 53.0 |
Participation rate (%) | Females | Shopping and services | All ISCED 1997 levels | Luxembourg | 2010 | 44.4 |
Participation rate (%) | Females | Shopping and services | All ISCED 1997 levels | Netherlands | 2010 | 54.9 |
Participation rate (%) | Females | Shopping and services | All ISCED 1997 levels | Norway | 2010 | 57.2 |
Participation rate (%) | Females | Shopping and services | All ISCED 1997 levels | Poland | 2010 | 56.5 |
Participation rate (%) | Females | Shopping and services | All ISCED 1997 levels | Romania | 2010 | 31.7 |
Participation rate (%) | Females | Shopping and services | All ISCED 1997 levels | Serbia | 2010 | 48.4 |
Participation rate (%) | Females | Shopping and services | All ISCED 1997 levels | Turkey | 2010 | 22.5 |
Participation rate (%) | Females | Shopping and services | All ISCED 1997 levels | United Kingdom | 2010 | 50.7 |
Participation rate (%) | Males | Shopping and services | All ISCED 1997 levels | Austria | 2010 | 37.0 |
Participation rate (%) | Males | Shopping and services | All ISCED 1997 levels | Belgium | 2010 | 41.0 |
Participation rate (%) | Males | Shopping and services | All ISCED 1997 levels | Germany (until 1990 former territory of the FRG) | 2010 | 45.7 |
Participation rate (%) | Males | Shopping and services | All ISCED 1997 levels | Estonia | 2010 | 43.0 |
Participation rate (%) | Males | Shopping and services | All ISCED 1997 levels | Greece | 2010 | 25.9 |
Participation rate (%) | Males | Shopping and services | All ISCED 1997 levels | Spain | 2010 | 33.6 |
Participation rate (%) | Males | Shopping and services | All ISCED 1997 levels | Finland | 2010 | 50.5 |
Participation rate (%) | Males | Shopping and services | All ISCED 1997 levels | France | 2010 | 30.0 |
Participation rate (%) | Males | Shopping and services | All ISCED 1997 levels | Hungary | 2010 | 34.2 |
Participation rate (%) | Males | Shopping and services | All ISCED 1997 levels | Italy | 2010 | 34.5 |
Participation rate (%) | Males | Shopping and services | All ISCED 1997 levels | Luxembourg | 2010 | 31.4 |
Participation rate (%) | Males | Shopping and services | All ISCED 1997 levels | Netherlands | 2010 | 41.4 |
Participation rate (%) | Males | Shopping and services | All ISCED 1997 levels | Norway | 2010 | 49.1 |
Participation rate (%) | Males | Shopping and services | All ISCED 1997 levels | Poland | 2010 | 38.9 |
Participation rate (%) | Males | Shopping and services | All ISCED 1997 levels | Romania | 2010 | 30.0 |
Participation rate (%) | Males | Shopping and services | All ISCED 1997 levels | Serbia | 2010 | 40.5 |
Participation rate (%) | Males | Shopping and services | All ISCED 1997 levels | Turkey | 2010 | 22.9 |
Participation rate (%) | Males | Shopping and services | All ISCED 1997 levels | United Kingdom | 2010 | 39.0 |
Then we keep only the columns with sex, activities, countries and values. Before plotting the values we need to merge the columns sex and activities and cut the brackets from the name of Germany.
dt$geo<-gsub(" \\(.*\\)","",dt$geo)
dt<-dt[,c("sex","acl00","geo","values")]
dt[,bd:=paste0(acl00,", ",tolower(sex))][,c("acl00","sex"):=NULL]
dt
geo | values | bd |
---|---|---|
<chr> | <dbl> | <chr> |
Austria | 54.1 | Shopping and services, females |
Belgium | 50.1 | Shopping and services, females |
Germany | 54.2 | Shopping and services, females |
Estonia | 55.2 | Shopping and services, females |
Greece | 35.3 | Shopping and services, females |
Spain | 51.2 | Shopping and services, females |
Finland | 55.2 | Shopping and services, females |
France | 39.4 | Shopping and services, females |
Hungary | 50.0 | Shopping and services, females |
Italy | 53.0 | Shopping and services, females |
Luxembourg | 44.4 | Shopping and services, females |
Netherlands | 54.9 | Shopping and services, females |
Norway | 57.2 | Shopping and services, females |
Poland | 56.5 | Shopping and services, females |
Romania | 31.7 | Shopping and services, females |
Serbia | 48.4 | Shopping and services, females |
Turkey | 22.5 | Shopping and services, females |
United Kingdom | 50.7 | Shopping and services, females |
Austria | 37.0 | Shopping and services, males |
Belgium | 41.0 | Shopping and services, males |
Germany | 45.7 | Shopping and services, males |
Estonia | 43.0 | Shopping and services, males |
Greece | 25.9 | Shopping and services, males |
Spain | 33.6 | Shopping and services, males |
Finland | 50.5 | Shopping and services, males |
France | 30.0 | Shopping and services, males |
Hungary | 34.2 | Shopping and services, males |
Italy | 34.5 | Shopping and services, males |
Luxembourg | 31.4 | Shopping and services, males |
Netherlands | 41.4 | Shopping and services, males |
Norway | 49.1 | Shopping and services, males |
Poland | 38.9 | Shopping and services, males |
Romania | 30.0 | Shopping and services, males |
Serbia | 40.5 | Shopping and services, males |
Turkey | 22.9 | Shopping and services, males |
United Kingdom | 39.0 | Shopping and services, males |
We make the graph again with ggplot. We have to order by increasing value of Shopping and services, females, add the empty spaces before the EFTA and accession countries. Finally adjust scaling, remove vertical grid lines, column width and resize the plotting area to better see the figure.
dt_sep<-data.table::data.table(bd=c("Shopping and services, males","Shopping and services, males"),geo=c(" "," "),values=c(NA,NA))
dt<-rbind(dt,dt_sep)
geo_ord<-dt[(geo %in% eu_ctry_names)&grepl("Shopping and services, females",bd)]
geo_ord<-geo_ord[order(values)]$geo
geo_ord<-c(geo_ord,' ','Norway',' ','Turkey','Serbia')
dt$geo<-factor(dt$geo,levels=geo_ord)
bd_ord<-sort(unique(dt$bd),decreasing=TRUE)
dt$bd<-factor(dt$bd,levels=bd_ord)
fig7_colors<-c("#FAA519","#286EB4") #"#FCC975","#71A8DF",
options(repr.plot.width=9, repr.plot.height=6,repr.plot.res=300)
ggplot(dt,aes(x=geo,y=values)) + theme_minimal() +
geom_bar(data=dt, aes(fill=bd),position="dodge",stat="identity",width=0.6)+
scale_fill_manual(values = fig7_colors)+
scale_y_continuous(breaks=seq(0,70,10)) +
ggtitle("Figure 7: Participation rate per day in shopping and services, by gender, % (2008 to 2015)") +
ylab("")+
xlab("")+
theme(legend.title = element_blank(),
legend.position= "bottom",
axis.text.x = element_text(angle = 90, hjust = 1),
panel.grid.major.x = element_blank(),
panel.grid.minor.y = element_blank())
Warning message: "Removed 2 rows containing missing values (geom_bar)."
The data is again in the tus_00educ dataset as in Figure 5. We apply the same filter to the data for the year (date_filter=yr
) and a modified one for the values in the graph (filters=list(unit="Participation rate",age="total",acl00="^child|^teach",sex="male",isced97="^all")
. This time we can use again the SDMX REST API to get the values are it is numeric.
dt<-get_eurostat_data("tus_00educ",filters=list(unit="Participation rate",age="total",acl00="^child|^teach",sex="male",isced97="^all"),date_filter=eval(yr),label=T,ignore.case=T,exact_match=F,perl=T,stringsAsFactors=F)
dt
unit | sex | acl00 | isced97 | geo | time | values |
---|---|---|---|---|---|---|
<chr> | <chr> | <chr> | <chr> | <chr> | <chr> | <dbl> |
Participation rate (%) | Females | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Austria | 2010 | 23.0 |
Participation rate (%) | Females | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Belgium | 2010 | 22.7 |
Participation rate (%) | Females | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Germany (until 1990 former territory of the FRG) | 2010 | 16.3 |
Participation rate (%) | Females | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Estonia | 2010 | 23.2 |
Participation rate (%) | Females | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Greece | 2010 | 14.1 |
Participation rate (%) | Females | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Spain | 2010 | 26.0 |
Participation rate (%) | Females | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Finland | 2010 | 18.7 |
Participation rate (%) | Females | Childcare, except teaching, reading and talking | All ISCED 1997 levels | France | 2010 | 26.5 |
Participation rate (%) | Females | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Hungary | 2010 | 19.3 |
Participation rate (%) | Females | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Italy | 2010 | 21.1 |
Participation rate (%) | Females | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Luxembourg | 2010 | 21.1 |
Participation rate (%) | Females | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Netherlands | 2010 | 23.3 |
Participation rate (%) | Females | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Norway | 2010 | 26.4 |
Participation rate (%) | Females | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Poland | 2010 | 26.5 |
Participation rate (%) | Females | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Romania | 2010 | 15.4 |
Participation rate (%) | Females | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Serbia | 2010 | 18.4 |
Participation rate (%) | Females | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Turkey | 2010 | 31.7 |
Participation rate (%) | Females | Childcare, except teaching, reading and talking | All ISCED 1997 levels | United Kingdom | 2010 | 26.2 |
Participation rate (%) | Females | Teaching, reading and talking with child | All ISCED 1997 levels | Austria | 2010 | 23.6 |
Participation rate (%) | Females | Teaching, reading and talking with child | All ISCED 1997 levels | Belgium | 2010 | 14.2 |
Participation rate (%) | Females | Teaching, reading and talking with child | All ISCED 1997 levels | Germany (until 1990 former territory of the FRG) | 2010 | 13.0 |
Participation rate (%) | Females | Teaching, reading and talking with child | All ISCED 1997 levels | Estonia | 2010 | 15.4 |
Participation rate (%) | Females | Teaching, reading and talking with child | All ISCED 1997 levels | Greece | 2010 | 10.9 |
Participation rate (%) | Females | Teaching, reading and talking with child | All ISCED 1997 levels | Spain | 2010 | 13.9 |
Participation rate (%) | Females | Teaching, reading and talking with child | All ISCED 1997 levels | Finland | 2010 | 14.7 |
Participation rate (%) | Females | Teaching, reading and talking with child | All ISCED 1997 levels | France | 2010 | 14.7 |
Participation rate (%) | Females | Teaching, reading and talking with child | All ISCED 1997 levels | Hungary | 2010 | 21.7 |
Participation rate (%) | Females | Teaching, reading and talking with child | All ISCED 1997 levels | Italy | 2010 | 14.2 |
Participation rate (%) | Females | Teaching, reading and talking with child | All ISCED 1997 levels | Luxembourg | 2010 | 14.7 |
Participation rate (%) | Females | Teaching, reading and talking with child | All ISCED 1997 levels | Netherlands | 2010 | 14.7 |
⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ |
Participation rate (%) | Males | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Finland | 2010 | 12.0 |
Participation rate (%) | Males | Childcare, except teaching, reading and talking | All ISCED 1997 levels | France | 2010 | 14.0 |
Participation rate (%) | Males | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Hungary | 2010 | 8.6 |
Participation rate (%) | Males | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Italy | 2010 | 8.6 |
Participation rate (%) | Males | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Luxembourg | 2010 | 12.1 |
Participation rate (%) | Males | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Netherlands | 2010 | 16.0 |
Participation rate (%) | Males | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Norway | 2010 | 21.2 |
Participation rate (%) | Males | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Poland | 2010 | 13.4 |
Participation rate (%) | Males | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Romania | 2010 | 5.9 |
Participation rate (%) | Males | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Serbia | 2010 | 7.9 |
Participation rate (%) | Males | Childcare, except teaching, reading and talking | All ISCED 1997 levels | Turkey | 2010 | 6.0 |
Participation rate (%) | Males | Childcare, except teaching, reading and talking | All ISCED 1997 levels | United Kingdom | 2010 | 13.4 |
Participation rate (%) | Males | Teaching, reading and talking with child | All ISCED 1997 levels | Austria | 2010 | 15.2 |
Participation rate (%) | Males | Teaching, reading and talking with child | All ISCED 1997 levels | Belgium | 2010 | 8.8 |
Participation rate (%) | Males | Teaching, reading and talking with child | All ISCED 1997 levels | Germany (until 1990 former territory of the FRG) | 2010 | 7.2 |
Participation rate (%) | Males | Teaching, reading and talking with child | All ISCED 1997 levels | Estonia | 2010 | 7.8 |
Participation rate (%) | Males | Teaching, reading and talking with child | All ISCED 1997 levels | Greece | 2010 | 10.0 |
Participation rate (%) | Males | Teaching, reading and talking with child | All ISCED 1997 levels | Spain | 2010 | 11.0 |
Participation rate (%) | Males | Teaching, reading and talking with child | All ISCED 1997 levels | Finland | 2010 | 8.4 |
Participation rate (%) | Males | Teaching, reading and talking with child | All ISCED 1997 levels | France | 2010 | 9.1 |
Participation rate (%) | Males | Teaching, reading and talking with child | All ISCED 1997 levels | Hungary | 2010 | 15.4 |
Participation rate (%) | Males | Teaching, reading and talking with child | All ISCED 1997 levels | Italy | 2010 | 10.0 |
Participation rate (%) | Males | Teaching, reading and talking with child | All ISCED 1997 levels | Luxembourg | 2010 | 8.4 |
Participation rate (%) | Males | Teaching, reading and talking with child | All ISCED 1997 levels | Netherlands | 2010 | 9.0 |
Participation rate (%) | Males | Teaching, reading and talking with child | All ISCED 1997 levels | Norway | 2010 | 11.5 |
Participation rate (%) | Males | Teaching, reading and talking with child | All ISCED 1997 levels | Poland | 2010 | 16.4 |
Participation rate (%) | Males | Teaching, reading and talking with child | All ISCED 1997 levels | Romania | 2010 | 7.0 |
Participation rate (%) | Males | Teaching, reading and talking with child | All ISCED 1997 levels | Serbia | 2010 | 8.5 |
Participation rate (%) | Males | Teaching, reading and talking with child | All ISCED 1997 levels | Turkey | 2010 | 12.5 |
Participation rate (%) | Males | Teaching, reading and talking with child | All ISCED 1997 levels | United Kingdom | 2010 | 9.3 |
Then we keep only the columns with sex, activities, countries and values. Before plotting the values we need to merge the columns sex and activities and cut the brackets from the name of Germany.
dt$geo<-gsub(" \\(.*\\)","",dt$geo)
dt<-dt[,c("sex","acl00","geo","values")]
dt[,bd:=paste0(acl00,", ",tolower(sex))][,c("acl00","sex"):=NULL]
dt
geo | values | bd |
---|---|---|
<chr> | <dbl> | <chr> |
Austria | 23.0 | Childcare, except teaching, reading and talking, females |
Belgium | 22.7 | Childcare, except teaching, reading and talking, females |
Germany | 16.3 | Childcare, except teaching, reading and talking, females |
Estonia | 23.2 | Childcare, except teaching, reading and talking, females |
Greece | 14.1 | Childcare, except teaching, reading and talking, females |
Spain | 26.0 | Childcare, except teaching, reading and talking, females |
Finland | 18.7 | Childcare, except teaching, reading and talking, females |
France | 26.5 | Childcare, except teaching, reading and talking, females |
Hungary | 19.3 | Childcare, except teaching, reading and talking, females |
Italy | 21.1 | Childcare, except teaching, reading and talking, females |
Luxembourg | 21.1 | Childcare, except teaching, reading and talking, females |
Netherlands | 23.3 | Childcare, except teaching, reading and talking, females |
Norway | 26.4 | Childcare, except teaching, reading and talking, females |
Poland | 26.5 | Childcare, except teaching, reading and talking, females |
Romania | 15.4 | Childcare, except teaching, reading and talking, females |
Serbia | 18.4 | Childcare, except teaching, reading and talking, females |
Turkey | 31.7 | Childcare, except teaching, reading and talking, females |
United Kingdom | 26.2 | Childcare, except teaching, reading and talking, females |
Austria | 23.6 | Teaching, reading and talking with child, females |
Belgium | 14.2 | Teaching, reading and talking with child, females |
Germany | 13.0 | Teaching, reading and talking with child, females |
Estonia | 15.4 | Teaching, reading and talking with child, females |
Greece | 10.9 | Teaching, reading and talking with child, females |
Spain | 13.9 | Teaching, reading and talking with child, females |
Finland | 14.7 | Teaching, reading and talking with child, females |
France | 14.7 | Teaching, reading and talking with child, females |
Hungary | 21.7 | Teaching, reading and talking with child, females |
Italy | 14.2 | Teaching, reading and talking with child, females |
Luxembourg | 14.7 | Teaching, reading and talking with child, females |
Netherlands | 14.7 | Teaching, reading and talking with child, females |
⋮ | ⋮ | ⋮ |
Finland | 12.0 | Childcare, except teaching, reading and talking, males |
France | 14.0 | Childcare, except teaching, reading and talking, males |
Hungary | 8.6 | Childcare, except teaching, reading and talking, males |
Italy | 8.6 | Childcare, except teaching, reading and talking, males |
Luxembourg | 12.1 | Childcare, except teaching, reading and talking, males |
Netherlands | 16.0 | Childcare, except teaching, reading and talking, males |
Norway | 21.2 | Childcare, except teaching, reading and talking, males |
Poland | 13.4 | Childcare, except teaching, reading and talking, males |
Romania | 5.9 | Childcare, except teaching, reading and talking, males |
Serbia | 7.9 | Childcare, except teaching, reading and talking, males |
Turkey | 6.0 | Childcare, except teaching, reading and talking, males |
United Kingdom | 13.4 | Childcare, except teaching, reading and talking, males |
Austria | 15.2 | Teaching, reading and talking with child, males |
Belgium | 8.8 | Teaching, reading and talking with child, males |
Germany | 7.2 | Teaching, reading and talking with child, males |
Estonia | 7.8 | Teaching, reading and talking with child, males |
Greece | 10.0 | Teaching, reading and talking with child, males |
Spain | 11.0 | Teaching, reading and talking with child, males |
Finland | 8.4 | Teaching, reading and talking with child, males |
France | 9.1 | Teaching, reading and talking with child, males |
Hungary | 15.4 | Teaching, reading and talking with child, males |
Italy | 10.0 | Teaching, reading and talking with child, males |
Luxembourg | 8.4 | Teaching, reading and talking with child, males |
Netherlands | 9.0 | Teaching, reading and talking with child, males |
Norway | 11.5 | Teaching, reading and talking with child, males |
Poland | 16.4 | Teaching, reading and talking with child, males |
Romania | 7.0 | Teaching, reading and talking with child, males |
Serbia | 8.5 | Teaching, reading and talking with child, males |
Turkey | 12.5 | Teaching, reading and talking with child, males |
United Kingdom | 9.3 | Teaching, reading and talking with child, males |
We make the graph again with ggplot. We have to order by increasing value of Childcare, except teaching, reading and talking, females, add the empty spaces before the EFTA and accession countries. Finally adjust scaling, remove vertical grid lines, column width and resize the plotting area to better see the figure.
dt_sep<-data.table::data.table(bd=c("Childcare, except teaching, reading and talking, males","Childcare, except teaching, reading and talking, males"),geo=c(" "," "),values=c(NA,NA))
dt<-rbind(dt,dt_sep)
geo_ord<-dt[(geo %in% eu_ctry_names)&grepl("Childcare, except teaching, reading and talking, females",bd)]
geo_ord<-geo_ord[order(values)]$geo
geo_ord<-c(geo_ord,' ','Norway',' ','Serbia','Turkey')
dt$geo<-factor(dt$geo,levels=geo_ord)
bd_ord<-sort(unique(dt$bd))[c(2,1,4,3)]
dt$bd<-factor(dt$bd,levels=bd_ord)
fig8_colors<-c("#FAA519","#FCC975","#286EB4","#71A8DF")
options(repr.plot.width=9, repr.plot.height=6,repr.plot.res=300)
ggplot(dt,aes(x=geo,y=values)) + theme_minimal() +
geom_bar(data=dt, aes(fill=bd),position="dodge",stat="identity",width=0.6)+
scale_fill_manual(values = fig8_colors)+
scale_y_continuous(breaks=seq(0,35,5)) +
ggtitle("Figure 8: Participation rate per day in childcare, by gender, % (2008 to 2015)") +
ylab("")+
xlab("")+
theme(legend.title = element_blank(),
legend.position= "bottom",
axis.text.x = element_text(angle = 90, hjust = 1),
panel.grid.major.x = element_blank(),
panel.grid.minor.y = element_blank())
Warning message: "Removed 2 rows containing missing values (geom_bar)."
The data is again in the tus_00educ dataset as in Figure 5. We apply the same filter to the data for the year (date_filter=yr
) and a modified one for the values in the graph (filters=list(unit="Participation rate",age="total",acl00="^const",sex="male",isced97="^all")
. This time we can use again the SDMX REST API to get the values are it is numeric.
dt<-get_eurostat_data("tus_00educ",filters=list(unit="Participation rate",age="total",acl00="^const",sex="male",isced97="^all"),date_filter=eval(yr),label=T,ignore.case=T,exact_match=F,perl=T,stringsAsFactors=F)
dt
unit | sex | acl00 | isced97 | geo | time | values |
---|---|---|---|---|---|---|
<chr> | <chr> | <chr> | <chr> | <chr> | <chr> | <dbl> |
Participation rate (%) | Females | Construction and repairs | All ISCED 1997 levels | Austria | 2010 | 2.9 |
Participation rate (%) | Females | Construction and repairs | All ISCED 1997 levels | Belgium | 2010 | 5.0 |
Participation rate (%) | Females | Construction and repairs | All ISCED 1997 levels | Germany (until 1990 former territory of the FRG) | 2010 | 4.8 |
Participation rate (%) | Females | Construction and repairs | All ISCED 1997 levels | Estonia | 2010 | 2.7 |
Participation rate (%) | Females | Construction and repairs | All ISCED 1997 levels | Greece | 2010 | 1.9 |
Participation rate (%) | Females | Construction and repairs | All ISCED 1997 levels | Spain | 2010 | 1.4 |
Participation rate (%) | Females | Construction and repairs | All ISCED 1997 levels | Finland | 2010 | 6.5 |
Participation rate (%) | Females | Construction and repairs | All ISCED 1997 levels | France | 2010 | 4.2 |
Participation rate (%) | Females | Construction and repairs | All ISCED 1997 levels | Hungary | 2010 | 1.5 |
Participation rate (%) | Females | Construction and repairs | All ISCED 1997 levels | Italy | 2010 | 0.6 |
Participation rate (%) | Females | Construction and repairs | All ISCED 1997 levels | Luxembourg | 2010 | 2.2 |
Participation rate (%) | Females | Construction and repairs | All ISCED 1997 levels | Netherlands | 2010 | 5.2 |
Participation rate (%) | Females | Construction and repairs | All ISCED 1997 levels | Norway | 2010 | 5.8 |
Participation rate (%) | Females | Construction and repairs | All ISCED 1997 levels | Poland | 2010 | 0.7 |
Participation rate (%) | Females | Construction and repairs | All ISCED 1997 levels | Romania | 2010 | 0.9 |
Participation rate (%) | Females | Construction and repairs | All ISCED 1997 levels | Serbia | 2010 | 1.3 |
Participation rate (%) | Females | Construction and repairs | All ISCED 1997 levels | Turkey | 2010 | 0.6 |
Participation rate (%) | Females | Construction and repairs | All ISCED 1997 levels | United Kingdom | 2010 | 4.0 |
Participation rate (%) | Males | Construction and repairs | All ISCED 1997 levels | Austria | 2010 | 13.2 |
Participation rate (%) | Males | Construction and repairs | All ISCED 1997 levels | Belgium | 2010 | 13.8 |
Participation rate (%) | Males | Construction and repairs | All ISCED 1997 levels | Germany (until 1990 former territory of the FRG) | 2010 | 13.2 |
Participation rate (%) | Males | Construction and repairs | All ISCED 1997 levels | Estonia | 2010 | 14.8 |
Participation rate (%) | Males | Construction and repairs | All ISCED 1997 levels | Greece | 2010 | 12.8 |
Participation rate (%) | Males | Construction and repairs | All ISCED 1997 levels | Spain | 2010 | 6.0 |
Participation rate (%) | Males | Construction and repairs | All ISCED 1997 levels | Finland | 2010 | 20.9 |
Participation rate (%) | Males | Construction and repairs | All ISCED 1997 levels | France | 2010 | 17.0 |
Participation rate (%) | Males | Construction and repairs | All ISCED 1997 levels | Hungary | 2010 | 10.7 |
Participation rate (%) | Males | Construction and repairs | All ISCED 1997 levels | Italy | 2010 | 5.1 |
Participation rate (%) | Males | Construction and repairs | All ISCED 1997 levels | Luxembourg | 2010 | 9.4 |
Participation rate (%) | Males | Construction and repairs | All ISCED 1997 levels | Netherlands | 2010 | 14.1 |
Participation rate (%) | Males | Construction and repairs | All ISCED 1997 levels | Norway | 2010 | 20.8 |
Participation rate (%) | Males | Construction and repairs | All ISCED 1997 levels | Poland | 2010 | 8.5 |
Participation rate (%) | Males | Construction and repairs | All ISCED 1997 levels | Romania | 2010 | 12.5 |
Participation rate (%) | Males | Construction and repairs | All ISCED 1997 levels | Serbia | 2010 | 12.3 |
Participation rate (%) | Males | Construction and repairs | All ISCED 1997 levels | Turkey | 2010 | 3.3 |
Participation rate (%) | Males | Construction and repairs | All ISCED 1997 levels | United Kingdom | 2010 | 9.9 |
Then we keep only the columns with sex, activities, countries and values. Before plotting the values we need to merge the columns sex and activities and cut the brackets from the name of Germany.
dt$geo<-gsub(" \\(.*\\)","",dt$geo)
dt<-dt[,c("sex","acl00","geo","values")]
dt[,bd:=paste0(acl00,", ",tolower(sex))][,c("acl00","sex"):=NULL]
dt
geo | values | bd |
---|---|---|
<chr> | <dbl> | <chr> |
Austria | 2.9 | Construction and repairs, females |
Belgium | 5.0 | Construction and repairs, females |
Germany | 4.8 | Construction and repairs, females |
Estonia | 2.7 | Construction and repairs, females |
Greece | 1.9 | Construction and repairs, females |
Spain | 1.4 | Construction and repairs, females |
Finland | 6.5 | Construction and repairs, females |
France | 4.2 | Construction and repairs, females |
Hungary | 1.5 | Construction and repairs, females |
Italy | 0.6 | Construction and repairs, females |
Luxembourg | 2.2 | Construction and repairs, females |
Netherlands | 5.2 | Construction and repairs, females |
Norway | 5.8 | Construction and repairs, females |
Poland | 0.7 | Construction and repairs, females |
Romania | 0.9 | Construction and repairs, females |
Serbia | 1.3 | Construction and repairs, females |
Turkey | 0.6 | Construction and repairs, females |
United Kingdom | 4.0 | Construction and repairs, females |
Austria | 13.2 | Construction and repairs, males |
Belgium | 13.8 | Construction and repairs, males |
Germany | 13.2 | Construction and repairs, males |
Estonia | 14.8 | Construction and repairs, males |
Greece | 12.8 | Construction and repairs, males |
Spain | 6.0 | Construction and repairs, males |
Finland | 20.9 | Construction and repairs, males |
France | 17.0 | Construction and repairs, males |
Hungary | 10.7 | Construction and repairs, males |
Italy | 5.1 | Construction and repairs, males |
Luxembourg | 9.4 | Construction and repairs, males |
Netherlands | 14.1 | Construction and repairs, males |
Norway | 20.8 | Construction and repairs, males |
Poland | 8.5 | Construction and repairs, males |
Romania | 12.5 | Construction and repairs, males |
Serbia | 12.3 | Construction and repairs, males |
Turkey | 3.3 | Construction and repairs, males |
United Kingdom | 9.9 | Construction and repairs, males |
We make the graph again with ggplot. We have to order by increasing value of Construction and repairs, females, add the empty spaces before the EFTA and accession countries. Finally adjust scaling, remove vertical grid lines, column width and resize the plotting area to better see the figure.
dt_sep<-data.table::data.table(bd=c("Construction and repairs, males","Construction and repairs, males"),geo=c(" "," "),values=c(NA,NA))
dt<-rbind(dt,dt_sep)
geo_ord<-dt[(geo %in% eu_ctry_names)&grepl("Construction and repairs, females",bd)]
geo_ord<-geo_ord[order(values)]$geo
geo_ord<-c(geo_ord,' ','Norway',' ','Turkey','Serbia')
dt$geo<-factor(dt$geo,levels=geo_ord)
bd_ord<-sort(unique(dt$bd),decreasing=TRUE)
dt$bd<-factor(dt$bd,levels=bd_ord)
fig9_colors<-c("#FAA519","#286EB4") #"#FCC975","#71A8DF",
options(repr.plot.width=9, repr.plot.height=6,repr.plot.res=300)
ggplot(dt,aes(x=geo,y=values)) + theme_minimal() +
geom_bar(data=dt, aes(fill=bd),position="dodge",stat="identity",width=0.6)+
scale_fill_manual(values = fig9_colors)+
scale_y_continuous(limits=c(0,25),breaks=seq(0,25,5)) +
ggtitle("Figure 9: Participation rate per day in construction, by gender, % (2008 to 2015)") +
ylab("")+
xlab("")+
theme(legend.title = element_blank(),
legend.position= "bottom",
axis.text.x = element_text(angle = 90, hjust = 1),
panel.grid.major.x = element_blank(),
panel.grid.minor.y = element_blank())
Warning message: "Removed 2 rows containing missing values (geom_bar)."
The data is again in the tus_00educ dataset as in Figure 5. We apply the same filter to the data for the year (date_filter=yr
) and a modified one for the values in the graph (filters=list(unit="Participation rate",age="total",acl00="^garden",sex="male",isced97="^all")
. This time we can use again the SDMX REST API to get the values are it is numeric.
dt<-get_eurostat_data("tus_00educ",filters=list(unit="Participation rate",age="total",acl00="^garden",sex="male",isced97="^all"),date_filter=eval(yr),label=T,ignore.case=T,exact_match=F,perl=T,stringsAsFactors=F)
dt
unit | sex | acl00 | isced97 | geo | time | values |
---|---|---|---|---|---|---|
<chr> | <chr> | <chr> | <chr> | <chr> | <chr> | <dbl> |
Participation rate (%) | Females | Gardening; other pet care | All ISCED 1997 levels | Austria | 2010 | 23.7 |
Participation rate (%) | Females | Gardening; other pet care | All ISCED 1997 levels | Belgium | 2010 | 7.0 |
Participation rate (%) | Females | Gardening; other pet care | All ISCED 1997 levels | Germany (until 1990 former territory of the FRG) | 2010 | 16.2 |
Participation rate (%) | Females | Gardening; other pet care | All ISCED 1997 levels | Estonia | 2010 | 10.9 |
Participation rate (%) | Females | Gardening; other pet care | All ISCED 1997 levels | Greece | 2010 | 9.2 |
Participation rate (%) | Females | Gardening; other pet care | All ISCED 1997 levels | Spain | 2010 | 3.2 |
Participation rate (%) | Females | Gardening; other pet care | All ISCED 1997 levels | Finland | 2010 | 10.4 |
Participation rate (%) | Females | Gardening; other pet care | All ISCED 1997 levels | France | 2010 | 8.8 |
Participation rate (%) | Females | Gardening; other pet care | All ISCED 1997 levels | Hungary | 2010 | 11.6 |
Participation rate (%) | Females | Gardening; other pet care | All ISCED 1997 levels | Italy | 2010 | 5.2 |
Participation rate (%) | Females | Gardening; other pet care | All ISCED 1997 levels | Luxembourg | 2010 | 6.8 |
Participation rate (%) | Females | Gardening; other pet care | All ISCED 1997 levels | Netherlands | 2010 | 8.8 |
Participation rate (%) | Females | Gardening; other pet care | All ISCED 1997 levels | Norway | 2010 | 14.9 |
Participation rate (%) | Females | Gardening; other pet care | All ISCED 1997 levels | Poland | 2010 | 10.3 |
Participation rate (%) | Females | Gardening; other pet care | All ISCED 1997 levels | Romania | 2010 | 8.2 |
Participation rate (%) | Females | Gardening; other pet care | All ISCED 1997 levels | Serbia | 2010 | 10.7 |
Participation rate (%) | Females | Gardening; other pet care | All ISCED 1997 levels | Turkey | 2010 | 5.3 |
Participation rate (%) | Females | Gardening; other pet care | All ISCED 1997 levels | United Kingdom | 2010 | 8.8 |
Participation rate (%) | Males | Gardening; other pet care | All ISCED 1997 levels | Austria | 2010 | 14.1 |
Participation rate (%) | Males | Gardening; other pet care | All ISCED 1997 levels | Belgium | 2010 | 13.6 |
Participation rate (%) | Males | Gardening; other pet care | All ISCED 1997 levels | Germany (until 1990 former territory of the FRG) | 2010 | 13.5 |
Participation rate (%) | Males | Gardening; other pet care | All ISCED 1997 levels | Estonia | 2010 | 7.0 |
Participation rate (%) | Males | Gardening; other pet care | All ISCED 1997 levels | Greece | 2010 | 13.8 |
Participation rate (%) | Males | Gardening; other pet care | All ISCED 1997 levels | Spain | 2010 | 6.5 |
Participation rate (%) | Males | Gardening; other pet care | All ISCED 1997 levels | Finland | 2010 | 7.0 |
Participation rate (%) | Males | Gardening; other pet care | All ISCED 1997 levels | France | 2010 | 12.4 |
Participation rate (%) | Males | Gardening; other pet care | All ISCED 1997 levels | Hungary | 2010 | 15.7 |
Participation rate (%) | Males | Gardening; other pet care | All ISCED 1997 levels | Italy | 2010 | 10.3 |
Participation rate (%) | Males | Gardening; other pet care | All ISCED 1997 levels | Luxembourg | 2010 | 8.4 |
Participation rate (%) | Males | Gardening; other pet care | All ISCED 1997 levels | Netherlands | 2010 | 10.0 |
Participation rate (%) | Males | Gardening; other pet care | All ISCED 1997 levels | Norway | 2010 | 12.1 |
Participation rate (%) | Males | Gardening; other pet care | All ISCED 1997 levels | Poland | 2010 | 9.3 |
Participation rate (%) | Males | Gardening; other pet care | All ISCED 1997 levels | Romania | 2010 | 9.9 |
Participation rate (%) | Males | Gardening; other pet care | All ISCED 1997 levels | Serbia | 2010 | 10.8 |
Participation rate (%) | Males | Gardening; other pet care | All ISCED 1997 levels | Turkey | 2010 | 4.4 |
Participation rate (%) | Males | Gardening; other pet care | All ISCED 1997 levels | United Kingdom | 2010 | 9.2 |
Then we keep only the columns with sex, activities, countries and values. Before plotting the values we need to merge the columns sex and activities and cut the brackets from the name of Germany.
dt$geo<-gsub(" \\(.*\\)","",dt$geo)
dt<-dt[,c("sex","acl00","geo","values")]
dt[,bd:=paste0(acl00,", ",tolower(sex))][,c("acl00","sex"):=NULL]
dt
geo | values | bd |
---|---|---|
<chr> | <dbl> | <chr> |
Austria | 23.7 | Gardening; other pet care, females |
Belgium | 7.0 | Gardening; other pet care, females |
Germany | 16.2 | Gardening; other pet care, females |
Estonia | 10.9 | Gardening; other pet care, females |
Greece | 9.2 | Gardening; other pet care, females |
Spain | 3.2 | Gardening; other pet care, females |
Finland | 10.4 | Gardening; other pet care, females |
France | 8.8 | Gardening; other pet care, females |
Hungary | 11.6 | Gardening; other pet care, females |
Italy | 5.2 | Gardening; other pet care, females |
Luxembourg | 6.8 | Gardening; other pet care, females |
Netherlands | 8.8 | Gardening; other pet care, females |
Norway | 14.9 | Gardening; other pet care, females |
Poland | 10.3 | Gardening; other pet care, females |
Romania | 8.2 | Gardening; other pet care, females |
Serbia | 10.7 | Gardening; other pet care, females |
Turkey | 5.3 | Gardening; other pet care, females |
United Kingdom | 8.8 | Gardening; other pet care, females |
Austria | 14.1 | Gardening; other pet care, males |
Belgium | 13.6 | Gardening; other pet care, males |
Germany | 13.5 | Gardening; other pet care, males |
Estonia | 7.0 | Gardening; other pet care, males |
Greece | 13.8 | Gardening; other pet care, males |
Spain | 6.5 | Gardening; other pet care, males |
Finland | 7.0 | Gardening; other pet care, males |
France | 12.4 | Gardening; other pet care, males |
Hungary | 15.7 | Gardening; other pet care, males |
Italy | 10.3 | Gardening; other pet care, males |
Luxembourg | 8.4 | Gardening; other pet care, males |
Netherlands | 10.0 | Gardening; other pet care, males |
Norway | 12.1 | Gardening; other pet care, males |
Poland | 9.3 | Gardening; other pet care, males |
Romania | 9.9 | Gardening; other pet care, males |
Serbia | 10.8 | Gardening; other pet care, males |
Turkey | 4.4 | Gardening; other pet care, males |
United Kingdom | 9.2 | Gardening; other pet care, males |
We make the graph again with ggplot. We have to order by increasing value of Gardening; other pet care, females, add the empty spaces before the EFTA and accession countries. Finally adjust scaling, remove vertical grid lines, column width and resize the plotting area to better see the figure.
dt_sep<-data.table::data.table(bd=c("Gardening; other pet care, males","Gardening; other pet care, males"),geo=c(" "," "),values=c(NA,NA))
dt<-rbind(dt,dt_sep)
geo_ord<-dt[(geo %in% eu_ctry_names)&grepl("Gardening; other pet care, females",bd)]
geo_ord<-geo_ord[order(values)]$geo
geo_ord<-c(geo_ord,' ','Norway',' ','Turkey','Serbia')
dt$geo<-factor(dt$geo,levels=geo_ord)
bd_ord<-sort(unique(dt$bd),decreasing=TRUE)
dt$bd<-factor(dt$bd,levels=bd_ord)
fig10_colors<-c("#FAA519","#286EB4") #"#FCC975","#71A8DF",
options(repr.plot.width=9, repr.plot.height=6,repr.plot.res=300)
ggplot(dt,aes(x=geo,y=values)) + theme_minimal() +
geom_bar(data=dt, aes(fill=bd),position="dodge",stat="identity",width=0.6)+
scale_fill_manual(values = fig10_colors)+
scale_y_continuous(limits=c(0,25),breaks=seq(0,25,5)) +
ggtitle("Figure 10: Participation rate per day in gardening and pet care, by gender, % (2008 to 2015)") +
ylab("")+
xlab("")+
theme(legend.title = element_blank(),
legend.position= "bottom",
axis.text.x = element_text(angle = 90, hjust = 1),
panel.grid.major.x = element_blank(),
panel.grid.minor.y = element_blank())
Warning message: "Removed 2 rows containing missing values (geom_bar)."
The data is in a different dataset then in the previous figures, this the data is in the tus_00educ2. We apply the same filter to the data for the year (date_filter=yr
) and a modified one for the values in the graph (filters=list(unit="Participation time",age="total",acl00="^tv|^radio",sex="total",isced97="^all")
. This time again we have to apply the filter locally (force_local_filter=T
) on the dataset retrieved from the bulk download facility, because we need the time values.
dt<-get_eurostat_data("tus_00educ2",filters=list(unit="Participation time",age="total",acl00="^tv|^radio",sex="total",isced97="^all"),date_filter=eval(yr),label=T,ignore.case=T,exact_match=F,perl=T,stringsAsFactors=F,force_local_filter=T)
dt
Forcing to apply filter locally. The whole dataset is downloaded through the raw download and the filters are applied locally.
unit | sex | isced97 | acl00 | geo | time | values |
---|---|---|---|---|---|---|
<chr> | <chr> | <chr> | <chr> | <chr> | <chr> | <chr> |
Participation time (hh:mm) | Total | All ISCED 1997 levels | TV and video | Austria | 2010 | 1:01 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | TV and video | Belgium | 2010 | 1:18 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | TV and video | Germany (until 1990 former territory of the FRG) | 2010 | 1:11 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | TV and video | Estonia | 2010 | 1:27 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | TV and video | Greece | 2010 | 1:28 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | TV and video | Spain | 2010 | 1:17 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | TV and video | Finland | 2010 | 0:58 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | TV and video | France | 2010 | 1:50 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | TV and video | Hungary | 2010 | 1:46 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | TV and video | Italy | 2010 | 1:39 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | TV and video | Luxembourg | 2010 | 1:06 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | TV and video | Netherlands | 2010 | 0:54 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | TV and video | Norway | 2010 | 0:57 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | TV and video | Poland | 2010 | 0:55 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | TV and video | Romania | 2010 | 1:12 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | TV and video | Serbia | 2010 | 1:03 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | TV and video | Turkey | 2010 | 0:00 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | TV and video | United Kingdom | 2010 | 1:10 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Radio and music | Austria | 2010 | 1:37 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Radio and music | Belgium | 2010 | 2:00 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Radio and music | Germany (until 1990 former territory of the FRG) | 2010 | 2:00 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Radio and music | Estonia | 2010 | 1:54 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Radio and music | Greece | 2010 | 1:24 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Radio and music | Spain | 2010 | 1:37 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Radio and music | Finland | 2010 | 1:48 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Radio and music | France | 2010 | 2:10 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Radio and music | Hungary | 2010 | 2:05 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Radio and music | Italy | 2010 | 1:34 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Radio and music | Luxembourg | 2010 | 1:31 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Radio and music | Netherlands | 2010 | 1:46 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Radio and music | Norway | 2010 | 1:35 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Radio and music | Poland | 2010 | 1:25 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Radio and music | Romania | 2010 | 2:29 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Radio and music | Serbia | 2010 | 1:28 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Radio and music | Turkey | 2010 | 0:00 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Radio and music | United Kingdom | 2010 | 1:44 |
Then again we convert the values from characters/factors to time values using the chron package and keep only the columns with activities, countries and values. We drop the values for Turkey as it is 0. Before plotting the values we need to cut the brackets from the name of Germany.
dt$geo<-gsub(" \\(.*\\)","",dt$geo)
if (is.factor(dt$values)|is.character(dt$values)) dt<-dt[,values:=chron::times(paste0(values,":00"))][geo!="Turkey"]
dt<-dt[,c("acl00","geo","values")]
dt
acl00 | geo | values |
---|---|---|
<chr> | <chr> | <times> |
TV and video | Austria | 01:01:00 |
TV and video | Belgium | 01:18:00 |
TV and video | Germany | 01:11:00 |
TV and video | Estonia | 01:27:00 |
TV and video | Greece | 01:28:00 |
TV and video | Spain | 01:17:00 |
TV and video | Finland | 00:58:00 |
TV and video | France | 01:50:00 |
TV and video | Hungary | 01:46:00 |
TV and video | Italy | 01:39:00 |
TV and video | Luxembourg | 01:06:00 |
TV and video | Netherlands | 00:54:00 |
TV and video | Norway | 00:57:00 |
TV and video | Poland | 00:55:00 |
TV and video | Romania | 01:12:00 |
TV and video | Serbia | 01:03:00 |
TV and video | United Kingdom | 01:10:00 |
Radio and music | Austria | 01:37:00 |
Radio and music | Belgium | 02:00:00 |
Radio and music | Germany | 02:00:00 |
Radio and music | Estonia | 01:54:00 |
Radio and music | Greece | 01:24:00 |
Radio and music | Spain | 01:37:00 |
Radio and music | Finland | 01:48:00 |
Radio and music | France | 02:10:00 |
Radio and music | Hungary | 02:05:00 |
Radio and music | Italy | 01:34:00 |
Radio and music | Luxembourg | 01:31:00 |
Radio and music | Netherlands | 01:46:00 |
Radio and music | Norway | 01:35:00 |
Radio and music | Poland | 01:25:00 |
Radio and music | Romania | 02:29:00 |
Radio and music | Serbia | 01:28:00 |
Radio and music | United Kingdom | 01:44:00 |
We make the graph again with ggplot. We have to order by increasing value of Radio and music, add the empty spaces before the EFTA and accession countries. Finally adjust scaling, remove vertical grid lines, column width and resize the plotting area to better see the figure.
dt_sep<-data.table::data.table(acl00=c("Radio and music","Radio and music"),geo=c(" "," "),values=c(chron::times(NA),chron::times(NA)))
dt<-rbind(dt,dt_sep)
geo_ord<-dt[(geo %in% eu_ctry_names)&grepl("Radio and music",acl00)]
geo_ord<-geo_ord[order(values)]$geo
geo_ord<-c(geo_ord,' ','Norway',' ','Serbia')
dt$geo<-factor(dt$geo,levels=geo_ord)
acl_ord<-sort(unique(dt$acl00),decreasing=TRUE)
dt$acl00<-factor(dt$acl00,levels=acl_ord)
fig11_colors<-c("#FAA519","#286EB4") #"#FCC975","#71A8DF",
options(repr.plot.width=9, repr.plot.height=6,repr.plot.res=300)
ggplot(dt, aes(x=geo, y=values,fill=acl00)) + theme_minimal() +
geom_bar(position="dodge",stat="identity",width=0.7)+
scale_y_chron(format="%H:%M",breaks=seq(0,1,1/96)) +
scale_fill_manual(values = fig11_colors)+
ggtitle("Figure 11a: Participation time per day in the most common secondary activities watching TV and listening to radio, (hh mm; 2008 to 2015)") +
ylab("")+
xlab("")+
theme(legend.title = element_blank(),
legend.position= "bottom",
axis.text.x = element_text(angle = 90, hjust = 1),
panel.grid.major.x = element_blank(),
panel.grid.minor.y = element_blank())
Warning message: "Removed 2 rows containing missing values (geom_bar)."
The data is in a different dataset then in the previous figures, this the data is in the tus_00educ2. We apply the same filter to the data for the year (date_filter=yr
) and a modified one for the values in the graph (filters=list(unit="Participation time",age="total",acl00="^social|^visit",sex="total",isced97="^all")
. This time again we have to apply the filter locally (force_local_filter=T
) on the dataset retrieved from the bulk download facility, because we need the time values.
dt<-get_eurostat_data("tus_00educ2",filters=list(unit="Participation time",age="total",acl00="^social|^visit",sex="total",isced97="^all"),date_filter=eval(yr),label=T,ignore.case=T,exact_match=F,perl=T,stringsAsFactors=F,force_local_filter=T)
dt
Forcing to apply filter locally. The whole dataset is downloaded through the raw download and the filters are applied locally.
unit | sex | isced97 | acl00 | geo | time | values |
---|---|---|---|---|---|---|
<chr> | <chr> | <chr> | <chr> | <chr> | <chr> | <chr> |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Socialising with family | Austria | 2010 | 1:18 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Socialising with family | Belgium | 2010 | 1:40 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Socialising with family | Germany (until 1990 former territory of the FRG) | 2010 | 0:00 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Socialising with family | Estonia | 2010 | 1:55 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Socialising with family | Greece | 2010 | 1:36 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Socialising with family | Spain | 2010 | 1:34 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Socialising with family | Finland | 2010 | 1:18 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Socialising with family | France | 2010 | 1:37 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Socialising with family | Hungary | 2010 | 0:30 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Socialising with family | Italy | 2010 | 1:29 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Socialising with family | Luxembourg | 2010 | 1:34 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Socialising with family | Netherlands | 2010 | 1:18 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Socialising with family | Norway | 2010 | 1:42 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Socialising with family | Poland | 2010 | 1:35 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Socialising with family | Romania | 2010 | 1:59 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Socialising with family | Serbia | 2010 | 1:35 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Socialising with family | Turkey | 2010 | 0:00 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Socialising with family | United Kingdom | 2010 | 1:08 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Visiting and feasts | Austria | 2010 | 0:51 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Visiting and feasts | Belgium | 2010 | 1:08 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Visiting and feasts | Germany (until 1990 former territory of the FRG) | 2010 | 1:47 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Visiting and feasts | Estonia | 2010 | 1:49 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Visiting and feasts | Greece | 2010 | 2:12 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Visiting and feasts | Spain | 2010 | 2:47 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Visiting and feasts | Finland | 2010 | 1:34 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Visiting and feasts | France | 2010 | 1:56 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Visiting and feasts | Hungary | 2010 | 0:50 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Visiting and feasts | Italy | 2010 | 1:07 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Visiting and feasts | Luxembourg | 2010 | 2:01 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Visiting and feasts | Netherlands | 2010 | 1:39 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Visiting and feasts | Norway | 2010 | 0:56 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Visiting and feasts | Poland | 2010 | 1:30 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Visiting and feasts | Romania | 2010 | 1:01 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Visiting and feasts | Serbia | 2010 | 1:56 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Visiting and feasts | Turkey | 2010 | 0:00 |
Participation time (hh:mm) | Total | All ISCED 1997 levels | Visiting and feasts | United Kingdom | 2010 | 1:33 |
Then again we convert the values from characters/factors to time values using the chron package and keep only the columns with activities, countries and values. We drop the values for Turkey as it is 0. Before plotting the values we need to cut the brackets from the name of Germany.
dt$geo<-gsub(" \\(.*\\)","",dt$geo)
if (is.factor(dt$values)|is.character(dt$values)) dt<-dt[,values:=chron::times(paste0(values,":00"))][geo!="Turkey"]
dt<-dt[,c("acl00","geo","values")]
dt
acl00 | geo | values |
---|---|---|
<chr> | <chr> | <times> |
Socialising with family | Austria | 01:18:00 |
Socialising with family | Belgium | 01:40:00 |
Socialising with family | Germany | 00:00:00 |
Socialising with family | Estonia | 01:55:00 |
Socialising with family | Greece | 01:36:00 |
Socialising with family | Spain | 01:34:00 |
Socialising with family | Finland | 01:18:00 |
Socialising with family | France | 01:37:00 |
Socialising with family | Hungary | 00:30:00 |
Socialising with family | Italy | 01:29:00 |
Socialising with family | Luxembourg | 01:34:00 |
Socialising with family | Netherlands | 01:18:00 |
Socialising with family | Norway | 01:42:00 |
Socialising with family | Poland | 01:35:00 |
Socialising with family | Romania | 01:59:00 |
Socialising with family | Serbia | 01:35:00 |
Socialising with family | United Kingdom | 01:08:00 |
Visiting and feasts | Austria | 00:51:00 |
Visiting and feasts | Belgium | 01:08:00 |
Visiting and feasts | Germany | 01:47:00 |
Visiting and feasts | Estonia | 01:49:00 |
Visiting and feasts | Greece | 02:12:00 |
Visiting and feasts | Spain | 02:47:00 |
Visiting and feasts | Finland | 01:34:00 |
Visiting and feasts | France | 01:56:00 |
Visiting and feasts | Hungary | 00:50:00 |
Visiting and feasts | Italy | 01:07:00 |
Visiting and feasts | Luxembourg | 02:01:00 |
Visiting and feasts | Netherlands | 01:39:00 |
Visiting and feasts | Norway | 00:56:00 |
Visiting and feasts | Poland | 01:30:00 |
Visiting and feasts | Romania | 01:01:00 |
Visiting and feasts | Serbia | 01:56:00 |
Visiting and feasts | United Kingdom | 01:33:00 |
We make the graph again with ggplot. We have to order by increasing value of Visiting and feasts, add the empty spaces before the EFTA and accession countries. Finally adjust scaling, remove vertical grid lines, column width and resize the plotting area to better see the figure.
dt_sep<-data.table::data.table(acl00=c("Visiting and feasts","Visiting and feasts"),geo=c(" "," "),values=c(chron::times(NA),chron::times(NA)))
dt<-rbind(dt,dt_sep)
geo_ord<-dt[(geo %in% eu_ctry_names)&grepl("Visiting and feasts",acl00)]
geo_ord<-geo_ord[order(values)]$geo
geo_ord<-c(geo_ord,' ','Norway',' ','Serbia')
dt$geo<-factor(dt$geo,levels=geo_ord)
fig11_colors<-c("#FAA519","#286EB4") #"#FCC975","#71A8DF",
options(repr.plot.width=9, repr.plot.height=6,repr.plot.res=300)
ggplot(dt, aes(x=geo, y=values,fill=acl00)) + theme_minimal() +
geom_bar(position="dodge",stat="identity",width=0.7)+
scale_y_chron(format="%H:%M",breaks=seq(0,1,1/96)) +
scale_fill_manual(values = fig11_colors)+
ggtitle("Figure 11b: Participation time per day in the most common secondary activities socialising with family visiting and feasts (hh mm; 2008 to 2015)") +
ylab("")+
xlab("")+
theme(legend.title = element_blank(),
legend.position= "bottom",
axis.text.x = element_text(angle = 90, hjust = 1),
panel.grid.major.x = element_blank(),
panel.grid.minor.y = element_blank())
Warning message: "Removed 2 rows containing missing values (geom_bar)."
The data is in a different dataset then in the previous figures, this the data is in the tus_00educ2. We apply the same filter to the data for the year (date_filter=yr
) and a modified one for the values in the graph (filters=list(unit="Participation time",age="total",acl00="^child",sex="male",isced97="^all")
. This time again we have to apply the filter locally (force_local_filter=T
) on the dataset retrieved from the bulk download facility, because we need the time values.
dt<-get_eurostat_data("tus_00educ2",filters=list(unit="Participation time",age="total",acl00="^child",sex="male",isced97="^all"),date_filter=eval(yr),label=T,ignore.case=T,exact_match=F,perl=T,stringsAsFactors=F,force_local_filter=T)
dt
Forcing to apply filter locally. The whole dataset is downloaded through the raw download and the filters are applied locally.
unit | sex | isced97 | acl00 | geo | time | values |
---|---|---|---|---|---|---|
<chr> | <chr> | <chr> | <chr> | <chr> | <chr> | <chr> |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Austria | 2010 | 1:09 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Belgium | 2010 | 1:07 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Germany (until 1990 former territory of the FRG) | 2010 | 1:59 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Estonia | 2010 | 1:39 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Greece | 2010 | 1:10 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Spain | 2010 | 1:15 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Finland | 2010 | 1:27 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | France | 2010 | 1:09 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Hungary | 2010 | 1:26 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Italy | 2010 | 1:10 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Luxembourg | 2010 | 0:49 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Netherlands | 2010 | 0:54 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Norway | 2010 | 1:04 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Poland | 2010 | 1:18 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Romania | 2010 | 1:44 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Serbia | 2010 | 1:10 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Turkey | 2010 | 0:00 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | United Kingdom | 2010 | 1:11 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Austria | 2010 | 0:53 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Belgium | 2010 | 1:02 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Germany (until 1990 former territory of the FRG) | 2010 | 1:22 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Estonia | 2010 | 1:07 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Greece | 2010 | 0:59 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Spain | 2010 | 1:07 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Finland | 2010 | 0:51 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | France | 2010 | 1:02 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Hungary | 2010 | 0:51 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Italy | 2010 | 0:47 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Luxembourg | 2010 | 0:45 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Netherlands | 2010 | 0:43 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Norway | 2010 | 0:52 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Poland | 2010 | 0:56 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Romania | 2010 | 1:11 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Serbia | 2010 | 1:11 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | Turkey | 2010 | 0:00 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Childcare, including teaching, reading and talking with child | United Kingdom | 2010 | 1:01 |
Then again we convert the values from characters/factors to time values using the chron package and keep only the columns with activities, countries and values. We drop the values for Turkey as it is 0. Before plotting the values we need to cut the brackets from the name of Germany.
dt$geo<-gsub(" \\(.*\\)","",dt$geo)
if (is.factor(dt$values)|is.character(dt$values)) dt<-dt[,values:=chron::times(paste0(values,":00"))][geo!="Turkey"]
dt<-dt[,c("sex","geo","values")]
dt
sex | geo | values |
---|---|---|
<chr> | <chr> | <times> |
Females | Austria | 01:09:00 |
Females | Belgium | 01:07:00 |
Females | Germany | 01:59:00 |
Females | Estonia | 01:39:00 |
Females | Greece | 01:10:00 |
Females | Spain | 01:15:00 |
Females | Finland | 01:27:00 |
Females | France | 01:09:00 |
Females | Hungary | 01:26:00 |
Females | Italy | 01:10:00 |
Females | Luxembourg | 00:49:00 |
Females | Netherlands | 00:54:00 |
Females | Norway | 01:04:00 |
Females | Poland | 01:18:00 |
Females | Romania | 01:44:00 |
Females | Serbia | 01:10:00 |
Females | United Kingdom | 01:11:00 |
Males | Austria | 00:53:00 |
Males | Belgium | 01:02:00 |
Males | Germany | 01:22:00 |
Males | Estonia | 01:07:00 |
Males | Greece | 00:59:00 |
Males | Spain | 01:07:00 |
Males | Finland | 00:51:00 |
Males | France | 01:02:00 |
Males | Hungary | 00:51:00 |
Males | Italy | 00:47:00 |
Males | Luxembourg | 00:45:00 |
Males | Netherlands | 00:43:00 |
Males | Norway | 00:52:00 |
Males | Poland | 00:56:00 |
Males | Romania | 01:11:00 |
Males | Serbia | 01:11:00 |
Males | United Kingdom | 01:01:00 |
We make the graph again with ggplot. We have to order by increasing value of Females, add the empty spaces before the EFTA and accession countries. Finally adjust scaling, remove vertical grid lines, column width and resize the plotting area to better see the figure.
dt_sep<-data.table::data.table(sex=c("Males","Males"),geo=c(" "," "),values=c(chron::times(NA),chron::times(NA)))
dt<-rbind(dt,dt_sep)
geo_ord<-dt[(geo %in% eu_ctry_names)&grepl("Females",sex)]
geo_ord<-geo_ord[order(values)]$geo
geo_ord<-c(geo_ord,' ','Norway',' ','Serbia')
dt$geo<-factor(dt$geo,levels=geo_ord)
sex_ord<-sort(unique(dt$sex),decreasing=TRUE)
dt$sex<-factor(dt$sex,levels=sex_ord)
fig11_colors<-c("#FAA519","#286EB4") #"#FCC975","#71A8DF",
options(repr.plot.width=9, repr.plot.height=6,repr.plot.res=300)
ggplot(dt, aes(x=geo, y=values,fill=sex)) + theme_minimal() +
geom_bar(position="dodge",stat="identity",width=0.7)+
scale_y_chron(format="%H:%M",breaks=seq(0,1,1/96)) +
scale_fill_manual(values = fig11_colors)+
ggtitle("Figure 11c: Participation time per day in childcare as secondary activity, by gender, (hh mm; 2008 to 2015)") +
ylab("")+
xlab("")+
theme(legend.title = element_blank(),
legend.position= "bottom",
axis.text.x = element_text(angle = 90, hjust = 1),
panel.grid.major.x = element_blank(),
panel.grid.minor.y = element_blank())
Warning message: "Removed 2 rows containing missing values (geom_bar)."
The data is in a different dataset then in the previous figures, this the data is in the tus_00educ2. We apply the same filter to the data for the year (date_filter=yr
) and a modified one for the values in the graph (filters=list(unit="Participation time",age="total",acl00="^house",sex="male",isced97="^all")
. This time again we have to apply the filter locally (force_local_filter=T
) on the dataset retrieved from the bulk download facility, because we need the time values.
dt<-get_eurostat_data("tus_00educ2",filters=list(unit="Participation time",age="total",acl00="^house",sex="male",isced97="^all"),date_filter=eval(yr),label=T,ignore.case=T,exact_match=F,perl=T,stringsAsFactors=F,force_local_filter=T)
dt
Forcing to apply filter locally. The whole dataset is downloaded through the raw download and the filters are applied locally.
unit | sex | isced97 | acl00 | geo | time | values |
---|---|---|---|---|---|---|
<chr> | <chr> | <chr> | <chr> | <chr> | <chr> | <chr> |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Household and family care, except childcare | Austria | 2010 | 0:47 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Household and family care, except childcare | Belgium | 2010 | 0:55 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Household and family care, except childcare | Germany (until 1990 former territory of the FRG) | 2010 | 0:53 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Household and family care, except childcare | Estonia | 2010 | 1:06 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Household and family care, except childcare | Greece | 2010 | 0:51 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Household and family care, except childcare | Spain | 2010 | 0:48 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Household and family care, except childcare | Finland | 2010 | 0:44 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Household and family care, except childcare | France | 2010 | 1:17 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Household and family care, except childcare | Hungary | 2010 | 1:06 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Household and family care, except childcare | Italy | 2010 | 0:39 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Household and family care, except childcare | Luxembourg | 2010 | 0:48 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Household and family care, except childcare | Netherlands | 2010 | 0:39 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Household and family care, except childcare | Norway | 2010 | 0:49 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Household and family care, except childcare | Poland | 2010 | 0:37 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Household and family care, except childcare | Romania | 2010 | 0:46 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Household and family care, except childcare | Serbia | 2010 | 0:47 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Household and family care, except childcare | Turkey | 2010 | 0:00 |
Participation time (hh:mm) | Females | All ISCED 1997 levels | Household and family care, except childcare | United Kingdom | 2010 | 0:50 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Household and family care, except childcare | Austria | 2010 | 0:33 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Household and family care, except childcare | Belgium | 2010 | 0:47 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Household and family care, except childcare | Germany (until 1990 former territory of the FRG) | 2010 | 0:37 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Household and family care, except childcare | Estonia | 2010 | 0:46 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Household and family care, except childcare | Greece | 2010 | 0:34 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Household and family care, except childcare | Spain | 2010 | 0:47 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Household and family care, except childcare | Finland | 2010 | 0:23 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Household and family care, except childcare | France | 2010 | 1:08 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Household and family care, except childcare | Hungary | 2010 | 0:45 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Household and family care, except childcare | Italy | 2010 | 0:27 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Household and family care, except childcare | Luxembourg | 2010 | 0:45 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Household and family care, except childcare | Netherlands | 2010 | 0:32 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Household and family care, except childcare | Norway | 2010 | 0:26 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Household and family care, except childcare | Poland | 2010 | 0:33 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Household and family care, except childcare | Romania | 2010 | 0:44 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Household and family care, except childcare | Serbia | 2010 | 0:37 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Household and family care, except childcare | Turkey | 2010 | 0:00 |
Participation time (hh:mm) | Males | All ISCED 1997 levels | Household and family care, except childcare | United Kingdom | 2010 | 0:35 |
Then again we convert the values from characters/factors to time values using the chron package and keep only the columns with activities, countries and values. We drop the values for Turkey as it is 0. Before plotting the values we need to cut the brackets from the name of Germany.
dt$geo<-gsub(" \\(.*\\)","",dt$geo)
if (is.factor(dt$values)|is.character(dt$values)) dt<-dt[,values:=chron::times(paste0(values,":00"))][geo!="Turkey"]
dt<-dt[,c("sex","geo","values")]
dt
sex | geo | values |
---|---|---|
<chr> | <chr> | <times> |
Females | Austria | 00:47:00 |
Females | Belgium | 00:55:00 |
Females | Germany | 00:53:00 |
Females | Estonia | 01:06:00 |
Females | Greece | 00:51:00 |
Females | Spain | 00:48:00 |
Females | Finland | 00:44:00 |
Females | France | 01:17:00 |
Females | Hungary | 01:06:00 |
Females | Italy | 00:39:00 |
Females | Luxembourg | 00:48:00 |
Females | Netherlands | 00:39:00 |
Females | Norway | 00:49:00 |
Females | Poland | 00:37:00 |
Females | Romania | 00:46:00 |
Females | Serbia | 00:47:00 |
Females | United Kingdom | 00:50:00 |
Males | Austria | 00:33:00 |
Males | Belgium | 00:47:00 |
Males | Germany | 00:37:00 |
Males | Estonia | 00:46:00 |
Males | Greece | 00:34:00 |
Males | Spain | 00:47:00 |
Males | Finland | 00:23:00 |
Males | France | 01:08:00 |
Males | Hungary | 00:45:00 |
Males | Italy | 00:27:00 |
Males | Luxembourg | 00:45:00 |
Males | Netherlands | 00:32:00 |
Males | Norway | 00:26:00 |
Males | Poland | 00:33:00 |
Males | Romania | 00:44:00 |
Males | Serbia | 00:37:00 |
Males | United Kingdom | 00:35:00 |
We make the graph again with ggplot. We have to order by increasing value of Females, add the empty spaces before the EFTA and accession countries. Finally adjust scaling, remove vertical grid lines, column width and resize the plotting area to better see the figure.
dt_sep<-data.table::data.table(sex=c("Males","Males"),geo=c(" "," "),values=c(chron::times(NA),chron::times(NA)))
dt<-rbind(dt,dt_sep)
geo_ord<-dt[(geo %in% eu_ctry_names)&grepl("Females",sex)]
geo_ord<-geo_ord[order(values)]$geo
geo_ord<-c(geo_ord,' ','Norway',' ','Serbia')
dt$geo<-factor(dt$geo,levels=geo_ord)
sex_ord<-sort(unique(dt$sex),decreasing=TRUE)
dt$sex<-factor(dt$sex,levels=sex_ord)
fig11_colors<-c("#FAA519","#286EB4") #"#FCC975","#71A8DF",
options(repr.plot.width=9, repr.plot.height=6,repr.plot.res=300)
ggplot(dt, aes(x=geo, y=values,fill=sex)) + theme_minimal() +
geom_bar(position="dodge",stat="identity",width=0.7)+
scale_y_chron(format="%H:%M",breaks=seq(0,1,1/96)) +
scale_fill_manual(values = fig11_colors)+
ggtitle("Figure 11d: Participation time per day in household and family care as secondary activity, by gender, (hh mm; 2008 to 2015)") +
ylab("")+
xlab("")+
theme(legend.title = element_blank(),
legend.position= "bottom",
axis.text.x = element_text(angle = 90, hjust = 1),
panel.grid.major.x = element_blank(),
panel.grid.minor.y = element_blank())
Warning message: "Removed 2 rows containing missing values (geom_bar)."
The data is this time in the tus_00npaywork dataset. We use the same method as for Figure 3. We apply the same filter to the data for the year (date_filter=yr
) and a modified one for the values in the graph (filters=list(unit="Participation time",age="total",acl00="main",sex="male")
. Again in order to get the data we have to apply the filter locally (force_local_filter=T
) on the dataset retrieved from the bulk download facility.
dt<-get_eurostat_data("tus_00npaywork",filters=list(unit="Participation time",age="total",acl00="main",sex="male"),date_filter=eval(yr),label=T,ignore.case=T,exact_match=F,perl=T,stringsAsFactors=F,force_local_filter=T)
dt
Forcing to apply filter locally. The whole dataset is downloaded through the raw download and the filters are applied locally.
unit | sex | acl00 | geo | time | values |
---|---|---|---|---|---|
<chr> | <chr> | <chr> | <chr> | <chr> | <chr> |
Participation time (hh:mm) | Females | Productive unpaid main activities | Austria | 2010 | 4:39 |
Participation time (hh:mm) | Females | Productive unpaid main activities | Belgium | 2010 | 4:08 |
Participation time (hh:mm) | Females | Productive unpaid main activities | Germany (until 1990 former territory of the FRG) | 2010 | 4:00 |
Participation time (hh:mm) | Females | Productive unpaid main activities | Estonia | 2010 | 4:14 |
Participation time (hh:mm) | Females | Productive unpaid main activities | Greece | 2010 | 4:43 |
Participation time (hh:mm) | Females | Productive unpaid main activities | Spain | 2010 | 4:57 |
Participation time (hh:mm) | Females | Productive unpaid main activities | Finland | 2010 | 3:55 |
Participation time (hh:mm) | Females | Productive unpaid main activities | France | 2010 | 4:13 |
Participation time (hh:mm) | Females | Productive unpaid main activities | Hungary | 2010 | 4:57 |
Participation time (hh:mm) | Females | Productive unpaid main activities | Italy | 2010 | 5:30 |
Participation time (hh:mm) | Females | Productive unpaid main activities | Luxembourg | 2010 | 4:00 |
Participation time (hh:mm) | Females | Productive unpaid main activities | Netherlands | 2010 | 3:43 |
Participation time (hh:mm) | Females | Productive unpaid main activities | Norway | 2010 | 3:46 |
Participation time (hh:mm) | Females | Productive unpaid main activities | Poland | 2010 | 4:50 |
Participation time (hh:mm) | Females | Productive unpaid main activities | Romania | 2010 | 5:14 |
Participation time (hh:mm) | Females | Productive unpaid main activities | Serbia | 2010 | 5:08 |
Participation time (hh:mm) | Females | Productive unpaid main activities | Turkey | 2010 | 5:22 |
Participation time (hh:mm) | Females | Productive unpaid main activities | United Kingdom | 2010 | 4:01 |
Participation time (hh:mm) | Males | Productive unpaid main activities | Austria | 2010 | 2:54 |
Participation time (hh:mm) | Males | Productive unpaid main activities | Belgium | 2010 | 2:50 |
Participation time (hh:mm) | Males | Productive unpaid main activities | Germany (until 1990 former territory of the FRG) | 2010 | 2:45 |
Participation time (hh:mm) | Males | Productive unpaid main activities | Estonia | 2010 | 3:03 |
Participation time (hh:mm) | Males | Productive unpaid main activities | Greece | 2010 | 2:13 |
Participation time (hh:mm) | Males | Productive unpaid main activities | Spain | 2010 | 2:46 |
Participation time (hh:mm) | Males | Productive unpaid main activities | Finland | 2010 | 2:44 |
Participation time (hh:mm) | Males | Productive unpaid main activities | France | 2010 | 2:55 |
Participation time (hh:mm) | Males | Productive unpaid main activities | Hungary | 2010 | 3:04 |
Participation time (hh:mm) | Males | Productive unpaid main activities | Italy | 2010 | 2:27 |
Participation time (hh:mm) | Males | Productive unpaid main activities | Luxembourg | 2010 | 2:20 |
Participation time (hh:mm) | Males | Productive unpaid main activities | Netherlands | 2010 | 2:39 |
Participation time (hh:mm) | Males | Productive unpaid main activities | Norway | 2010 | 3:01 |
Participation time (hh:mm) | Males | Productive unpaid main activities | Poland | 2010 | 2:54 |
Participation time (hh:mm) | Males | Productive unpaid main activities | Romania | 2010 | 2:48 |
Participation time (hh:mm) | Males | Productive unpaid main activities | Serbia | 2010 | 2:46 |
Participation time (hh:mm) | Males | Productive unpaid main activities | Turkey | 2010 | 1:49 |
Participation time (hh:mm) | Males | Productive unpaid main activities | United Kingdom | 2010 | 2:26 |
Then again we convert the values from characters/factors to time values using the chron package and keep only the columns with sex, countries and values. Before plotting the values we need to cut the brackets from the name of Germany.
dt$geo<-gsub(" \\(.*\\)","",dt$geo)
if (is.factor(dt$values)|is.character(dt$values)) dt<-dt[,values:=chron::times(paste0(values,":00"))]
dt<-dt[,c("sex","geo","values")]
dt
sex | geo | values |
---|---|---|
<chr> | <chr> | <times> |
Females | Austria | 04:39:00 |
Females | Belgium | 04:08:00 |
Females | Germany | 04:00:00 |
Females | Estonia | 04:14:00 |
Females | Greece | 04:43:00 |
Females | Spain | 04:57:00 |
Females | Finland | 03:55:00 |
Females | France | 04:13:00 |
Females | Hungary | 04:57:00 |
Females | Italy | 05:30:00 |
Females | Luxembourg | 04:00:00 |
Females | Netherlands | 03:43:00 |
Females | Norway | 03:46:00 |
Females | Poland | 04:50:00 |
Females | Romania | 05:14:00 |
Females | Serbia | 05:08:00 |
Females | Turkey | 05:22:00 |
Females | United Kingdom | 04:01:00 |
Males | Austria | 02:54:00 |
Males | Belgium | 02:50:00 |
Males | Germany | 02:45:00 |
Males | Estonia | 03:03:00 |
Males | Greece | 02:13:00 |
Males | Spain | 02:46:00 |
Males | Finland | 02:44:00 |
Males | France | 02:55:00 |
Males | Hungary | 03:04:00 |
Males | Italy | 02:27:00 |
Males | Luxembourg | 02:20:00 |
Males | Netherlands | 02:39:00 |
Males | Norway | 03:01:00 |
Males | Poland | 02:54:00 |
Males | Romania | 02:48:00 |
Males | Serbia | 02:46:00 |
Males | Turkey | 01:49:00 |
Males | United Kingdom | 02:26:00 |
Then calculate the gender gap values as females minus males.
casted<-dcast(dt,geo~sex,value.var="values")
casted[,gap:=Females-Males]
dt<-melt(casted,measure.vars=c("Females","Males","gap"),variable.name="sex",value.name="values")
dt[,sex:=gsub("gap","Gender gap",sex)]
dt
geo | sex | values |
---|---|---|
<chr> | <chr> | <times> |
Austria | Females | 04:39:00 |
Belgium | Females | 04:08:00 |
Estonia | Females | 04:14:00 |
Finland | Females | 03:55:00 |
France | Females | 04:13:00 |
Germany | Females | 04:00:00 |
Greece | Females | 04:43:00 |
Hungary | Females | 04:57:00 |
Italy | Females | 05:30:00 |
Luxembourg | Females | 04:00:00 |
Netherlands | Females | 03:43:00 |
Norway | Females | 03:46:00 |
Poland | Females | 04:50:00 |
Romania | Females | 05:14:00 |
Serbia | Females | 05:08:00 |
Spain | Females | 04:57:00 |
Turkey | Females | 05:22:00 |
United Kingdom | Females | 04:01:00 |
Austria | Males | 02:54:00 |
Belgium | Males | 02:50:00 |
Estonia | Males | 03:03:00 |
Finland | Males | 02:44:00 |
France | Males | 02:55:00 |
Germany | Males | 02:45:00 |
Greece | Males | 02:13:00 |
Hungary | Males | 03:04:00 |
Italy | Males | 02:27:00 |
Luxembourg | Males | 02:20:00 |
Netherlands | Males | 02:39:00 |
Norway | Males | 03:01:00 |
Poland | Males | 02:54:00 |
Romania | Males | 02:48:00 |
Serbia | Males | 02:46:00 |
Spain | Males | 02:46:00 |
Turkey | Males | 01:49:00 |
United Kingdom | Males | 02:26:00 |
Austria | Gender gap | 01:45:00 |
Belgium | Gender gap | 01:18:00 |
Estonia | Gender gap | 01:11:00 |
Finland | Gender gap | 01:11:00 |
France | Gender gap | 01:18:00 |
Germany | Gender gap | 01:15:00 |
Greece | Gender gap | 02:30:00 |
Hungary | Gender gap | 01:53:00 |
Italy | Gender gap | 03:03:00 |
Luxembourg | Gender gap | 01:40:00 |
Netherlands | Gender gap | 01:04:00 |
Norway | Gender gap | 00:45:00 |
Poland | Gender gap | 01:56:00 |
Romania | Gender gap | 02:26:00 |
Serbia | Gender gap | 02:22:00 |
Spain | Gender gap | 02:11:00 |
Turkey | Gender gap | 03:33:00 |
United Kingdom | Gender gap | 01:35:00 |
We make the graph again with ggplot. We have to order by increasing value of Females, add the empty spaces before the EFTA and accession countries. Finally adjust scaling, remove vertical grid lines, column width and resize the plotting area to better see the figure.
dt_sep<-data.table::data.table(sex=c("Males","Males"),geo=c(" "," "),values=c(chron::times(NA),chron::times(NA)))
dt<-rbind(dt,dt_sep)
geo_ord<-dt[(geo %in% eu_ctry_names)&grepl("Females",sex)]
geo_ord<-geo_ord[order(values)]$geo
geo_ord<-c(geo_ord,' ','Norway',' ','Serbia','Turkey')
dt$geo<-factor(dt$geo,levels=geo_ord)
sex_ord<-c('Males','Females',"Gender gap")
dt$sex<-factor(dt$sex,levels=sex_ord)
fig12_colors<-c("#FAA519","#286EB4","black") #F06423
options(repr.plot.width=9, repr.plot.height=6,repr.plot.res=300)
ggplot(dt,aes(x=geo,y=values)) + theme_minimal() +
geom_bar(data=dt[sex!="Gender gap"], aes(fill=sex),position="dodge",stat="identity",width=0.6)+
geom_point(data=dt[grepl("Gender gap",sex)],aes(shape=sex),colour="#F06423",fill="black",size=3)+
scale_y_chron(format="%H:%M",breaks=seq(0,1,1/24)) +
scale_fill_manual(values = fig12_colors)+
scale_shape_manual(values=c("Males"=NA,"Females"=NA,"Gender gap"=21))+
ggtitle("Figure 12: Participation time per day in unpaid work (main activity), by gender, (hh mm; 2008 to 2015)") +
ylab("")+
xlab("")+
theme(legend.title = element_blank(),
legend.position= "bottom",
axis.text.x = element_text(angle = 90, hjust = 1),
panel.grid.major.x = element_blank(),
panel.grid.minor.y = element_blank())
Warning message: "Removed 2 rows containing missing values (geom_bar)."