Sys.setlocale(category = "LC_ALL", locale = "Hebrew_Israel.1255")
## [1] "LC_COLLATE=Hebrew_Israel.1255;LC_CTYPE=Hebrew_Israel.1255;LC_MONETARY=Hebrew_Israel.1255;LC_NUMERIC=C;LC_TIME=Hebrew_Israel.1255"
library(haven)
## Warning: package 'haven' was built under R version 4.1.3
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.1.3
library(reshape2)
library(ggthemes)
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.1.3
## 
## 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(qualtRics)
## Warning: package 'qualtRics' was built under R version 4.1.3
library(tidyr)
## Warning: package 'tidyr' was built under R version 4.1.3
## 
## Attaching package: 'tidyr'
## The following object is masked from 'package:reshape2':
## 
##     smiths
#read data with qualtRics 
data <- read_spss("survey_qua_23.2.sav")

names(data)
##   [1] "StartDate"                   "EndDate"                    
##   [3] "Status"                      "IPAddress"                  
##   [5] "Progress"                    "Duration__in_seconds_"      
##   [7] "Finished"                    "RecordedDate"               
##   [9] "ResponseId"                  "RecipientLastName"          
##  [11] "RecipientFirstName"          "RecipientEmail"             
##  [13] "ExternalReference"           "LocationLatitude"           
##  [15] "LocationLongitude"           "DistributionChannel"        
##  [17] "UserLanguage"                "how_recieve"                
##  [19] "Q1_gender"                   "Q2_cs_filter"               
##  [21] "Q4_influence_past_1"         "Q4_influence_past_2"        
##  [23] "Q4_influence_past_3"         "Q5_influence_future"        
##  [25] "Q6_influence_comment"        "Q10_meritocracy_past_1"     
##  [27] "Q10_meritocracy_past_2"      "Q10_meritocracy_past_3"     
##  [29] "Q11_meritocracy_futu"        "Q12_meritocracy_comm"       
##  [31] "Q13_functioning_poli"        "Q14_functioning_hr"         
##  [33] "Q15_democracy_future"        "Q16_democracy_1"            
##  [35] "Q16_democracy_2"             "Q16_democracy_3"            
##  [37] "Q16_democracy_4"             "Q16_democracy_5"            
##  [39] "Q17_democracy_commen"        "Q19_investment_past"        
##  [41] "Q20_investment_compa"        "Q21_investment_futur"       
##  [43] "Q21_comment"                 "Q22_voice_past_1"           
##  [45] "Q22_voice_past_2"            "Q22_voice_past_3"           
##  [47] "Q22a_voice_compare"          "Q23_voice_future"           
##  [49] "Q24_voice_comment"           "Q25_CS_resign"              
##  [51] "Q26_CS_resign_money"         "Q27_CS_return_money"        
##  [53] "Q27_comment"                 "Q29_subotage_1"             
##  [55] "Q29_subotage_2"              "Q29_subotage_3"             
##  [57] "Q29_subotage_4"              "Q29_subotage_5"             
##  [59] "Q29_subotage_6"              "Q29_subotage_7"             
##  [61] "Q29_subotage_8"              "Q29_subotage_9"             
##  [63] "Q29a_subotage_commen"        "Q28_PSM_1"                  
##  [65] "Q28_PSM_2"                   "Q28_PSM_3"                  
##  [67] "Q28_PSM_4"                   "Q31_unit"                   
##  [69] "Q31_unit_26_TEXT"            "Q32_unit_left"              
##  [71] "Q32_unit_left_26_TEXT"       "Q33_seniority"              
##  [73] "Q34_seniority_left"          "Q35_appointing"             
##  [75] "Q35_appointing_4_TEXT"       "Q36_appointing_left"        
##  [77] "Q36_appointing_left_4_TEXT"  "Q37_senior_per"             
##  [79] "Q38_senior_per_left"         "Q39_jewish"                 
##  [81] "Q40_age"                     "Q41_religion"               
##  [83] "Q42_education"               "Q42_education_999_TEXT"     
##  [85] "Q43_education_field"         "Q44_feelings"               
##  [87] "Q45_common_method_va"        "Q47_future_research"        
##  [89] "Q2_f"                        "Q4_f_influence_past_1"      
##  [91] "Q4_f_influence_past_2"       "Q4_f_influence_past_3"      
##  [93] "Q5_f_influence_futur"        "Q6_f_influence_comme"       
##  [95] "Q10_f_meritocracy_pa_1"      "Q10_f_meritocracy_pa_2"     
##  [97] "Q10_f_meritocracy_pa_3"      "Q11_f_meritocracy_fu"       
##  [99] "Q12_f_meritocracy_co"        "Q13_f_functioning_po"       
## [101] "Q14_f_functioni_hr"          "Q15_f_democracy_futu"       
## [103] "Q16_f_democracy_1"           "Q16_f_democracy_2"          
## [105] "Q16_f_democracy_3"           "Q16_f_democracy_4"          
## [107] "Q16_f_democracy_5"           "Q17_f_democracy_comm"       
## [109] "Q19_f_investment_pa"         "Q20_f_investment_com"       
## [111] "Q21_f_investment_fut"        "Q21_f_comment"              
## [113] "Q22_f_voice_past_1"          "Q22_f_voice_past_2"         
## [115] "Q22_f_voice_past_3"          "Q22a_f_voice_compare"       
## [117] "Q23_f_voice_future"          "Q24_f_voice_comment"        
## [119] "Q25_f_CS_resign"             "Q26_f_CS_resign_mone"       
## [121] "Q27_f_CS_return_mon"         "Q27_f_comment"              
## [123] "Q29_f_subotage_1"            "Q29_f_subotage_2"           
## [125] "Q29_f_subotage_3"            "Q29_f_subotage_4"           
## [127] "Q29_f_subotage_5"            "Q29_f_subotage_6"           
## [129] "Q29_f_subotage_7"            "Q29_f_subotage_8"           
## [131] "Q29_f_subotage_9"            "Q29a_f_subotage_comm"       
## [133] "Q28_f_PSM_1"                 "Q28_f_PSM_2"                
## [135] "Q28_f_PSM_3"                 "Q28_f_PSM_4"                
## [137] "Q31_f_unit"                  "Q31_f_unit_26_TEXT"         
## [139] "Q32_f_unit_left"             "Q32_f_unit_left_26_TEXT"    
## [141] "Q33_f_seniority"             "Q34_f_seniority_left"       
## [143] "Q35_f_appointing"            "Q35_f_appointing_4_TEXT"    
## [145] "Q36_f_appointing_lef"        "Q36_f_appointing_lef_4_TEXT"
## [147] "Q37_f_senior_per"            "Q38_f_senior_per_le"        
## [149] "Q39_f_jewish"                "Q40_f_age"                  
## [151] "Q41_f_religion"              "Q42_f_education"            
## [153] "Q42_f_education_999_TEXT"    "Q43_f_education_fiel"       
## [155] "Q44_f_feelings"              "Q45_f_common_meth_va"       
## [157] "Q47_f_future_resear"         "filtered_out"
#create a new dataset with combined variables for men and women
new_data <- data[, 1:19]

#combine variables for men and women
new_data$Q2 <- coalesce(data$Q2_cs_filter, data$Q2_f)
## Warning: `..1` and `..2` have conflicting value labels.
## i Labels for these values will be taken from `..1`.
## x Values: 1
#Q4 - influence past
new_data$Q4_1 <- coalesce(data$Q4_influence_past_1, data$Q4_f_influence_past_1)
## Warning: `..1` and `..2` have conflicting value labels.
## i Labels for these values will be taken from `..1`.
## x Values: 1, 2, 3, 4, 5, 6, and 7
new_data$Q4_2 <- coalesce(data$Q4_influence_past_2, data$Q4_f_influence_past_2)
## Warning: `..1` and `..2` have conflicting value labels.
## i Labels for these values will be taken from `..1`.
## x Values: 1, 2, 3, 4, 5, 6, and 7
new_data$Q4_3 <-coalesce(data$Q4_influence_past_3, data$Q4_f_influence_past_3)
## Warning: `..1` and `..2` have conflicting value labels.
## i Labels for these values will be taken from `..1`.
## x Values: 1, 2, 3, 4, 5, 6, and 7
#Q5 - influence future
new_data$Q5 <- coalesce(data$Q5_influence_future, data$Q5_f_influence_futur)

#Q6 - influence comments
new_data$Q6 <- coalesce(data$Q6_influence_comment, data$Q6_f_influence_comme)

#Q10 - meritocracy - past
new_data$Q10_1 <- coalesce(data$Q10_meritocracy_past_1, data$Q10_f_meritocracy_pa_1)
## Warning: `..1` and `..2` have conflicting value labels.
## i Labels for these values will be taken from `..1`.
## x Values: 1, 2, 3, 4, 5, 6, and 7
new_data$Q10_2 <- coalesce(data$Q10_meritocracy_past_2, data$Q10_f_meritocracy_pa_2)
## Warning: `..1` and `..2` have conflicting value labels.
## i Labels for these values will be taken from `..1`.
## x Values: 1, 2, 3, 4, 5, 6, and 7
new_data$Q10_3 <- coalesce(data$Q10_meritocracy_past_3, data$Q10_f_meritocracy_pa_3)
## Warning: `..1` and `..2` have conflicting value labels.
## i Labels for these values will be taken from `..1`.
## x Values: 1, 2, 3, 4, 5, 6, and 7
#Q11 - meritocracy - future
new_data$Q11 <- coalesce(data$Q11_meritocracy_futu, data$Q11_f_meritocracy_fu)

#Q12 - meritocracy - comments
new_data$Q12 <- coalesce(data$Q12_meritocracy_comm, data$Q12_f_meritocracy_co)

#Q13 - functioning - past
new_data$Q13 <- coalesce(data$Q13_functioning_poli,data$Q13_f_functioning_po)
## Warning: `..1` and `..2` have conflicting value labels.
## i Labels for these values will be taken from `..1`.
## x Values: 1, 2, 3, 4, and 5
#Q14 - functioning - hr
new_data$Q14 <- coalesce(data$Q14_functioning_hr, data$Q14_f_functioni_hr)
## Warning: `..1` and `..2` have conflicting value labels.
## i Labels for these values will be taken from `..1`.
## x Values: 1, 2, 3, 4, and 5
#Q15 - democratic decline - future expectations
new_data$Q15 <- coalesce(data$Q15_democracy_future, data$Q15_f_democracy_futu)
## Warning: `..1` and `..2` have conflicting value labels.
## i Labels for these values will be taken from `..1`.
## x Values: 1, 2, 3, 4, and 999
#Q16 - democratic decline - protest
new_data$Q16_1 <- coalesce(data$Q16_democracy_1, data$Q16_f_democracy_1)
## Warning: `..1` and `..2` have conflicting value labels.
## i Labels for these values will be taken from `..1`.
## x Values: 1, 2, 3, 4, 5, 6, and 7
new_data$Q16_2 <- coalesce(data$Q16_democracy_2, data$Q16_f_democracy_2)
## Warning: `..1` and `..2` have conflicting value labels.
## i Labels for these values will be taken from `..1`.
## x Values: 1, 2, 3, 4, 5, 6, and 7
new_data$Q16_3 <- coalesce(data$Q16_democracy_3, data$Q16_f_democracy_3)
## Warning: `..1` and `..2` have conflicting value labels.
## i Labels for these values will be taken from `..1`.
## x Values: 1, 2, 3, 4, 5, 6, and 7
new_data$Q16_4 <- coalesce(data$Q16_democracy_4, data$Q16_f_democracy_4)
## Warning: `..1` and `..2` have conflicting value labels.
## i Labels for these values will be taken from `..1`.
## x Values: 1, 2, 3, 4, 5, 6, and 7
new_data$Q16_5 <- coalesce(data$Q16_democracy_5, data$Q16_f_democracy_5)
## Warning: `..1` and `..2` have conflicting value labels.
## i Labels for these values will be taken from `..1`.
## x Values: 1, 2, 3, 4, 5, 6, and 7
#Q17 - democratic decline - comments
new_data$Q17 <- coalesce(data$Q17_democracy_commen, data$Q17_f_democracy_comm) 

#Q19 - investment at work - past
new_data$Q19 <- coalesce(data$Q19_investment_past, data$Q19_f_investment_pa) 

#Q20 - investment at work - collegaues
new_data$Q20 <- coalesce(data$Q20_investment_compa, data$Q20_f_investment_com) 

#Q21 - investment at work - future
new_data$Q21 <- coalesce(data$Q21_investment_futur, data$Q21_f_investment_fut)

#Q21_a - investment at work - comments
new_data$Q21_a <- coalesce(data$Q21_comment, data$Q21_f_comment)

#Q22 - voice - past
new_data$Q22_1 <- coalesce(data$Q22_voice_past_1, data$Q22_f_voice_past_1)
new_data$Q22_2 <- coalesce(data$Q22_voice_past_2, data$Q22_f_voice_past_2)
new_data$Q22_3 <- coalesce(data$Q22_voice_past_3, data$Q22_f_voice_past_3)

#Q22_a - voice - collegaues
new_data$Q22_a <- coalesce(data$Q22a_voice_compare, data$Q22a_f_voice_compare)

#Q23 - voice - future
new_data$Q23 <- coalesce(data$Q23_voice_future, data$Q23_f_voice_future)

#Q24 - voice - comments
new_data$Q24 <- coalesce(data$Q24_voice_comment, data$Q24_f_voice_comment)

#Q25 - exit 
new_data$Q25 <- coalesce(data$Q25_CS_resign, data$Q25_f_CS_resign)
## Warning: `..1` and `..2` have conflicting value labels.
## i Labels for these values will be taken from `..1`.
## x Values: 1, 2, 3, 4, and 5
#Q26 - exit - private sector's equal salary
new_data$Q26 <- coalesce(data$Q26_CS_resign_money, data$Q26_f_CS_resign_mone)

#Q27-  reutrn to CS
new_data$Q27 <- coalesce(data$Q27_CS_return_money, data$Q27_f_CS_return_mon)

#Q27_a- comments
new_data$Q27_a <- coalesce(data$Q27_comment, data$Q27_f_comment)

#Q28 - PSM
new_data$Q28_1 <- coalesce(data$Q28_PSM_1, data$Q28_f_PSM_1)
## Warning: `..1` and `..2` have conflicting value labels.
## i Labels for these values will be taken from `..1`.
## x Values: 1, 2, 3, 4, 5, 6, and 7
new_data$Q28_2 <- coalesce(data$Q28_PSM_2, data$Q28_f_PSM_2)
## Warning: `..1` and `..2` have conflicting value labels.
## i Labels for these values will be taken from `..1`.
## x Values: 1, 2, 3, 4, 5, 6, and 7
new_data$Q28_3 <- coalesce(data$Q28_PSM_3, data$Q28_f_PSM_3)
## Warning: `..1` and `..2` have conflicting value labels.
## i Labels for these values will be taken from `..1`.
## x Values: 1, 2, 3, 4, 5, 6, and 7
new_data$Q28_4 <- coalesce(data$Q28_PSM_4, data$Q28_f_PSM_4)
## Warning: `..1` and `..2` have conflicting value labels.
## i Labels for these values will be taken from `..1`.
## x Values: 1, 2, 3, 4, 5, 6, and 7
#Q29 - subotage
new_data$Q29_1 <- coalesce(data$Q29_subotage_1, data$Q29_f_subotage_1)
new_data$Q29_2 <- coalesce(data$Q29_subotage_2, data$Q29_f_subotage_2)
new_data$Q29_3 <- coalesce(data$Q29_subotage_3, data$Q29_f_subotage_3)
new_data$Q29_4 <- coalesce(data$Q29_subotage_4, data$Q29_f_subotage_4)
new_data$Q29_5 <- coalesce(data$Q29_subotage_5, data$Q29_f_subotage_5)
new_data$Q29_6 <- coalesce(data$Q29_subotage_6, data$Q29_f_subotage_6)
new_data$Q29_7 <- coalesce(data$Q29_subotage_7, data$Q29_f_subotage_7)
new_data$Q29_8 <- coalesce(data$Q29_subotage_8, data$Q29_f_subotage_8)
new_data$Q29_9 <- coalesce(data$Q29_subotage_9, data$Q29_f_subotage_9)

#Q29_a - subotage comments
new_data$Q29_a <- coalesce(data$Q29a_subotage_commen, data$Q29a_f_subotage_comm)

#Q31 - unit (if still works)
new_data$Q31 <- coalesce(data$Q31_unit, data$Q31_f_unit)

#Q31_a - unit (if still works) - other
new_data$Q31_a <- coalesce(data$Q31_unit_26_TEXT, data$Q31_f_unit_26_TEXT)

#Q32 - unit (if left)
new_data$Q32 <- coalesce(data$Q32_unit_left, data$Q32_f_unit_left)

#Q32_a - unit (if left) - other
new_data$Q32_a <- coalesce(data$Q32_unit_left_26_TEXT, data$Q32_unit_left_26_TEXT)

#Q33 - seniority (if still works)
new_data$Q33 <- coalesce(data$Q33_seniority, data$Q33_f_seniority)

#Q34 - seniority (if left)
new_data$Q34 <- coalesce(data$Q34_seniority_left, data$Q34_f_seniority_left)

#Q35 - appointing (if still works)
new_data$Q35 <- coalesce(data$Q35_appointing, data$Q35_f_appointing) 

#Q35_a - appointing (if still works) - other
new_data$Q35_a <- coalesce(data$Q35_appointing_4_TEXT, data$Q35_f_appointing_4_TEXT) 

#Q36 - appointing (if left)
new_data$Q36 <- coalesce(data$Q36_appointing_left, data$Q36_f_appointing_lef) 

#Q36_a - appointing (if left) - other
new_data$Q36_a <- coalesce(data$Q36_appointing_left_4_TEXT, data$Q36_f_appointing_lef_4_TEXT) 

#Q37 - percieved seniority (if still works)
new_data$Q37 <- coalesce(data$Q37_senior_per, data$Q37_f_senior_per) 

#Q38 - percieved seniority (if left)
new_data$Q38 <- coalesce(data$Q38_senior_per_left, data$Q38_f_senior_per_le) 

#Q39 - jewish
new_data$Q39 <- coalesce(data$Q39_jewish, data$Q39_f_jewish) 
## Warning: `..1` and `..2` have conflicting value labels.
## i Labels for these values will be taken from `..1`.
## x Values: 0 and 1
#Q40 - age
new_data$Q40 <- coalesce(data$Q40_age, data$Q40_f_age) 

#Q41 - religion
new_data$Q41 <- coalesce(data$Q41_religion, data$Q41_f_religion) 
## Warning: `..1` and `..2` have conflicting value labels.
## i Labels for these values will be taken from `..1`.
## x Values: 0, 1, 2, 3, and 4
#Q42 - education
new_data$Q42 <- coalesce(data$Q42_education, data$Q42_f_education)

#Q42_a - education - other
new_data$Q42_a <- coalesce(data$Q42_education_999_TEXT, data$Q42_f_education_999_TEXT)

#Q43 - education field
new_data$Q43 <- coalesce(data$Q43_education_field, data$Q43_f_education_fiel)

#Q44 - survey feelings
new_data$Q44 <- coalesce(data$Q44_feelings, data$Q44_f_feelings)

#Q45 - survey formulation
new_data$Q45 <- coalesce(data$Q45_common_method_va, data$Q45_f_common_meth_va)
## Warning: `..1` and `..2` have conflicting value labels.
## i Labels for these values will be taken from `..1`.
## x Values: 1, 2, 3, 4, 5, 6, and 7

Plots

Q5 <- as.data.frame(
  new_data %>%
    group_by(Q5) %>%
    summarize(N = n()) %>%
    mutate(freq = N / sum(N)) %>%
    na.omit() 
)

Q5_merged <- 
  Q5 %>%
  mutate(Q5 = case_when(Q5 %in% c("1","2") ~ "1",
                        Q5 %in% "3" ~ "2",
                        Q5 %in% c("4","5") ~ "3"))



ggplot(Q5_merged) +
  geom_bar(aes(factor(x=Q5), y=N), stat="identity")+
  scale_x_discrete(labels = c("החלשות והחלשות משמעותית", "ללא שינוי" ,"התחזקות והתחזקות משמעותית"))+
  theme(
        axis.text = element_text(size =12),
        axis.line = element_line(colour = "black"),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        legend.title=element_blank(),
        legend.text=element_text(size=20),
        legend.position='bottom',
        legend.direction ='horizontal',
        legend.key=element_blank(),
        legend.margin = unit(0.2, "line"),
        legend.key.height=unit(0.6,"line"), 
        plot.title=element_text(size=12,face="bold", hjust = 0.5),
        axis.title.x=element_text(size=24),
        axis.title.y=element_text(size=24))+
  xlab("")+
  ylab("")+
  ggtitle("במבט קדימה על חמש השנים הבאות, באיזו מידה אתה צופה שתהיה התחזקות או החלשות \n ?במידת ההשפעה של הדרג המקצועי ביחידה שלך על מדיניות המשרד בתחום הפעילות של היחידה")
## Warning: `legend.margin` must be specified using `margin()`
## i For the old behavior use `legend.spacing`

Q5_37 <- as.data.frame(
  new_data %>%
    group_by(Q5, Q37) %>%
    summarize(N = n()) %>%
    mutate(freq = N / sum(N)) %>%
    na.omit() 
)
## `summarise()` has grouped output by 'Q5'. You can override using the `.groups`
## argument.
Q5_37_merged <- 
  Q5_37 %>%
  mutate(Q5 = case_when(Q5 %in% c("1","2") ~ "1",
                        Q5 %in% "3" ~ "2",
                        Q5 %in% c("4","5") ~ "3"),
         Q37 = case_when(Q37 %in% c("1","2") ~ "1",
                        Q37 %in% c("3","4") ~ "2"))


ggplot(Q5_37_merged) +
  geom_bar(aes(x=Q5, y=N, fill = Q37), stat="identity", position=position_dodge())+
  scale_x_discrete(labels = c("החלשות והחלשות משמעותית", "ללא שינוי" ,"התחזקות והתחזקות משמעותית"))+
  scale_fill_brewer(palette="Reds", labels=c("דרג ביניים וזוטר", "דרג בכיר ובכיר מאוד")) +
  theme(strip.text = element_text(size=24),
        axis.text = element_text(size =12),
        axis.line = element_line(colour = "black"),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        legend.title=element_blank(),
        legend.text=element_text(size=14),
        legend.position='bottom',
        legend.direction ='horizontal',
        legend.key=element_blank(),
        legend.margin = unit(0.2, "line"),
        legend.key.height=unit(0.6,"line"), 
        plot.title=element_text(size=12,face="bold", hjust = 0.5),
        axis.title.x=element_text(size=24),
        axis.title.y=element_text(size=24))+
  xlab("")+
  ylab("")+
  ggtitle("במבט קדימה על חמש השנים הבאות, באיזו מידה אתה צופה שתהיה התחזקות או החלשות \n ?במידת ההשפעה של הדרג המקצועי ביחידה שלך על מדיניות המשרד בתחום הפעילות של היחידה")
## Warning: `legend.margin` must be specified using `margin()`
## i For the old behavior use `legend.spacing`

Q5_41 <- as.data.frame(
  new_data %>%
    group_by(Q5, Q41) %>%
    summarize(N = n()) %>%
    mutate(freq = N / sum(N)) %>%
    na.omit() 
)
## `summarise()` has grouped output by 'Q5'. You can override using the `.groups`
## argument.
Q5_41_merged <- 
  Q5_41 %>%
  mutate(Q5 = case_when(Q5 %in% c("1","2") ~ "1",
                        Q5 %in% "3" ~ "2",
                        Q5 %in% c("4","5") ~ "3"),
         Q41 = case_when(Q41 %in% c("0","1") ~ "1",
                         Q41 %in% c("2","3", "4") ~ "2",
                         Q41 %in% "999" ~ "3"))


ggplot(Q5_41_merged) +
  geom_bar(aes(x=Q5, y=N, fill = Q41), stat="identity", position=position_dodge())+
  scale_x_discrete(labels = c("החלשות והחלשות משמעותית", "ללא שינוי" ,"התחזקות והתחזקות משמעותית"))+
  scale_fill_brewer(palette="Reds", labels=c("חילוני", "דתי", "אחר")) +
  theme(strip.text = element_text(size=24),
        axis.text = element_text(size =12),
        axis.line = element_line(colour = "black"),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        legend.title=element_blank(),
        legend.text=element_text(size=14),
        legend.position='bottom',
        legend.direction ='horizontal',
        legend.key=element_blank(),
        legend.margin = unit(0.2, "line"),
        legend.key.height=unit(0.6,"line"), 
        plot.title=element_text(size=12,face="bold", hjust = 0.5),
        axis.title.x=element_text(size=24),
        axis.title.y=element_text(size=24))+
  xlab("")+
  ylab("")+
  ggtitle("במבט קדימה על חמש השנים הבאות, באיזו מידה אתה צופה שתהיה התחזקות או החלשות \n ?במידת ההשפעה של הדרג המקצועי ביחידה שלך על מדיניות המשרד בתחום הפעילות של היחידה")
## Warning: `legend.margin` must be specified using `margin()`
## i For the old behavior use `legend.spacing`

Q11 <- as.data.frame(
  new_data %>%
    group_by(Q11) %>%
    summarize(N = n()) %>%
    mutate(freq = N / sum(N)) %>%
    na.omit() 
)

Q11_merged <- 
  Q11 %>%
  mutate(Q11 = case_when(Q11 %in% c("1","2") ~ "1",
                        Q11 %in% "3" ~ "2",
                        Q11 %in% c("4","5") ~ "3"))



ggplot(Q11_merged) +
  geom_bar(aes(factor(x=Q11), y=N), stat="identity")+
  scale_x_discrete(labels = c("שינוי לרעה ושינוי משמעותי לרעה", "ללא שינוי" ,"שינוי לטובה ושינוי משמעותי לטובה"))+
  theme(strip.text = element_text(size=24),
        axis.text = element_text(size =12),
        axis.line = element_line(colour = "black"),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        legend.title=element_blank(),
        legend.text=element_text(size=20),
        legend.position='bottom',
        legend.direction ='horizontal',
        legend.key=element_blank(),
        legend.margin = unit(0.2, "line"),
        legend.key.height=unit(0.6,"line"), 
        plot.title=element_text(size=12,face="bold", hjust = 0.5),
        axis.title.x=element_text(size=24),
        axis.title.y=element_text(size=24))+
  xlab("")+
  ylab("")+
  ggtitle("במבט קדימה על חמש השנים הבאות, באיזו מידה אתה צופה שיהיה שינוי לטובה\n ?או לרעה במידה שבה קידומים במשרד ייעשו בפועל על בסיס ניסיון רלוונטי, יכולת ועבודה קשה")
## Warning: `legend.margin` must be specified using `margin()`
## i For the old behavior use `legend.spacing`

Q11_37 <- as.data.frame(
  new_data %>%
    group_by(Q11, Q37) %>%
    summarize(N = n()) %>%
    mutate(freq = N / sum(N)) %>%
    na.omit() 
)
## `summarise()` has grouped output by 'Q11'. You can override using the `.groups`
## argument.
Q11_37_merged <- 
  Q11_37 %>%
  mutate(Q11 = case_when(Q11 %in% c("1","2") ~ "1",
                        Q11 %in% "3" ~ "2",
                        Q11 %in% c("4","5") ~ "3"),
         Q37 = case_when(Q37 %in% c("1","2") ~ "1",
                        Q37 %in% c("3","4") ~ "2"))


ggplot(Q11_37_merged) +
  geom_bar(aes(x=Q11, y=N, fill = Q37), stat="identity", position=position_dodge())+
    scale_x_discrete(labels = c("שינוי לרעה ושינוי משמעותי לרעה", "ללא שינוי" ,"שינוי לטובה ושינוי משמעותי לטובה"))+
  scale_fill_brewer(palette="Reds", labels=c("דרג ביניים וזוטר", "דרג בכיר ובכיר מאוד")) +
  theme(strip.text = element_text(size=24),
        axis.text = element_text(size =12),
        axis.line = element_line(colour = "black"),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        legend.title=element_blank(),
        legend.text=element_text(size=14),
        legend.position='bottom',
        legend.direction ='horizontal',
        legend.key=element_blank(),
        legend.margin = unit(0.2, "line"),
        legend.key.height=unit(0.6,"line"), 
        plot.title=element_text(size=12,face="bold", hjust = 0.5),
        axis.title.x=element_text(size=24),
        axis.title.y=element_text(size=24))+
  xlab("")+
  ylab("")+
  ggtitle("במבט קדימה על חמש השנים הבאות, באיזו מידה אתה צופה שיהיה שינוי לטובה\n ?או לרעה במידה שבה קידומים במשרד ייעשו בפועל על בסיס ניסיון רלוונטי, יכולת ועבודה קשה")
## Warning: `legend.margin` must be specified using `margin()`
## i For the old behavior use `legend.spacing`

Q11_41 <- as.data.frame(
  new_data %>%
    group_by(Q11, Q41) %>%
    summarize(N = n()) %>%
    mutate(freq = N / sum(N)) %>%
    na.omit() 
)
## `summarise()` has grouped output by 'Q11'. You can override using the `.groups`
## argument.
Q11_41_merged <- 
  Q11_41 %>%
  mutate(Q11 = case_when(Q11 %in% c("1","2") ~ "1",
                        Q11 %in% "3" ~ "2",
                        Q11 %in% c("4","5") ~ "3"),
         Q41 = case_when(Q41 %in% c("0","1") ~ "1",
                         Q41 %in% c("2","3", "4") ~ "2",
                         Q41 %in% "999" ~ "3"))


ggplot(Q11_41_merged) +
  geom_bar(aes(x=Q11, y=N, fill = Q41), stat="identity", position=position_dodge())+
  scale_x_discrete(labels = c("החלשות והחלשות משמעותית", "ללא שינוי" ,"התחזקות והתחזקות משמעותית"))+
  scale_fill_brewer(palette="Reds", labels=c("חילוני", "דתי", "אחר")) +
  theme(strip.text = element_text(size=24),
        axis.text = element_text(size =12),
        axis.line = element_line(colour = "black"),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        legend.title=element_blank(),
        legend.text=element_text(size=14),
        legend.position='bottom',
        legend.direction ='horizontal',
        legend.key=element_blank(),
        legend.margin = unit(0.2, "line"),
        legend.key.height=unit(0.6,"line"), 
        plot.title=element_text(size=12,face="bold", hjust = 0.5),
        axis.title.x=element_text(size=24),
        axis.title.y=element_text(size=24))+
  xlab("")+
  ylab("")+
  ggtitle("במבט קדימה על חמש השנים הבאות, באיזו מידה אתה צופה שיהיה שינוי לטובה\n ?או לרעה במידה שבה קידומים במשרד ייעשו בפועל על בסיס ניסיון רלוונטי, יכולת ועבודה קשה")
## Warning: `legend.margin` must be specified using `margin()`
## i For the old behavior use `legend.spacing`

Q13 <- as.data.frame(
  new_data %>%
    group_by(Q13) %>%
    summarize(N = n()) %>%
    mutate(freq = N / sum(N)) %>%
    na.omit() 
)

Q13_merged <- 
  Q13 %>%
  mutate(Q13 = case_when(Q13 %in% c("1","2") ~ "1",
                        Q13 %in% "3" ~ "2",
                        Q13 %in% c("4","5") ~ "3"))



ggplot(Q13_merged) +
  geom_bar(aes(factor(x=Q13), y=N), stat="identity")+
  scale_x_discrete(labels = c("פסימי ופסימי מאוד", "לא פסימי ולא אופטימי" ,"אופטימי ואופטימי מאוד"))+
  theme(strip.text = element_text(size=24),
        axis.text = element_text(size =12),
        axis.line = element_line(colour = "black"),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        legend.title=element_blank(),
        legend.text=element_text(size=20),
        legend.position='bottom',
        legend.direction ='horizontal',
        legend.key=element_blank(),
        legend.margin = unit(0.2, "line"),
        legend.key.height=unit(0.6,"line"), 
        plot.title=element_text(size=12,face="bold", hjust = 0.5),
        axis.title.x=element_text(size=24),
        axis.title.y=element_text(size=24))+
  xlab("")+
  ylab("")+
  ggtitle("באופן כללי, האם אתה אופטימי או פסימי לגבי היכולת העתידית של המשרד שבו אתה עובד\n ?לעצב ולקדם תכניות מדיניות שיענו על הצרכים של הציבור הישראלי")
## Warning: `legend.margin` must be specified using `margin()`
## i For the old behavior use `legend.spacing`

##Q13+37 - influence future
Q13_37 <- as.data.frame(
  new_data %>%
    group_by(Q13, Q37) %>%
    summarize(N = n()) %>%
    mutate(freq = N / sum(N)) %>%
    na.omit() 
)
## `summarise()` has grouped output by 'Q13'. You can override using the `.groups`
## argument.
Q13_37_merged <- 
  Q13_37 %>%
  mutate(Q13 = case_when(Q13 %in% c("1","2") ~ "1",
                        Q13 %in% "3" ~ "2",
                        Q13 %in% c("4","5") ~ "3"),
         Q37 = case_when(Q37 %in% c("1","2") ~ "1",
                        Q37 %in% c("3","4") ~ "2"))


ggplot(Q13_37_merged) +
  geom_bar(aes(x=Q13, y=N, fill = Q37), stat="identity", position=position_dodge())+
  scale_x_discrete(labels = c("פסימי ופסימי מאוד", "לא פסימי ולא אופטימי" ,"אופטימי ואופטימי מאוד")) +
  scale_fill_brewer(palette="Reds", labels=c("דרג ביניים וזוטר", "דרג בכיר ובכיר מאוד")) +
  theme(strip.text = element_text(size=24),
        axis.text = element_text(size =12),
        axis.line = element_line(colour = "black"),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        legend.title=element_blank(),
        legend.text=element_text(size=14),
        legend.position='bottom',
        legend.direction ='horizontal',
        legend.key=element_blank(),
        legend.margin = unit(0.2, "line"),
        legend.key.height=unit(0.6,"line"), 
        plot.title=element_text(size=12,face="bold", hjust = 0.5),
        axis.title.x=element_text(size=24),
        axis.title.y=element_text(size=24))+
  xlab("")+
  ylab("")+
  ggtitle("באופן כללי, האם אתה אופטימי או פסימי לגבי היכולת העתידית של המשרד שבו אתה עובד\n ?לעצב ולקדם תכניות מדיניות שיענו על הצרכים של הציבור הישראלי")
## Warning: `legend.margin` must be specified using `margin()`
## i For the old behavior use `legend.spacing`

Q13_41 <- as.data.frame(
  new_data %>%
    group_by(Q13, Q41) %>%
    summarize(N = n()) %>%
    mutate(freq = N / sum(N)) %>%
    na.omit() 
)
## `summarise()` has grouped output by 'Q13'. You can override using the `.groups`
## argument.
Q13_41_merged <- 
  Q13_41 %>%
  mutate(Q13 = case_when(Q13 %in% c("1","2") ~ "1",
                        Q13 %in% "3" ~ "2",
                        Q13 %in% c("4","5") ~ "3"),
         Q41 = case_when(Q41 %in% c("0","1") ~ "1",
                         Q41 %in% c("2","3", "4") ~ "2",
                         Q41 %in% "999" ~ "3"))


ggplot(Q13_41_merged) +
  geom_bar(aes(x=Q13, y=N, fill = Q41), stat="identity", position=position_dodge())+
  scale_x_discrete(labels = c("פסימי ופסימי מאוד", "לא פסימי ולא אופטימי" ,"אופטימי ואופטימי מאוד")) +
  scale_fill_brewer(palette="Reds", labels=c("חילוני", "דתי", "אחר")) +
  theme(strip.text = element_text(size=24),
        axis.text = element_text(size =12),
        axis.line = element_line(colour = "black"),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        legend.title=element_blank(),
        legend.text=element_text(size=14),
        legend.position='bottom',
        legend.direction ='horizontal',
        legend.key=element_blank(),
        legend.margin = unit(0.2, "line"),
        legend.key.height=unit(0.6,"line"), 
        plot.title=element_text(size=12,face="bold", hjust = 0.5),
        axis.title.x=element_text(size=24),
        axis.title.y=element_text(size=24))+
  xlab("")+
  ylab("")+
  ggtitle("באופן כללי, האם אתה אופטימי או פסימי לגבי היכולת העתידית של המשרד שבו אתה עובד\n ?לעצב ולקדם תכניות מדיניות שיענו על הצרכים של הציבור הישראלי")
## Warning: `legend.margin` must be specified using `margin()`
## i For the old behavior use `legend.spacing`

Q14 <- as.data.frame(
  new_data %>%
    group_by(Q14) %>%
    summarize(N = n()) %>%
    mutate(freq = N / sum(N)) %>%
    na.omit() 
)

Q14_merged <- 
  Q14 %>%
  mutate(Q14 = case_when(Q14 %in% c("1","2") ~ "1",
                        Q14 %in% "3" ~ "2",
                        Q14 %in% c("4","5") ~ "3"))



ggplot(Q14_merged) +
  geom_bar(aes(factor(x=Q14), y=N), stat="identity")+
  scale_x_discrete(labels = c("פסימי ופסימי מאוד", "לא פסימי ולא אופטימי" ,"אופטימי ואופטימי מאוד"))+
  theme(strip.text = element_text(size=24),
        axis.text = element_text(size =12),
        axis.line = element_line(colour = "black"),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        legend.title=element_blank(),
        legend.text=element_text(size=20),
        legend.position='bottom',
        legend.direction ='horizontal',
        legend.key=element_blank(),
        legend.margin = unit(0.2, "line"),
        legend.key.height=unit(0.6,"line"), 
        plot.title=element_text(size=12,face="bold", hjust = 0.5),
        axis.title.x=element_text(size=24),
        axis.title.y=element_text(size=24))+
  xlab("")+
  ylab("")+
  ggtitle("עד כמה אתה אופטימי או פסימי לגבי היכולת העתידית של המשרד שבו אתה עובד \n?למשוך ולשמר עובדים איכותיים")
## Warning: `legend.margin` must be specified using `margin()`
## i For the old behavior use `legend.spacing`

Q14_37 <- as.data.frame(
  new_data %>%
    group_by(Q14, Q37) %>%
    summarize(N = n()) %>%
    mutate(freq = N / sum(N)) %>%
    na.omit() 
)
## `summarise()` has grouped output by 'Q14'. You can override using the `.groups`
## argument.
Q14_37_merged <- 
  Q14_37 %>%
  mutate(Q14 = case_when(Q14 %in% c("1","2") ~ "1",
                        Q14 %in% "3" ~ "2",
                        Q14 %in% c("4","5") ~ "3"),
         Q37 = case_when(Q37 %in% c("1","2") ~ "1",
                        Q37 %in% c("3","4") ~ "2"))


ggplot(Q14_37_merged) +
  geom_bar(aes(x=Q14, y=N, fill = Q37), stat="identity", position=position_dodge())+
  scale_x_discrete(labels = c("פסימי ופסימי מאוד", "לא פסימי ולא אופטימי" ,"אופטימי ואופטימי מאוד")) +
  scale_fill_brewer(palette="Reds", labels=c("דרג ביניים וזוטר", "דרג בכיר ובכיר מאוד")) +
  theme(strip.text = element_text(size=24),
        axis.text = element_text(size =12),
        axis.line = element_line(colour = "black"),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        legend.title=element_blank(),
        legend.text=element_text(size=14),
        legend.position='bottom',
        legend.direction ='horizontal',
        legend.key=element_blank(),
        legend.margin = unit(0.2, "line"),
        legend.key.height=unit(0.6,"line"), 
        plot.title=element_text(size=12,face="bold", hjust = 0.5),
        axis.title.x=element_text(size=24),
        axis.title.y=element_text(size=24))+
  xlab("")+
  ylab("")+
      ggtitle("עד כמה אתה אופטימי או פסימי לגבי היכולת העתידית של המשרד שבו אתה עובד \n?למשוך ולשמר עובדים איכותיים")
## Warning: `legend.margin` must be specified using `margin()`
## i For the old behavior use `legend.spacing`

Q14_41 <- as.data.frame(
  new_data %>%
    group_by(Q14, Q41) %>%
    summarize(N = n()) %>%
    mutate(freq = N / sum(N)) %>%
    na.omit() 
)
## `summarise()` has grouped output by 'Q14'. You can override using the `.groups`
## argument.
Q14_41_merged <- 
  Q14_41 %>%
  mutate(Q14 = case_when(Q14 %in% c("1","2") ~ "1",
                        Q14 %in% "3" ~ "2",
                        Q14 %in% c("4","5") ~ "3"),
        Q41 = case_when(Q41 %in% c("0","1") ~ "1",
                         Q41 %in% c("2","3", "4") ~ "2",
                         Q41 %in% "999" ~ "3"))


ggplot(Q14_41_merged) +
  geom_bar(aes(x=Q14, y=N, fill = Q41), stat="identity", position=position_dodge())+
  scale_x_discrete(labels = c("פסימי ופסימי מאוד", "לא פסימי ולא אופטימי" ,"אופטימי ואופטימי מאוד")) +
  scale_fill_brewer(palette="Reds", labels=c("חילוני", "דתי", "אחר")) +
  theme(strip.text = element_text(size=24),
        axis.text = element_text(size =12),
        axis.line = element_line(colour = "black"),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        legend.title=element_blank(),
        legend.text=element_text(size=14),
        legend.position='bottom',
        legend.direction ='horizontal',
        legend.key=element_blank(),
        legend.margin = unit(0.2, "line"),
        legend.key.height=unit(0.6,"line"), 
        plot.title=element_text(size=12,face="bold", hjust = 0.5),
        axis.title.x=element_text(size=24),
        axis.title.y=element_text(size=24))+
  xlab("")+
  ylab("")+
      ggtitle("עד כמה אתה אופטימי או פסימי לגבי היכולת העתידית של המשרד שבו אתה עובד \n?למשוך ולשמר עובדים איכותיים")
## Warning: `legend.margin` must be specified using `margin()`
## i For the old behavior use `legend.spacing`

Q15 <- as.data.frame(
  new_data %>%
    group_by(Q15) %>%
    summarize(N = n()) %>%
    mutate(freq = N / sum(N)) %>%
    na.omit() 
)

Q15_merged <- 
  Q15 %>%
  mutate(Q15 = case_when(Q15 %in% c("1","2") ~ "1",
                        Q15 %in% "999" ~ "2",
                        Q15 %in% c("3","4") ~ "3"))



ggplot(Q15_merged) +
  geom_bar(aes(factor(x=Q15), y=N), stat="identity")+
  scale_x_discrete(labels = c("פסימי ופסימי מאוד", "לא פסימי ולא אופטימי" ,"אופטימי ואופטימי מאוד"))+
  theme(strip.text = element_text(size=24),
        axis.text = element_text(size =12, family="David"),
        axis.line = element_line(colour = "black"),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        legend.title=element_blank(),
        legend.text=element_text(size=20, family="David"),
        legend.position='bottom',
        legend.direction ='horizontal',
        legend.key=element_blank(),
        legend.margin = unit(0.2, "line"),
        legend.key.height=unit(0.6,"line"), 
        plot.title=element_text(size=12,face="bold", hjust = 0.5),
        axis.title.x=element_text(size=24),
        axis.title.y=element_text(size=24))+
  xlab("")+
  ylab("")+
  ggtitle("?איך אתה מרגיש לגבי מצב השלטון הדמוקרטי בישראל בעתיד הנראה לעין")
## Warning: `legend.margin` must be specified using `margin()`
## i For the old behavior use `legend.spacing`
## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family not
## found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

Q15_37 <- as.data.frame(
  new_data %>%
    group_by(Q15, Q37) %>%
    summarize(N = n()) %>%
    mutate(freq = N / sum(N)) %>%
    na.omit() 
)
## `summarise()` has grouped output by 'Q15'. You can override using the `.groups`
## argument.
Q15_37_merged <- 
  Q15_37 %>%
  mutate(Q15 = case_when(Q15 %in% c("1","2") ~ "1",
                        Q15 %in% "999" ~ "2",
                        Q15 %in% c("3","4") ~ "3"),
         Q37 = case_when(Q37 %in% c("1","2") ~ "1",
                        Q37 %in% c("3","4") ~ "2"))


ggplot(Q15_37_merged) +
  geom_bar(aes(x=Q15, y=N, fill = Q37), stat="identity", position=position_dodge())+
  scale_x_discrete(labels = c("פסימי ופסימי מאוד", "לא פסימי ולא אופטימי" ,"אופטימי ואופטימי מאוד")) +
  scale_fill_brewer(palette="Reds", labels=c("דרג ביניים וזוטר", "דרג בכיר ובכיר מאוד")) +
  theme(strip.text = element_text(size=24),
        axis.text = element_text(size =12),
        axis.line = element_line(colour = "black"),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        legend.title=element_blank(),
        legend.text=element_text(size=14),
        legend.position='bottom',
        legend.direction ='horizontal',
        legend.key=element_blank(),
        legend.margin = unit(0.2, "line"),
        legend.key.height=unit(0.6,"line"), 
        plot.title=element_text(size=12,face="bold", hjust = 0.5),
        axis.title.x=element_text(size=24),
        axis.title.y=element_text(size=24))+
  xlab("")+
  ylab("")+
    ggtitle("?איך אתה מרגיש לגבי מצב השלטון הדמוקרטי בישראל בעתיד הנראה לעין")
## Warning: `legend.margin` must be specified using `margin()`
## i For the old behavior use `legend.spacing`

Q15_41 <- as.data.frame(
  new_data %>%
    group_by(Q15, Q41) %>%
    summarize(N = n()) %>%
    mutate(freq = N / sum(N)) %>%
    na.omit() 
)
## `summarise()` has grouped output by 'Q15'. You can override using the `.groups`
## argument.
Q15_41_merged <- 
  Q15_41 %>%
  mutate(Q15 = case_when(Q15 %in% c("1","2") ~ "1",
                        Q15 %in% "999" ~ "2",
                        Q15 %in% c("3","4") ~ "3"),
         Q41 = case_when(Q41 %in% c("0","1") ~ "1",
                         Q41 %in% c("2","3", "4") ~ "2",
                         Q41 %in% "999" ~ "3"))



ggplot(Q15_41_merged) +
  geom_bar(aes(x=Q15, y=N, fill = Q41), stat="identity", position=position_dodge())+
  scale_x_discrete(labels = c("פסימי ופסימי מאוד", "לא פסימי ולא אופטימי" ,"אופטימי ואופטימי מאוד")) +
  scale_fill_brewer(palette="Reds", labels=c("חילוני", "דתי", "אחר")) +
  theme(strip.text = element_text(size=24),
        axis.text = element_text(size =12),
        axis.line = element_line(colour = "black"),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        legend.title=element_blank(),
        legend.text=element_text(size=14),
        legend.position='bottom',
        legend.direction ='horizontal',
        legend.key=element_blank(),
        legend.margin = unit(0.2, "line"),
        legend.key.height=unit(0.6,"line"), 
        plot.title=element_text(size=12,face="bold", hjust = 0.5),
        axis.title.x=element_text(size=24),
        axis.title.y=element_text(size=24))+
  xlab("")+
  ylab("")+
    ggtitle("?איך אתה מרגיש לגבי מצב השלטון הדמוקרטי בישראל בעתיד הנראה לעין")
## Warning: `legend.margin` must be specified using `margin()`
## i For the old behavior use `legend.spacing`

Q26 <- as.data.frame(
  new_data %>%
    group_by(Q26) %>%
    summarize(N = n()) %>%
    mutate(freq = N / sum(N)) %>%
    na.omit() 
)

Q26_merged <- 
  Q26 %>%
  mutate(Q26 = case_when(Q26 %in% c("1","2") ~ "1",
                        Q26 %in% "3" ~ "2",
                        Q26 %in% c("4","5") ~ "3"))



ggplot(Q26_merged) +
  geom_bar(aes(factor(x=Q26), y=N), stat="identity")+
  scale_x_discrete(labels = c("נמוכה ונמוכה מאוד", "בינונית" ,"גבוהה וגבוהה מאוד"))+
  theme(strip.text = element_text(size=24),
        axis.text = element_text(size =12),
        axis.line = element_line(colour = "black"),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        legend.title=element_blank(),
        legend.text=element_text(size=20),
        legend.position='bottom',
        legend.direction ='horizontal',
        legend.key=element_blank(),
        legend.margin = unit(0.2, "line"),
        legend.key.height=unit(0.6,"line"), 
        plot.title=element_text(size=12,face="bold", hjust = 0.5),
        axis.title.x=element_text(size=24),
        axis.title.y=element_text(size=24))+
  xlab("")+
  ylab("")+
    ggtitle("לו הייתה מוצעת לך היום משרה מחוץ לשירות המדינה ברמת שכר דומה לזו שאתה מרוויח כיום\n ?מה הסבירות שהיית בוחר לעזוב את שירות המדינה")
## Warning: `legend.margin` must be specified using `margin()`
## i For the old behavior use `legend.spacing`

Q26_37 <- as.data.frame(
  new_data %>%
    group_by(Q26, Q37) %>%
    summarize(N = n()) %>%
    mutate(freq = N / sum(N)) %>%
    na.omit() 
)
## `summarise()` has grouped output by 'Q26'. You can override using the `.groups`
## argument.
Q26_37_merged <- 
  Q26_37 %>%
  mutate(Q26 = case_when(Q26 %in% c("1","2") ~ "1",
                        Q26 %in% "3" ~ "2",
                        Q26 %in% c("4","5") ~ "3"),
         Q37 = case_when(Q37 %in% c("1","2") ~ "1",
                        Q37 %in% c("3","4") ~ "2"))

ggplot(Q26_37_merged) +
  geom_bar(aes(x=Q26, y=N, fill = Q37), stat="identity", position=position_dodge())+
  scale_x_discrete(labels = c("נמוכה ונמוכה מאוד", "בינונית" ,"גבוהה וגבוהה מאוד"))+
  scale_fill_brewer(palette="Reds", labels=c("דרג ביניים וזוטר", "דרג בכיר ובכיר מאוד")) +
  #scale_fill_discrete(palette="Reds", labels=c("דרג ביניים וזוטר", "דרג בכיר ובכיר מאוד"))+
  theme(strip.text = element_text(size=24),
        axis.text = element_text(size =12),
        axis.line = element_line(colour = "black"),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        legend.title=element_blank(),
        legend.text=element_text(size=14),
        legend.position='bottom',
        legend.direction ='horizontal',
        legend.key=element_blank(),
        legend.margin = unit(0.2, "line"),
        legend.key.height=unit(0.6,"line"), 
        plot.title=element_text(size=12,face="bold", hjust = 0.5),
        axis.title.x=element_text(size=24),
        axis.title.y=element_text(size=24))+
  xlab("")+
  ylab("")+
    ggtitle("לו הייתה מוצעת לך היום משרה מחוץ לשירות המדינה ברמת שכר דומה לזו שאתה מרוויח כיום\n ?מה הסבירות שהיית בוחר לעזוב את שירות המדינה")
## Warning: `legend.margin` must be specified using `margin()`
## i For the old behavior use `legend.spacing`

Q26_41 <- as.data.frame(
  new_data %>%
    group_by(Q26, Q41) %>%
    summarize(N = n()) %>%
    mutate(freq = N / sum(N)) %>%
    na.omit() 
)
## `summarise()` has grouped output by 'Q26'. You can override using the `.groups`
## argument.
Q26_41_merged <- 
  Q26_41 %>%
  mutate(Q26 = case_when(Q26 %in% c("1","2") ~ "1",
                        Q26 %in% "3" ~ "2",
                        Q26 %in% c("4","5") ~ "3"),
         Q41 = case_when(Q41 %in% c("0","1") ~ "1",
                         Q41 %in% c("2","3", "4") ~ "2",
                         Q41 %in% "999" ~ "3"))


ggplot(Q26_41_merged) +
  geom_bar(aes(x=Q26, y=N, fill = Q41), stat="identity", position=position_dodge())+
  scale_x_discrete(labels = c("נמוכה ונמוכה מאוד", "בינונית" ,"גבוהה וגבוהה מאוד"))+
  scale_fill_brewer(palette="Reds", labels=c("חילוני", "דתי", "אחר")) +
  theme(strip.text = element_text(size=24),
        axis.text = element_text(size =12),
        axis.line = element_line(colour = "black"),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        legend.title=element_blank(),
        legend.text=element_text(size=14),
        legend.position='bottom',
        legend.direction ='horizontal',
        legend.key=element_blank(),
        legend.margin = unit(0.2, "line"),
        legend.key.height=unit(0.6,"line"), 
        plot.title=element_text(size=12,face="bold", hjust = 0.5),
        axis.title.x=element_text(size=24),
        axis.title.y=element_text(size=24))+
  xlab("")+
  ylab("")+
    ggtitle("לו הייתה מוצעת לך היום משרה מחוץ לשירות המדינה ברמת שכר דומה לזו שאתה מרוויח כיום\n ?מה הסבירות שהיית בוחר לעזוב את שירות המדינה")
## Warning: `legend.margin` must be specified using `margin()`
## i For the old behavior use `legend.spacing`