Data
library(revealjs)
library(readr)
data <- read_csv("/Users/admin/Downloads/INF.csv")
## Rows: 16925 Columns: 827
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (25): name, proddate, cntry, cntbrth, cntbrtha, cntbrthb, cntbrthc, cnt...
## dbl (293): essround, edition, idno, dweight, pspwght, pweight, anweight, pro...
## lgl (509): vteurmmb, vteumbgb, rlgdnal, rlgdnat, rlgdnbat, rlgdnbe, rlgdncy,...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
ESS_1 <- read_csv("/Users/admin/Downloads/INF.csv")
## Rows: 16925 Columns: 827
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (25): name, proddate, cntry, cntbrth, cntbrtha, cntbrthb, cntbrthc, cnt...
## dbl (293): essround, edition, idno, dweight, pspwght, pweight, anweight, pro...
## lgl (509): vteurmmb, vteumbgb, rlgdnal, rlgdnat, rlgdnbat, rlgdnbe, rlgdncy,...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
data <- data %>%
filter (sclmeet <= 6) %>%
filter (gndr != 9) %>%
select(essround, sclmeet, gndr)
df <- data %>%
group_by(essround, gndr) %>%
summarise(mean_sclmeet = mean(sclmeet))
## `summarise()` has grouped output by 'essround'. You can override using the
## `.groups` argument.
## [1] "numeric"
## [1] "numeric"
## [1] "numeric"
df$gndr[df$gndr == 1] <- "Male"
df$gndr[df$gndr == 2] <- "Female"
df$essround[df$essround == 1] <- 2002
df$essround[df$essround == 2] <- 2004
df$essround[df$essround == 3] <- 2006
df$essround[df$essround == 4] <- 2008
df$essround[df$essround == 5] <- 2010
df$essround[df$essround == 6] <- 2012
df$essround[df$essround == 7] <- 2014
df$essround[df$essround == 8] <- 2016
df$essround[df$essround == 9] <- 2018
df$essround[df$essround == 10] <- 2020
class(df$essround)
## [1] "numeric"
## [1] "character"
## [1] "numeric"
Plot1
library(ggstream)
library(ggplot2)
plot1 <- ggplot(df, aes(x = essround, y = mean_sclmeet, fill = gndr)) +
geom_area()+
scale_fill_manual(values = c("#DE77AE", "#7FBC41"))+
theme_bw()+
labs(title = "Gender differences in 'Loyalty to others' value", x = "Year of ESS round", y = "Mean value")+
theme(plot.title = element_text(size = 12,hjust = 0, color = "deeppink"))
ESS_sclmeet <- ESS_1 %>%
filter(sclmeet != 77) %>%
filter(sclmeet != 88) %>%
filter (sclmeet != 99)%>%
filter (gndr != 9)
class(ESS_sclmeet$sclmeet)
## [1] "numeric"
ESS_sclmeet$gndr <- factor(ESS_sclmeet$gndr, labels = c("Male", "Female"), ordered= F)
ESS_sclmeet$essround <- factor(ESS_sclmeet$essround, labels = c("2002", "2004", "2006", "2008", "2010", "2012", "2014", "2016", "2018", "2020"), ordered= F)
library (dplyr)
df1<- ESS_sclmeet %>%
group_by(essround, gndr) %>%
summarise(mean_sclmeet = mean(sclmeet)) %>%
arrange(gndr)
## `summarise()` has grouped output by 'essround'. You can override using the
## `.groups` argument.
Plotly
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
##
## Attaching package: 'gridExtra'
## The following object is masked from 'package:dplyr':
##
## combine
grid.arrange(plot1, plot2, ncol = 2)
