#Source: https://t.me/rstudioprogr

library(gtExtras)
library(viridis)
library(AER)
library(svglite)
library(gt)
library(stargazer)

data("Affairs")
head(Affairs)
##    affairs gender age yearsmarried children religiousness education occupation
## 4        0   male  37        10.00       no             3        18          7
## 5        0 female  27         4.00       no             4        14          6
## 11       0 female  32        15.00      yes             1        12          1
## 16       0   male  57        15.00      yes             5        18          6
## 23       0   male  22         0.75       no             2        17          6
## 29       0 female  32         1.50       no             2        17          5
##    rating
## 4       4
## 5       4
## 11      4
## 16      5
## 23      3
## 29      5
summary(Affairs %>% dplyr::select(-affairs))
##     gender         age         yearsmarried    children  religiousness  
##  female:315   Min.   :17.50   Min.   : 0.125   no :171   Min.   :1.000  
##  male  :286   1st Qu.:27.00   1st Qu.: 4.000   yes:430   1st Qu.:2.000  
##               Median :32.00   Median : 7.000             Median :3.000  
##               Mean   :32.49   Mean   : 8.178             Mean   :3.116  
##               3rd Qu.:37.00   3rd Qu.:15.000             3rd Qu.:4.000  
##               Max.   :57.00   Max.   :15.000             Max.   :5.000  
##    education       occupation        rating     
##  Min.   : 9.00   Min.   :1.000   Min.   :1.000  
##  1st Qu.:14.00   1st Qu.:3.000   1st Qu.:3.000  
##  Median :16.00   Median :5.000   Median :4.000  
##  Mean   :16.17   Mean   :4.195   Mean   :3.932  
##  3rd Qu.:18.00   3rd Qu.:6.000   3rd Qu.:5.000  
##  Max.   :20.00   Max.   :7.000   Max.   :5.000
Affairs %>% dplyr::select(-affairs) %>% 
  gt_plt_summary()
.
601 rows x 8 cols
Column Plot Overview Missing Mean Median SD
gender female and male
2 categories 0.0% — — —
age 1857 0.0% 32.5 32.0 9.3
yearsmarried 015 0.0% 8.2 7.0 5.6
children yes and no
2 categories 0.0% — — —
religiousness 15 0.0% 3.1 3.0 1.2
education 920 0.0% 16.2 16.0 2.4
occupation 17 0.0% 4.2 5.0 1.8
rating 15 0.0% 3.9 4.0 1.1