setwd("~/Desktop/SOC 252 H1 /R studio 252/SOC_252_Project MarcoHuang")
getwd()
## [1] "/Users/marcohuang/Desktop/SOC 252 H1 /R studio 252/SOC_252_Project MarcoHuang"
packages <- c("tidyverse", "modelsummary", "forcats", "RColorBrewer", 
              "fst", "viridis", "knitr", "kableExtra", "rmarkdown", "ggridges", "viridis", "questionr") # add any you need here

new_packages <- packages[!(packages %in% installed.packages()[,"Package"])]
if(length(new_packages)) install.packages(new_packages)

lapply(packages, library, character.only = TRUE)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.3     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.0
## ✔ ggplot2   3.4.3     ✔ tibble    3.2.1
## ✔ lubridate 1.9.2     ✔ tidyr     1.3.0
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
## Loading required package: viridisLite
## 
## 
## Attaching package: 'kableExtra'
## 
## 
## The following object is masked from 'package:dplyr':
## 
##     group_rows
## [[1]]
##  [1] "lubridate" "forcats"   "stringr"   "dplyr"     "purrr"     "readr"    
##  [7] "tidyr"     "tibble"    "ggplot2"   "tidyverse" "stats"     "graphics" 
## [13] "grDevices" "utils"     "datasets"  "methods"   "base"     
## 
## [[2]]
##  [1] "modelsummary" "lubridate"    "forcats"      "stringr"      "dplyr"       
##  [6] "purrr"        "readr"        "tidyr"        "tibble"       "ggplot2"     
## [11] "tidyverse"    "stats"        "graphics"     "grDevices"    "utils"       
## [16] "datasets"     "methods"      "base"        
## 
## [[3]]
##  [1] "modelsummary" "lubridate"    "forcats"      "stringr"      "dplyr"       
##  [6] "purrr"        "readr"        "tidyr"        "tibble"       "ggplot2"     
## [11] "tidyverse"    "stats"        "graphics"     "grDevices"    "utils"       
## [16] "datasets"     "methods"      "base"        
## 
## [[4]]
##  [1] "RColorBrewer" "modelsummary" "lubridate"    "forcats"      "stringr"     
##  [6] "dplyr"        "purrr"        "readr"        "tidyr"        "tibble"      
## [11] "ggplot2"      "tidyverse"    "stats"        "graphics"     "grDevices"   
## [16] "utils"        "datasets"     "methods"      "base"        
## 
## [[5]]
##  [1] "fst"          "RColorBrewer" "modelsummary" "lubridate"    "forcats"     
##  [6] "stringr"      "dplyr"        "purrr"        "readr"        "tidyr"       
## [11] "tibble"       "ggplot2"      "tidyverse"    "stats"        "graphics"    
## [16] "grDevices"    "utils"        "datasets"     "methods"      "base"        
## 
## [[6]]
##  [1] "viridis"      "viridisLite"  "fst"          "RColorBrewer" "modelsummary"
##  [6] "lubridate"    "forcats"      "stringr"      "dplyr"        "purrr"       
## [11] "readr"        "tidyr"        "tibble"       "ggplot2"      "tidyverse"   
## [16] "stats"        "graphics"     "grDevices"    "utils"        "datasets"    
## [21] "methods"      "base"        
## 
## [[7]]
##  [1] "knitr"        "viridis"      "viridisLite"  "fst"          "RColorBrewer"
##  [6] "modelsummary" "lubridate"    "forcats"      "stringr"      "dplyr"       
## [11] "purrr"        "readr"        "tidyr"        "tibble"       "ggplot2"     
## [16] "tidyverse"    "stats"        "graphics"     "grDevices"    "utils"       
## [21] "datasets"     "methods"      "base"        
## 
## [[8]]
##  [1] "kableExtra"   "knitr"        "viridis"      "viridisLite"  "fst"         
##  [6] "RColorBrewer" "modelsummary" "lubridate"    "forcats"      "stringr"     
## [11] "dplyr"        "purrr"        "readr"        "tidyr"        "tibble"      
## [16] "ggplot2"      "tidyverse"    "stats"        "graphics"     "grDevices"   
## [21] "utils"        "datasets"     "methods"      "base"        
## 
## [[9]]
##  [1] "rmarkdown"    "kableExtra"   "knitr"        "viridis"      "viridisLite" 
##  [6] "fst"          "RColorBrewer" "modelsummary" "lubridate"    "forcats"     
## [11] "stringr"      "dplyr"        "purrr"        "readr"        "tidyr"       
## [16] "tibble"       "ggplot2"      "tidyverse"    "stats"        "graphics"    
## [21] "grDevices"    "utils"        "datasets"     "methods"      "base"        
## 
## [[10]]
##  [1] "ggridges"     "rmarkdown"    "kableExtra"   "knitr"        "viridis"     
##  [6] "viridisLite"  "fst"          "RColorBrewer" "modelsummary" "lubridate"   
## [11] "forcats"      "stringr"      "dplyr"        "purrr"        "readr"       
## [16] "tidyr"        "tibble"       "ggplot2"      "tidyverse"    "stats"       
## [21] "graphics"     "grDevices"    "utils"        "datasets"     "methods"     
## [26] "base"        
## 
## [[11]]
##  [1] "ggridges"     "rmarkdown"    "kableExtra"   "knitr"        "viridis"     
##  [6] "viridisLite"  "fst"          "RColorBrewer" "modelsummary" "lubridate"   
## [11] "forcats"      "stringr"      "dplyr"        "purrr"        "readr"       
## [16] "tidyr"        "tibble"       "ggplot2"      "tidyverse"    "stats"       
## [21] "graphics"     "grDevices"    "utils"        "datasets"     "methods"     
## [26] "base"        
## 
## [[12]]
##  [1] "questionr"    "ggridges"     "rmarkdown"    "kableExtra"   "knitr"       
##  [6] "viridis"      "viridisLite"  "fst"          "RColorBrewer" "modelsummary"
## [11] "lubridate"    "forcats"      "stringr"      "dplyr"        "purrr"       
## [16] "readr"        "tidyr"        "tibble"       "ggplot2"      "tidyverse"   
## [21] "stats"        "graphics"     "grDevices"    "utils"        "datasets"    
## [26] "methods"      "base"
ess <- read_fst("All-ESS-Data.fst")
## Mission 1
#Create tables between ess and variables of interest. Take note of what you need to clean (i.e., the 7, 8, 9, and 77, 88, 99).
france_data <- ess[ess$cntry == "FR", ]
France_stfedu <- ess %>%
  filter(cntry == "FR") %>%
  select(stfedu)
table(France_stfedu)
## stfedu
##    0    1    2    3    4    5    6    7    8    9   10   77   88 
##  660  448 1277 2159 2622 3841 2971 2641 1539  319  243   11  307
#The data needs to be clean in this place are number "77", "88" and "99".
## Mission 2 +3 
france_data <- ess[ess$cntry == "FR", ]
#https://rpubs.com/parker60/1092451
france_data <- france_data %>%
mutate(edlvmdfr = ifelse(edlvmdfr %in% c(5555, 7777, 8888, 9999), NA, edlvmdfr))
table(france_data$edlvmdfr)
## 
##    1    2    3    4    5    6    7    8    9   10   11   12   13   14   15   16 
##  882 1652 2864  374  741  171 1291  186  187   95  692   19   32   70  206  263 
##   17   18   19   20   21   22   23   24   25   26 
##   38  148   14   39  179   55   30   26   61   27
## Misson 4
datasummary_skim(france_data %>% select(stfedu, edlvmdfr))
Unique (#) Missing (%) Mean SD Min Median Max
stfedu 13 0 6.4 10.8 0.0 5.0 88.0
edlvmdfr 27 46 6.0 5.3 1.0 3.0 26.0
## Mission 5
freq(france_data$edlvmdfr)
##       n    % val%
## 1   882  4.6  8.5
## 2  1652  8.7 16.0
## 3  2864 15.0 27.7
## 4   374  2.0  3.6
## 5   741  3.9  7.2
## 6   171  0.9  1.7
## 7  1291  6.8 12.5
## 8   186  1.0  1.8
## 9   187  1.0  1.8
## 10   95  0.5  0.9
## 11  692  3.6  6.7
## 12   19  0.1  0.2
## 13   32  0.2  0.3
## 14   70  0.4  0.7
## 15  206  1.1  2.0
## 16  263  1.4  2.5
## 17   38  0.2  0.4
## 18  148  0.8  1.4
## 19   14  0.1  0.1
## 20   39  0.2  0.4
## 21  179  0.9  1.7
## 22   55  0.3  0.5
## 23   30  0.2  0.3
## 24   26  0.1  0.3
## 25   61  0.3  0.6
## 26   27  0.1  0.3
## NA 8696 45.7   NA
france_edlvmdfr <- france_data %>%
  count(edlvmdfr, name = "level of education")
france_edlvmdfr %>%
  drop_na(edlvmdfr) %>%
  select(edlvmdfr) %>%
  freq() %>%
  as.data.frame() %>%
  ggplot(aes(x=factor(rownames(.),
                     levels= c("Non scolarisé ou école primaire non achevée",
                                     "École primaire uniquement",
                                     "Certificat d'études primaires", "Scolarité suivie de la 6ème à la 3ème", "Brevet élémentaire, Brevet) d'étude du premier cycle, Brevet des collèges", "Scolarité suivie de la 2nde à la Terminale", "CAP, BEP, examen de fin d'apprentissage artisanal")), 
             y=`%`)) +
  geom_col() +
  labs(title = "Distribution of level of education",
   x = "France's month education level")

#Mission 6
table(france_data$edlvmdfr, france_data$stfedu) %>%
cprop(tab,
    digits = 1,
    total = TRUE,
    percent = FALSE, 
    drop = TRUE, 
    n = FALSE,)
##        
##         0     1     2     3     4     5     6     7     8     9     10    77   
##   1      12.7   7.9   5.0   5.5   6.6   9.7   7.6   7.9  11.0  18.9  27.1  25.0
##   2      16.8  13.9  17.2  14.8  14.5  17.9  12.7  15.7  16.8  18.9  24.1  25.0
##   3      31.8  31.3  31.9  28.3  29.2  30.6  26.7  25.2  22.8  18.4  12.0  25.0
##   4       4.3   2.8   2.1   3.1   2.6   3.9   3.6   4.8   4.1   4.9   6.8   0.0
##   5       7.5   6.0   6.0   7.6   7.9   7.2   7.8   7.8   5.6   5.4   3.8   0.0
##   6       1.2   1.2   2.0   1.2   1.5   1.0   2.0   2.3   1.7   2.7   1.5   0.0
##   7       8.7  12.3  13.3  13.3  13.6  11.2  14.3  12.3  12.0   9.7   9.8   0.0
##   8       0.6   0.8   1.5   1.8   2.1   1.9   1.4   1.9   2.6   2.7   1.5   0.0
##   9       2.3   3.6   1.5   2.1   1.5   1.5   1.7   1.7   2.9   1.1   1.5   0.0
##   10      0.9   0.4   1.1   0.8   0.9   1.0   0.7   1.4   0.5   0.0   0.8   0.0
##   11      5.8   7.1   7.6   6.9   6.8   5.6   7.6   7.0   6.5   6.5   5.3  25.0
##   12      0.3   0.0   0.3   0.1   0.3   0.1   0.2   0.2   0.1   0.5   0.0   0.0
##   13      0.3   0.0   0.1   0.6   0.6   0.1   0.4   0.2   0.1   0.0   0.8   0.0
##   14      0.9   0.0   0.6   0.3   0.8   0.4   0.8   0.9   0.9   1.1   0.0   0.0
##   15      2.0   2.8   1.5   2.6   1.6   1.6   3.0   1.8   2.0   1.1   0.8   0.0
##   16      2.0   2.8   1.8   3.6   2.9   1.7   2.6   3.1   2.7   1.6   1.5   0.0
##   17      0.0   0.0   0.4   0.2   0.4   0.1   0.5   0.6   0.6   0.0   0.0   0.0
##   18      0.0   2.8   1.8   2.1   1.0   0.9   1.4   1.3   2.1   2.2   2.3   0.0
##   19      0.0   0.4   0.0   0.2   0.2   0.0   0.2   0.1   0.2   0.0   0.0   0.0
##   20      0.0   1.2   0.7   0.4   0.3   0.3   0.4   0.4   0.4   0.0   0.0   0.0
##   21      0.3   0.8   1.7   1.9   2.1   1.3   1.8   2.1   2.5   2.2   0.0   0.0
##   22      0.6   0.8   0.4   0.5   0.7   0.5   0.6   0.5   0.5   0.0   0.0   0.0
##   23      0.3   0.0   0.6   0.3   0.3   0.3   0.4   0.1   0.4   0.0   0.0   0.0
##   24      0.3   0.4   0.3   0.2   0.3   0.2   0.4   0.2   0.1   0.5   0.0   0.0
##   25      0.6   0.8   0.4   0.8   0.6   0.4   0.9   0.5   0.4   1.1   0.0   0.0
##   26      0.0   0.0   0.0   0.5   0.4   0.1   0.3   0.1   0.5   0.5   0.8   0.0
##   Total 100.0 100.0 100.0 100.0 100.0 100.0 100.0 100.0 100.0 100.0 100.0 100.0
##        
##         88    All  
##   1      17.9   8.5
##   2      34.3  16.0
##   3      20.7  27.7
##   4       1.4   3.6
##   5       2.9   7.2
##   6       3.6   1.7
##   7       7.9  12.5
##   8       1.4   1.8
##   9       0.7   1.8
##   10      0.7   0.9
##   11      4.3   6.7
##   12      0.0   0.2
##   13      0.0   0.3
##   14      1.4   0.7
##   15      0.0   2.0
##   16      0.0   2.5
##   17      0.7   0.4
##   18      0.7   1.4
##   19      0.0   0.1
##   20      0.0   0.4
##   21      0.7   1.7
##   22      0.7   0.5
##   23      0.0   0.3
##   24      0.0   0.3
##   25      0.0   0.6
##   26      0.0   0.3
##   Total 100.0 100.0
#Mission 7
edlvmdfr <- datasummary_crosstab(edlvmdfr ~ edlvmdfr, data = france_edlvmdfr)
edlvmdfr
edlvmdfr 1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26 All
1 N 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 100.0 0.0 100.0
26 N 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
% row 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 100.0 100.0
All N 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 27
% row 3.7 3.7 3.7 3.7 3.7 3.7 3.7 3.7 3.7 3.7 3.7 3.7 3.7 3.7 3.7 3.7 3.7 3.7 3.7 3.7 3.7 3.7 3.7 3.7 3.7 3.7 100.0
#Mission 8
table(france_data$stfeco, france_data$edlvmdfr) %>%
  cprop() %>%
  as.data.frame() %>%
  filter(Var1 != "Total",
         Var2 != "ALL") %>%
  ggplot(aes(x=Var2 %>% as.character() %>% as.integer(), 
             y=Freq, 
             color=Var1)) +
  geom_line() +
  labs(title="Level of education",
       x = "Survey",
       color = "Education")
## Warning in Var2 %>% as.character() %>% as.integer(): NAs introduced by coercion

## Warning in Var2 %>% as.character() %>% as.integer(): NAs introduced by coercion
## Warning: Removed 13 rows containing missing values (`geom_line()`).

#Mission 10