Switzerland is one of the wealthiest countries in the world with $92,463 GDP per Capita. Swiss have high quality standards of living and financial situation of Switzerland housholds is on a decent level. Hence, it is interesting to observe what factors can be related to their subjective-well being level, not considering good financial situation. We decided to focus on how social connections with family and colleagues are connected with their well-being and feeling of social exclusion. Question: Whether the organization of work connections, family and friends contacts is related to the subjective well-being levels and feelings of social exclusion.
First part of the plot
library(readr)
data <- read_csv("/Users/admin/Downloads/INF.csv")
library(dplyr)
data <- data %>%
filter (sclmeet < 8) %>%
filter (gndr != 9) %>%
select(essround, sclmeet, gndr)
df <- data %>%
group_by(essround, gndr) %>%
summarise(mean_sclmeet = mean(sclmeet))
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"
class(df$gndr)
## [1] "character"
class(df$mean_sclmeet)
## [1] "numeric"
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(x = "Year of ESS Data", y = "Frequency of meetings with friends, relatives or colleagues", title = "Socially meetings with friends, relatives or colleagues by Gender")+
theme(plot.title = element_text(size = 12,hjust = 0, face = 'bold'))
Secound part of the plot
ESS_1 <- read_csv("/Users/admin/Downloads/INF.csv")
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)
df1<- ESS_sclmeet %>%
group_by(essround, gndr) %>%
summarise(mean_sclmeet = mean(sclmeet)) %>%
arrange(gndr)
plot2 <- ggplot(df1, aes(x = essround, y = mean_sclmeet, group = gndr)) +
geom_line(aes(color=gndr)) +
geom_point(aes(color=gndr)) +
scale_color_manual(values=c("#7FBC41", "#DE77AE"))+
theme_minimal()+
labs(x = "Year of ESS Data", y = " ", title = " ")+
theme(plot.title = element_text(size = 12,hjust = 0, face = 'bold'), axis.text.x = element_text(angle=45), legend.position = 'none')
Final Plot
library(gridExtra)
grid.arrange(plot1, plot2, ncol = 2)
According to the line graph we can see the specific changes by year. The highest rates were for women in 2006 and 2018 compared to men. Also, while men saw a drop from 2006 to 2012, women saw a sharp rise in 2010. Both lines are characterised by a relative rise from 2002 to 2006 and a fall from 2018 to 2020. In general, it can be emphasised that women women are more likely to socialise with friends and significant others than men. What were the statistics on social interactions in Switzerland for different genders over the period 2002 to 2020? The graph on the left shows that men and women interact with family and colleagues to about the same extent. In the graph on the right we see a detailed change and a sharp drop from 2018 to 2020.
ESS2 <- read_csv(file = '/Users/admin/Downloads/ESS10-2/ESS10.csv')
library(dplyr)
ESS2 <- ESS2 %>%
filter(cntry == "CH")
Filtering data for the future graph
ESS10_teamfeel <- ESS2 %>%
filter(teamfeel <= 10)
class(ESS10_teamfeel$teamfeel)
## [1] "numeric"
class(ESS10_teamfeel$gndr)
## [1] "numeric"
ESS10_teamfeel$gndr <- factor(ESS10_teamfeel$gndr, labels = c("Male", "Female"), ordered= F)
Mode = function(x){
ta = table(x)
tam = max(ta)
if (all(ta == tam))
mod = NA
else
if(is.numeric(x))
mod = as.numeric(names(ta)[ta == tam])
else
mod = names(ta)[ta == tam]
return(mod)
}
ggplot(ESS10_teamfeel)+
geom_histogram(aes(x = teamfeel,fill=gndr), binwidth = 1, alpha = 0.5) +
xlim(c(0, 10))+
scale_fill_manual(values = c("#DE77AE", "#7FBC41"))+
theme_bw()+
labs(title = "The level of feeling like a part of working team by Gender",
subtitle="Histogram №2",
x="How much people feel like a part of their working team",
y="Number of people",
fill="Gender")+
theme(plot.title = element_text(face = "bold", size = 16,hjust = 0.5))+
scale_x_continuous(breaks= seq(0, 10, by=2))
2) Histigram – general
ggplot(ESS10_teamfeel)+
geom_histogram(aes(x = teamfeel), fill = "#DE77AE", binwidth = 1, alpha = 0.5) +
xlim(c(0, 10))+
theme_bw()+
labs(title = "The level of feeling like a part of working team of population",
subtitle="Histogram №2",
x="How much people feel like a part of their working team",
y="Number of people",
fill="Gender")+
theme(plot.title = element_text(face = "bold", size = 16,hjust = 0.5))+
scale_x_continuous(breaks= seq(0, 10, by=2))+
geom_vline(aes(xintercept = mean(teamfeel), color = 'mean'), linetype="solid", linewidth = 1) +
geom_vline(aes(xintercept = median(teamfeel), color = 'median'), linetype="solid", linewidth = 1)+
geom_vline(aes(xintercept = Mode(teamfeel), color = 'mode'), linetype="solid", linewidth = 1) +
scale_color_manual(name = "Measurement", values = c(median = "#C51B7D", mean = "#4D9221", mode = "#9970AB"))
In Switzerland, do men feel more part of the work team than women? histogram 1: in switzerland, men feel more part of the work team/work environment, while women feel less.
At what level do people in Switzerland feel part of the work team on avarege? histogram 2: the most frequent response was that they feel part of the team to a high degree, while on average they indicated that they feel part of the team to a slightly lower degree, but still quite high.
As it can be seen from the graph, people in Switzerland mostly feel like a part of their working team as the histogram is left-skewed. Moreover, all central tendency measurement are higher then 8, which represents high lefel of feeling like a part of a working team.
ESS3 <- read.csv('/Users/admin/Downloads/ESS10-2/ESS10.csv', header = TRUE)
scatter <- ggplot(ESS3 %>%
filter(happy <=10 & teamfeel <= 10 ), aes(x = teamfeel, y = happy)) +
geom_point(color="pink", alpha=0.1)+
labs(x="How happy are you", y="How much you feel like a team",
title= "Feeling happy due to feeling like a part of a working team",
subtitle="The graph with jittering effect")+
theme(title=element_text(size=25, face = "bold"))+
scale_x_continuous(breaks= seq(0, 10, by=2))+
scale_y_continuous(breaks= seq(0, 10, by=2))+
theme_minimal()+
geom_jitter(width = 0.45, height = 0.45, alpha = 0.3, color="#DE77AE" )
scatter2 <- ggplot(ESS3 %>%
filter(happy <=10 & teamfeel <= 10 ) %>%
count(happy,teamfeel, name= "count"), aes(x = teamfeel, y = happy, fill=count)) +
geom_tile() +
scale_fill_gradient(low = ("#7FBC41"),
high = "#DE77AE")+
labs(x="How happy are you", y="How much you feel like a team",
title= "",
subtitle="The heat map")+
theme(title=element_text( face = "bold"))+
geom_text(aes(label = count), color = "black", size = 2.2)+
coord_fixed()+
guides(fill = guide_colourbar(barwidth = 0.5,
barheight = 13))
grid.arrange(scatter, scatter2, ncol = 2)
Looking at the graph, it can be seen that there is a slight connecting between feeling of belonging to the working team and happiness as quite many high points of each scales corresponds with high values and have bigger size (therefore, there is bigger number of occurrences), however, still there are cases where high values of happiness corresponds with low values of feeling a part of a team and vise versa.
Histogramm with facets
library(dplyr)
library(ggplot2)
ESS3 <- ESS3 %>%
filter(closepnt < 6)
ESS3$closepnt <- factor(ESS3$closepnt, labels = c("Extremely close", "Very close", "Quite close", "Not very close", "Not at all close"), ordered= T)
ggplot(ESS3 %>%
filter(closepnt != "NA") %>%
filter(ttminpnt != 6666) %>%
filter (ttminpnt != 7777) %>%
filter(ttminpnt != 8888) %>%
filter (ttminpnt != 9999), aes( x=ttminpnt))+
ylab("Feeling of closeness to a parent")+
xlab("Travel time to a parent door to door")+
ggtitle("Relation between how close a parent and child live")+
geom_histogram(aes(fill = closepnt))+
scale_fill_manual(values = c("#C51B7D", "#DE77AE","#B8E186", "#7FBC41", "#4D9221"))+
#stat_summary(fun.y = mean, geom = "point", size = 2, col = "mediumblue")+
ylim(0, 500)+
labs(fill="Closeness to a parent", subtitle = "and the closeness of their relationship")+
theme(plot.title = element_text(size = 15, face="bold"),
plot.subtitle = element_text(size = 15, face="bold"))+
facet_wrap( ~ closepnt , ncol=2)
boxplot Is there a relation between how close a parent and child live and the closeness of their relationship (assessed by the child)? “closepnt” – ordinal This variable represents answers of respondents to the question “Taking everything into consideration, how close do you feel to him/her?”.
#Central tendency measures
ESS10_closepnt <- ESS10_1 %>%
select(idno, closepnt) %>%
filter(closepnt < 6)
v.closepnt <- c(Mode(ESS10_closepnt$closepnt), median(ESS10_closepnt$closepnt))
names(v.closepnt) <- c("mode", "median")
View(v.closepnt)
#Deleting observations, which are not needed for the analysis: Not applicable* & Refusal* & Don't know*
ESS10$closepnt[ESS10$closepnt == 6 | ESS10$closepnt == 7 | ESS10$closepnt == 8 | ESS10$closepnt == 9] <- NA
#R represents this variable as numeric, so we assigning ordered factor variable type
ESS10$closepnt <- factor(ESS10$closepnt, labels = c("Extremely close", "Very close", "Quite close", "Not very close", "Not at all close"), ordered= T)
class(ESS10$closepnt)
## [1] "ordered" "factor"
summary(ESS10$closepnt)
## Extremely close Very close Quite close Not very close
## 211 441 241 69
## Not at all close NA's
## 23 538
“ttminpnt” – ratio This variable represents answers of respondents to the question “About how long would it take you to get to where your parents live, on average? Think of the way you would travel and of the time it would take door to door.”
#Deleting observations, which are not needed for the analysis
ESS10_ttminpnt <- ESS10 %>%
select(idno, ttminpnt) %>%
filter(ttminpnt != 6666) %>%
filter (ttminpnt != 7777) %>%
filter(ttminpnt != 8888) %>%
filter (ttminpnt != 9999)
#Central tendency measures
v.ttminpnt <- c(mean(ESS10_ttminpnt$ttminpnt), Mode(ESS10_ttminpnt$ttminpnt), median(ESS10_ttminpnt$ttminpnt))
names(v.ttminpnt) <- c("mean", "mode", "median")
View(v.ttminpnt)
class(ESS10_ttminpnt$ttminpnt)
## [1] "numeric"
summary(ESS10_ttminpnt$ttminpnt)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.0 10.0 30.0 188.1 180.0 4320.0
ggplot(ESS10 %>%
filter(closepnt != "NA") %>%
filter(ttminpnt != 6666) %>%
filter (ttminpnt != 7777) %>%
filter(ttminpnt != 8888) %>%
filter (ttminpnt != 9999), aes(x=closepnt, y=ttminpnt))+
xlab("Feeling of closeness to a parent")+
ylab("Travel time to a parent door to door")+
ggtitle("Relation between how close a parent and child live")+
geom_boxplot(aes(fill = closepnt))+
scale_fill_brewer(palette = "PiYG")+
stat_summary(fun.y = mean, geom = "point", size = 2, col = "mediumblue")+
ylim(0, 500)+
labs(fill="Closeness to a parent", subtitle = "and the closeness of their relationship")+
theme(plot.title = element_text(size = 15, face="bold"),
plot.subtitle = element_text(size = 15, face="bold"))
We see that the average distance to parents increases with decreasing degree of relationship closeness. Therefore we can conclude that families who live in a longer distance from each other have less close relationships.