Load main library

## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.5     ✓ purrr   0.3.4
## ✓ tibble  3.1.6     ✓ dplyr   1.0.8
## ✓ tidyr   1.2.0     ✓ stringr 1.4.0
## ✓ readr   2.1.2     ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()

Import the data set

social <- read_csv("data/data_process/clean_social.csv")
## Rows: 39 Columns: 10
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (7): gender, education, profession, workDuration, typeSocial, useSocial,...
## dbl (3): id, age, socialDuration
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
view(social)

We need to split data into separate variable in every observation. We will need to make composite variable to get mean score.

split <- social %>% 
  separate(typeSocial, into = c("useFacebok", "useTwitter", "useYoutube",  "uselinkedin", "useTiktok", "useSnapchat", "useInstagram"), sep = ",", extra = "drop", fill = "right")
social <- split %>% 
  select(gender, useFacebok, useTwitter, useYoutube, uselinkedin, useTiktok, useSnapchat, useInstagram)

Check variable split

head(social)
## # A tibble: 6 × 8
##   gender useFacebok useTwitter useYoutube uselinkedin useTiktok useSnapchat
##   <chr>  <chr>      <chr>      <chr>      <chr>       <chr>     <chr>      
## 1 male   facebook   twitter    youtube    <NA>        <NA>      <NA>       
## 2 male   facebook   youtube    tiktok     snapchat    <NA>      <NA>       
## 3 female facebook   twitter    linkedin   tiktok      snapchat  youtube    
## 4 male   facebook   twitter    youtube    <NA>        <NA>      <NA>       
## 5 male   facebook   youtube    tiktok     snapchat    <NA>      <NA>       
## 6 female facebook   twitter    linkedin   tiktok      snapchat  youtube    
## # … with 1 more variable: useInstagram <chr>