#loading the packages require

library(foreign)
library(nnet)
library(foreign)
library(nnet)
library(dplyr)
## 
## 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
library(tidyr)
library(car)
## Loading required package: carData
## 
## Attaching package: 'car'
## The following object is masked from 'package:dplyr':
## 
##     recode
library(broom)
library(haven)

#open the European Social Survey data

library(ggplot2)

#plot 1

plot1 <- ggplot(data, aes(x = gvhanc19)) + 
  geom_histogram(binwidth = 1, fill = "Navy Blue", color = "black", alpha = 0.7) + 
  scale_x_continuous(breaks = 0:10, labels = c("Extremely Dissatisfied", "1", "2", "3", "4", "5", "6", "7", "8", "9", "Extremely Satisfied")) +
  labs(title = "1.How Satisfied with Government's handling COVID-19", x = "Satisfaction Level", y = "Frequency",
       caption="European Social Survey Round 10 data") +
  theme_minimal() + 
  geom_text(stat = 'count', aes(label=..count..), vjust = -0.2) +  
  theme(axis.text.x = element_text(angle = 45, hjust = 1))  
print(plot1)
## Warning: The dot-dot notation (`..count..`) was deprecated in ggplot2 3.4.0.
## ℹ Please use `after_stat(count)` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Warning: Removed 4187 rows containing non-finite values (`stat_bin()`).
## Warning: Removed 4187 rows containing non-finite values (`stat_count()`).

#plot

plot2 <- ggplot(data, aes(x = hscopc19)) + 
  geom_histogram(binwidth = 1, fill = "Navy Blue", color = "Black", alpha = 0.7) + 
  scale_x_continuous(breaks = 0:10, labels = c("Extremely Dissatisfied", "1", "2", "3", "4", "5", "6", "7", "8", "9", "Extremely Satisfied")) +
  labs(title = "2.Satisfied with health services COVID-19", x = "Satisfaction Level", y = "Frequency",
       caption="European Social Survey Round 10 data ") +
  theme_minimal() + 
  geom_text(stat = 'count', aes(label=..count..), vjust = -0.2) +  
  theme(axis.text.x = element_text(angle = 45, hjust = 1))  
print(plot2)
## Warning: Removed 3931 rows containing non-finite values (`stat_bin()`).
## Warning: Removed 3931 rows containing non-finite values (`stat_count()`).

#Plot

plot3 <- ggplot(data, aes(x = gvimpc19)) + 
  geom_histogram(binwidth = 1, fill = "Navy Blue", color = "black", alpha = 0.7) + 
  scale_x_continuous(breaks = 0:10, labels = c("Not trust at all", "1", "2", "3", "4", "5", "6", "7", "8", "9", "Complete trust")) +
  labs(title = "3.Trust the government COVID-19", x = "Trust Level", y = "Frequency",
       caption="European Social Survey Round 10 data") +
  theme_minimal() + 
  geom_text(stat = 'count', aes(label=..count..), vjust = -0.2) +  
  theme(axis.text.x = element_text(angle = 45, hjust = 1))  
print(plot3)
## Warning: Removed 3928 rows containing non-finite values (`stat_bin()`).
## Warning: Removed 3928 rows containing non-finite values (`stat_count()`).

#plot4

plot4 <- ggplot(data, aes(x = trstplt)) + 
  geom_histogram(binwidth = 1, fill = "Navy Blue", color = "Black", alpha = 0.7) + 
  scale_x_continuous(breaks = 0:10, labels = c("Not trust at all",  "1", "2", "3", "4", "5", "6","7","8", "9", "Complete trust")) +
  labs(title = "4.Trust in politicians during COVID-19", x = "Trust Level", y = "Frequency",
       caption="European Social Survey Round 10 data") +
  theme_minimal() + 
  geom_text(stat = 'count', aes(label=..count..), vjust = -0.2) +  
  theme(axis.text.x = element_text(angle = 45, hjust = 1))  
print(plot4)
## Warning: Removed 499 rows containing non-finite values (`stat_bin()`).
## Warning: Removed 499 rows containing non-finite values (`stat_count()`).

library(gridExtra)
## 
## Attaching package: 'gridExtra'
## The following object is masked from 'package:dplyr':
## 
##     combine
grid.arrange(plot1,plot2, plot3,plot4, ncol=2, nrow=2)
## Warning: Removed 4187 rows containing non-finite values (`stat_bin()`).
## Warning: Removed 4187 rows containing non-finite values (`stat_count()`).
## Warning: Removed 3931 rows containing non-finite values (`stat_bin()`).
## Warning: Removed 3931 rows containing non-finite values (`stat_count()`).
## Warning: Removed 3928 rows containing non-finite values (`stat_bin()`).
## Warning: Removed 3928 rows containing non-finite values (`stat_count()`).
## Warning: Removed 499 rows containing non-finite values (`stat_bin()`).
## Warning: Removed 499 rows containing non-finite values (`stat_count()`).

`

`

`