Variable Selection and Data Preparation Tutorial πŸ“Š

Selecting Variables, Scoring Scales, and Preparing Data Types

Author

Catalina Canizares

Introduction 🎯

This tutorial will guide you through the essential steps of selecting variables for your research analysis and preparing them properly. We’ll learn how to:

  • ⭐ Read data file

  • πŸ” Select specific variables from your dataset using tidyverse

  • πŸ“ Score multi-item scales (like the loneliness scale)

Let’s get started! πŸš€

Setting Up Your Environment πŸ“š

First, let’s load the necessary packages:

# Load required packages
library(tidyverse) # for data manipulation (select, mutate, etc.)
library(haven) # for reading SPSS files

Opening Your Dataset

Reading SPSS Files with haven

The haven package is excellent for reading files from statistical software like SPSS, Stata, and SAS. Here’s how to read our SPSS dataset:

  • Be sure your data folder name data

  • Be sure you have the class data set data.sav file into your data folder

If you followed the project tutorial, your file path for open data set will be look like

# Read the dataset
data <- read_sav("data/data.sav")

# πŸ“ NOTE: Your file path will be different if your data folder and data file have a different name!!
# This path works for this tutorial, but in your own projects you'll need to:
# - Update the path to match where YOUR data file is located
# - Or place your data file in your project folder and use: read_sav(here("your_data_file.sav"))

Quick Data Overview with glimpse()

The glimpse() function provides a quick overview of your dataset structure:

# Get a quick glimpse of the data structure
glimpse(data)
Rows: 200
Columns: 357
$ ID                          <chr> "P0001", "P0002", "P0003", "P0004", "P0005…
$ sex                         <dbl+lbl> 2, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1,…
$ gender_identity             <dbl+lbl> 1, 2, 1, 1, 1, 3, 2, 3, 2, 1, 2, 2, 1,…
$ sexual_orientation          <dbl+lbl> 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 2, 3, 1,…
$ age                         <dbl> 19, 18, 21, 21, 20, 19, 19, 22, 18, 20, 21…
$ race_ethnicity              <dbl+lbl> 1, 1, 2, 5, 1, 3, 2, 3, 1, 3, 1, 1, 1,…
$ year_in_school              <dbl+lbl> 3, 3, 4, 3, 2, 4, 1, 3, 4, 1, 4, 5, 4,…
$ income                      <dbl> 5, 4, 3, 5, 5, NA, 1, 1, 5, 1, 4, 5, 3, 5,…
$ greeklife                   <dbl> 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, …
$ intstatus                   <dbl> 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, …
$ environment                 <dbl> 2, 3, 2, 3, 3, 3, 2, 2, 3, 3, 3, 3, 3, 2, …
$ gen                         <dbl> 5, 1, 4, 1, 1, 1, 1, 2, 2, 5, 3, 5, 3, 1, …
$ dass_1                      <dbl> 2, 3, 3, 1, 2, 0, 0, 1, 1, 2, 1, 3, 1, 2, …
$ dass_2                      <dbl> 0, 2, 1, 0, 1, 1, 2, 3, 1, 0, 0, 0, 0, 2, …
$ dass_3                      <dbl> 2, 3, 1, 0, 1, 0, 0, 1, 0, 0, 2, 0, 1, 1, …
$ dass_4                      <dbl> 2, 2, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 2, …
$ dass_5                      <dbl> 2, 2, 3, 1, 1, 0, 1, 2, 0, 2, 3, 2, 2, 2, …
$ dass_6                      <dbl> 1, 2, 0, 2, 1, 1, 0, 1, 1, 1, 0, 3, 1, 2, …
$ dass_7                      <dbl> 3, 1, 0, 0, 0, 0, 1, 3, 1, 0, 0, 0, 0, 2, …
$ dass_8                      <dbl> 2, 2, 2, 1, 3, 1, 0, 2, 1, 2, 2, 2, 0, 1, …
$ dass_9                      <dbl> 0, 2, 2, 1, 1, 1, 0, 1, 1, 0, 2, 2, 0, 1, …
$ dass_10                     <dbl> 1, 2, 0, 0, 1, 1, 0, 0, 0, 2, 2, 1, 1, 2, …
$ dass_11                     <dbl> 1, 2, 1, 2, 1, 1, 1, 2, 2, 3, 2, 2, 1, 2, …
$ dass_12                     <dbl> 2, 2, 3, 1, 3, 1, 0, 2, 0, 2, 1, 3, 1, 2, …
$ dass_13                     <dbl> 1, 3, 3, 1, 1, 1, 1, 1, 0, 1, 3, 3, 1, 1, …
$ dass_14                     <dbl> 1, 1, 0, 3, 1, 2, 1, 2, 1, 1, 0, 2, 1, 0, …
$ dass_15                     <dbl> 1, 1, 1, 1, 0, 1, 0, 2, 1, 2, 0, 2, 0, 0, …
$ dass_16                     <dbl> 1, 2, 2, 1, 1, 0, 0, 1, 0, 1, 2, 1, 1, 1, …
$ dass_17                     <dbl> 0, 3, 1, 0, 0, 0, 0, 0, 0, 1, 3, 0, 1, 0, …
$ dass_18                     <dbl> 0, 1, 3, 2, 1, 0, 0, 0, 1, 2, 0, 1, 0, 0, …
$ dass_19                     <dbl> 3, 1, 0, 2, 1, 0, 0, 3, 1, 0, 0, 1, 0, 2, …
$ dass_20                     <dbl> 1, 1, 1, 1, 0, 0, 0, 3, 1, 1, 2, 0, 1, 2, …
$ dass_21                     <dbl> 1, 3, 1, 1, 1, 0, 1, 0, 0, 2, 3, 0, 0, 2, …
$ swls_1                      <dbl> 2, 3, 2, 6, 2, 5, 5, 1, 6, 3, 2, 4, 6, 5, …
$ swls_2                      <dbl> 5, 3, 4, 6, 5, 5, 4, 3, 6, 5, 2, 5, 6, 6, …
$ swls_3                      <dbl> 3, 3, 3, 6, 2, 5, 6, 3, 6, 5, 1, 4, 6, 3, …
$ swls_4                      <dbl> 6, 1, 3, 6, 3, 5, 7, 3, 6, 5, 1, 5, 6, 5, …
$ swls_5                      <dbl> 1, 1, 4, 6, 2, 5, 6, 2, 6, 4, 1, 2, 4, 1, …
$ ipip_1                      <dbl> 1, 4, 1, 1, 1, 1, 3, 2, 1, 1, 5, 3, 2, 2, …
$ ipip_2                      <dbl> 4, 4, 5, 3, 5, 3, 5, 5, 4, 5, 5, 5, 5, 5, …
$ ipip_3                      <dbl> 3, 3, 3, 5, 1, 2, 4, 1, 4, 5, 5, 2, 2, 2, …
$ ipip_4                      <dbl> 4, 4, 5, 4, 4, 4, 3, 4, 2, 4, 3, 3, 4, 4, …
$ ipip_5                      <dbl> 3, 4, 5, 5, 4, 5, 5, 5, 4, 3, 4, 5, 4, 5, …
$ ipip_6                      <dbl> 2, 2, 1, 1, 3, 4, 3, 4, 4, 4, 4, 2, 2, 2, …
$ ipip_7                      <dbl> 1, 3, 1, 4, 3, 2, 3, 1, 4, 1, 3, 2, 2, 1, …
$ ipip_8                      <dbl> 1, 3, 2, 1, 1, 1, 2, 5, 2, 1, 1, 4, 4, 4, …
$ ipip_9                      <dbl> 1, 2, 1, 3, 1, 3, 4, 1, 4, 3, 3, 2, 4, 4, …
$ ipip_10                     <dbl> 3, 2, 1, 4, 1, 1, 1, 1, 4, 5, 2, 2, 2, 1, …
$ ipip_11                     <dbl> 2, 4, 4, 1, 1, 1, 4, 2, 1, 2, 4, 4, 1, 4, …
$ ipip_12                     <dbl> 4, 4, 5, 4, 5, 5, 4, 5, 4, 5, 5, 4, 5, 4, …
$ ipip_13                     <dbl> 4, 4, 4, 5, 3, 3, 1, 3, 5, 5, 5, 3, 4, 2, …
$ ipip_14                     <dbl> 3, 4, 5, 4, 4, 3, 3, 4, 4, 4, 2, 4, 2, 2, …
$ ipip_15                     <dbl> 2, 2, 1, 3, 1, 1, 2, 1, 2, 5, 3, 2, 4, 1, …
$ ipip_16                     <dbl> 5, 2, 3, 3, 3, 4, 4, 2, 4, 5, 3, 3, 2, 1, …
$ ipip_17                     <dbl> 3, 2, 1, 4, 3, 2, 1, 1, 2, 1, 4, 2, 2, 1, …
$ ipip_18                     <dbl> 1, 2, 5, 1, 1, 3, 1, 1, 2, 1, 1, 3, 3, 2, …
$ ipip_19                     <dbl> 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 5, 5, 5, 5, …
$ ipip_20                     <dbl> 3, 2, 1, 4, 2, 3, 3, 2, 4, 2, 1, 2, 2, 2, …
$ ipip_21                     <dbl> 2, 2, 1, 1, 1, 5, 1, 1, 1, 3, 2, 1, 2, 1, …
$ brs_1                       <dbl> 3, 4, 2, 4, 1, 4, 4, 2, 4, 2, 2, 3, 2, 4, …
$ brs_2                       <dbl> 4, 3, 5, 2, 5, 3, 3, 4, 2, 5, 5, 2, 4, 2, …
$ brs_3                       <dbl> 2, 2, 2, 4, 1, 5, 4, 2, 4, 2, 2, 2, NA, 4,…
$ brs_4                       <dbl> 3, 2, 5, 2, 2, 1, 3, 4, 2, 4, 4, 2, 4, 2, …
$ brs_5                       <dbl> 3, 4, 2, 3, 5, 4, 3, 1, 4, 2, 2, 3, 2, 4, …
$ brs_6                       <dbl> 3, 2, 5, 3, 5, 1, 2, 4, 2, 4, 4, 2, 4, 2, …
$ rse_1                       <dbl> 3, 2, 2, 4, 1, 3, 3, 2, 3, 1, 2, 3, 3, 3, …
$ rse_2                       <dbl> 2, 4, 3, 1, 4, 1, 2, 3, 2, 4, 3, 3, 3, 3, …
$ rse_3                       <dbl> 3, 3, 3, 3, 3, 4, 4, 4, 3, 3, 3, 3, 3, 3, …
$ rse_4                       <dbl> 3, 3, 2, 4, 3, 4, 4, 3, 3, 2, 3, 3, 3, 3, …
$ rse_5                       <dbl> 2, 3, 2, 1, 4, 1, 1, 2, 2, 3, 3, 2, 2, 2, …
$ rse_6                       <dbl> 2, 3, 3, 3, 3, 1, 3, 3, 2, 3, 3, 2, 3, 3, …
$ rse_7                       <dbl> 3, 3, 2, 4, 4, 4, 4, 4, 3, 3, 2, 4, 3, 3, …
$ rse_8                       <dbl> 2, 4, 4, 1, 4, 1, 2, 3, 2, 4, 4, 4, 3, 2, …
$ rse_9                       <dbl> 1, 4, 4, 1, 4, 1, 1, 3, 2, 2, 4, 1, 3, 1, …
$ rse_10                      <dbl> 3, 4, 2, 4, 1, 4, 4, 2, 3, 1, 1, 3, 2, 3, …
$ mspss_1                     <dbl> 7, 5, 7, 7, 7, 4, 7, 6, 6, 7, 4, 6, 7, 7, …
$ mspss_2                     <dbl> 7, 5, 7, 7, 7, 4, 7, 6, 6, 7, 5, 6, 7, 7, …
$ mspss_3                     <dbl> 6, 3, 7, 7, 7, 6, 7, 2, 6, 5, 5, 5, 7, 6, …
$ mspss_4                     <dbl> 4, 2, 7, 7, 7, 7, 6, 2, 5, 5, 2, 6, 6, 3, …
$ mspss_5                     <dbl> 6, 5, 7, 7, 7, 3, 7, 7, 6, 7, 5, 7, 7, 7, …
$ mspss_6                     <dbl> 4, 5, 7, 6, 6, 4, 7, 6, 5, 5, 4, 7, 6, 7, …
$ mspss_7                     <dbl> 3, 4, 7, 6, 6, 1, 7, 6, 6, 5, 3, 6, 6, 7, …
$ mspss_8                     <dbl> 4, 2, 7, 7, 7, 7, 6, 2, 6, 2, 1, 4, 6, 3, …
$ mspss_9                     <dbl> 4, 5, 7, 7, 7, 4, 6, 7, 6, 5, 5, 7, 6, 7, …
$ mspss_10                    <dbl> 7, 5, 7, 7, 7, 4, 7, 4, 5, 7, 5, 7, 7, 7, …
$ mspss_11                    <dbl> 5, 4, 7, 7, 6, 4, 7, 4, 6, 6, 2, 4, 6, 5, …
$ mspss_12                    <dbl> 4, 6, 7, 6, 7, 4, 7, 7, 6, 5, 5, 6, 6, 7, …
$ grp5_oneng_1                <dbl> 2, 3, 2, 5, 3, 2, 3, 2, 4, 3, 1, 3, 1, 4, …
$ grp5_oneng_2                <dbl> 4, 4, 3, 5, 4, 3, 3, 5, 4, 4, 2, 3, 4, 4, …
$ grp5_oneng_3                <dbl> 3, 2, 1, 4, 2, 4, 2, 3, 1, 1, 1, 2, 1, 2, …
$ grp5_oneng_4                <dbl> 4, 3, 4, 3, 3, 4, 2, 5, 5, 4, 1, 3, 2, 4, …
$ grp5_oneng_5                <dbl> 5, 4, 3, 5, 5, 2, 4, 4, 5, 5, 3, 3, 2, 2, …
$ grp5_oneng_6                <dbl> 3, 3, 2, 5, 3, 4, 4, 3, 4, 4, 3, 4, 3, 4, …
$ grp5_oneng_7                <dbl> 2, 3, 1, 4, 5, 5, 3, 5, 4, 3, 2, 3, 3, 4, …
$ grp5_oneng_8                <dbl> 2, 3, 5, 2, 2, 5, 4, 5, 4, 2, 2, 3, 2, 4, …
$ grp5_oneng_9                <dbl> 1, 4, 5, 2, 1, 5, 4, 5, 2, 2, 2, 4, 2, 4, …
$ grp5_oneng_10               <dbl> 1, 4, 3, 3, 3, 5, 4, 5, 5, 3, 2, 4, 3, 4, …
$ grp5_oneng_11               <dbl> 1, 2, 1, 4, 3, 5, 3, 5, 3, 3, 1, 3, 2, 4, …
$ grp5_oneng_12               <dbl> 4, 3, 1, 3, 1, 4, 2, 2, 2, 2, 2, 4, 2, 4, …
$ grp5_oneng_13               <dbl> 4, 4, 1, 3, 1, 4, 3, 1, 3, 2, 2, 3, 2, 4, …
$ grp5_oneng_14               <dbl> 5, 4, 4, 2, 1, 4, 3, 4, 4, 3, 2, 3, 3, 3, …
$ grp5_oneng_15               <dbl> 3, 5, 4, 5, 5, 4, 4, 3, 5, 4, 3, 4, 4, 4, …
$ grp5_oneng_16               <dbl> 5, 4, 3, 5, 5, 4, 5, 4, 5, 4, 3, 4, 4, 4, …
$ grp5_oneng_17               <dbl> 5, 5, 1, 4, 2, 4, 2, 5, 5, 3, 2, 4, 2, 4, …
$ grp5_oneng_18               <dbl> 4, 3, 1, 2, 1, 2, 2, 2, 4, 2, 2, 3, 2, 4, …
$ grp5_oneng_19               <dbl> 3, 4, 3, 2, 2, 1, 2, 2, 3, 2, 1, 3, 1, 2, …
$ grp5_extra1                 <dbl> 0, 0, NA, NA, 0, 8, 0, 0, NA, 0, 0, 0, 0, …
$ grp5_extra2                 <dbl> 5, 16, NA, NA, 16, 8, 0, 16, 0, 0, 0, 0, 1…
$ grp5_extra3                 <dbl> 1, 0, NA, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 4,…
$ grp5_extra4                 <dbl> 3, 17, NA, 16, 12, 8, 16, 16, 16, 18, 16, …
$ grp11_acaden_1              <dbl> 2, 2, 1, 4, 3, 4, 1, 1, 5, 3, 1, 3, 2, 2, …
$ grp11_acaden_2              <dbl> 4, 4, 3, 2, 4, 4, 4, 5, 2, 4, 4, 4, 4, 2, …
$ grp11_acaden_3              <dbl> 4, 4, 4, 1, 4, 2, 1, 4, 4, 4, 4, 4, 4, 2, …
$ grp11_acaden_4              <dbl> 2, 4, 1, 4, 2, 2, 4, 5, 4, 2, 2, 4, 3, 4, …
$ grp11_acaden_5              <dbl> 3, 3, 2, 4, 4, 5, 1, 4, 5, 2, 2, 3, 4, 4, …
$ grp11_acaden_6              <dbl> 3, 3, 1, 4, 2, 4, 4, 5, 4, 2, 2, 3, 4, 4, …
$ grp11_acaden_7              <dbl> 4, 3, 5, 2, 4, 1, 5, 1, 1, 4, 3, 3, 3, 2, …
$ grp11_acaden_8              <dbl> 2, 2, 1, 5, 4, 5, 3, 3, 5, 2, 2, 4, 3, 4, …
$ grp11_acaden_9              <dbl> 2, 4, 5, 5, 4, 3, 4, 5, 4, 2, 2, 4, 4, 4, …
$ grp11_acaden_10             <dbl> 5, 1, 5, 2, 4, 4, 2, 5, 4, 3, 4, 3, 3, 2, …
$ grp11_acaden_11             <dbl> 5, 4, 5, 4, 4, 4, 5, 4, 1, 5, 5, 5, 5, 4, …
$ grp11_acaden_12             <dbl> 4, 3, 3, 1, 4, 1, 1, 4, 2, 5, 5, 4, 5, 4, …
$ grp11_acaden_13             <dbl> 4, 4, 5, 4, 3, 5, 4, 5, 2, 4, 4, 4, 4, 4, …
$ grp11_acaden_14             <dbl> 5, 5, 5, 4, 4, 3, 5, 5, 2, 5, 5, 5, 5, 4, …
$ grp11_acaden_15             <dbl> 2, 3, 1, 4, 4, 4, 1, 2, 4, 2, 2, 4, 3, 4, …
$ grp11_extra1                <dbl> 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, …
$ grp11_extra2                <chr> "", "", "1 year", "", "", "", "", "2 years…
$ grp3_relate_1               <dbl> 4, 4, 5, 5, 4, 3, 2, 5, 4, 4, 3, 3, 4, 5, …
$ grp3_relate_2               <dbl> 4, 3, 5, 3, 2, 3, 4, 5, 4, 2, 4, 3, 3, 5, …
$ grp3_relate_3               <dbl> 5, 2, 5, 5, 5, 3, 5, 2, 5, 5, 3, 4, 5, 4, …
$ grp3_relate_4               <dbl> 5, 4, 5, 5, 5, 3, 5, 5, 5, 5, 3, 5, 5, 5, …
$ grp3_relate_5               <dbl> 4, 4, 5, 3, 5, 3, 4, 4, 4, 4, 3, 5, 4, 5, …
$ grp3_relate_6               <dbl> 3, 4, 5, 4, 3, 3, 3, 5, 3, 4, 2, 5, 4, 5, …
$ grp3_relate_7               <dbl> 4, 4, 5, 5, 3, 2, 3, 2, 2, 2, 2, 4, 4, 5, …
$ grp3_relate_8               <dbl> 5, 4, 5, 5, 5, 3, 5, 5, 4, 4, 4, 5, 4, 4, …
$ grp3_relate_9               <dbl> 3, 3, 5, 5, 2, 2, 4, 2, 4, 4, 2, 5, 3, 4, …
$ grp3_relate_10              <dbl> 4, 2, 5, 5, 4, 2, 5, 3, 4, 3, 2, 4, 5, 4, …
$ grp3_relate_11              <dbl> 4, 3, 3, 4, 2, 2, 4, 5, 4, 2, 2, 5, 4, 4, …
$ grp3_relate_12              <dbl> 5, 2, 3, 5, 5, 2, 5, 5, 4, 2, 3, 5, 4, 4, …
$ grp3_relate_13              <dbl> 5, 3, 5, 5, 5, 2, 5, 5, 4, 5, 2, 5, 5, 5, …
$ grp3_relate_14              <dbl> 5, 4, 5, 3, 5, 2, 5, 5, 4, 4, 3, 5, 4, 5, …
$ grp3_relate_15              <dbl> 3, 3, 5, 4, 2, 4, 4, 5, 4, 3, 3, 4, 4, 4, …
$ grp3_relate_16              <dbl> 5, 4, 3, 5, 5, 2, 4, 5, 4, 3, 4, 5, 4, 4, …
$ grp3_relate_17              <dbl> 5, 3, 5, 5, 5, 2, 5, 3, 4, 5, 2, 4, 5, 5, …
$ grp3_relate_18              <dbl> 1, 3, 1, 1, 3, 4, 3, 4, 2, 2, 4, 2, 2, 2, …
$ grp3_relate_19              <dbl> 4, 3, 5, 3, 4, 2, 3, 5, 4, 3, 3, 4, 4, 4, …
$ grp3_relate_20              <dbl> 3, 3, 5, 3, 4, 2, 4, 5, 3, 4, 4, 4, 4, 5, …
$ grp6_accult_1               <dbl> 2, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, …
$ grp6_accult_2               <dbl> 3, 3, 3, 3, 2, 1, 4, 4, 3, 3, 4, 4, 3, 3, …
$ grp6_accult_3               <dbl> 4, 1, 4, 4, 4, 1, 3, 3, 3, 4, 1, 4, 1, 1, …
$ grp6_accult_4               <dbl> 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 3, 1, …
$ grp6_accult_5               <dbl> 3, 3, 3, 4, 2, 2, 2, 3, 3, 3, 4, 4, 2, 4, …
$ grp6_accult_6               <dbl> 4, 3, 2, 4, 4, 2, 4, 4, 4, 3, 3, 4, 4, 4, …
$ grp6_accult_7               <dbl> 3, 3, 4, 1, 1, 1, 3, 3, 4, 4, 4, 4, 3, 3, …
$ grp6_accult_8               <dbl> 4, 3, 1, 4, 4, 4, 3, 3, 3, 4, 1, 4, 1, 4, …
$ grp6_accult_9               <dbl> 3, 2, 1, 4, 3, 4, 3, 2, 2, 3, 1, 3, 1, 4, …
$ grp6_accult_10              <dbl> 4, 3, 1, 4, 4, 4, 3, 4, 4, 4, 2, 4, 1, 4, …
$ grp6_accult_11              <dbl> 3, 4, 4, 3, 1, 1, 3, 3, 2, 4, 4, 4, 2, 4, …
$ grp6_accult_12              <dbl> 2, 3, 1, 4, 4, 4, 2, 4, 2, 4, 2, 4, 3, 3, …
$ grp6_accult_13              <dbl> 3, 4, 4, 3, 2, 2, 4, 3, 3, 4, 4, 4, 3, 3, …
$ grp6_accult_14              <dbl> 4, 3, 1, 4, 4, 4, 4, 4, 4, 4, 1, 4, 2, 4, …
$ grp6_accult_15              <dbl> 1, 3, 1, 4, 3, 4, 1, 4, 1, 3, 1, 4, 1, 4, …
$ grp6_accult_16              <dbl> 1, 3, 1, 4, 4, 4, 4, 4, 4, 4, 2, 4, 1, 4, …
$ grp6_accult_17              <dbl> 4, 4, 4, 1, 2, 1, 4, 4, 3, 4, 4, 4, 3, 4, …
$ grp6_accult_18              <dbl> 3, 3, 1, 4, 4, 4, 4, 3, 3, 3, 3, 4, 3, 4, …
$ grp6_accult_19              <dbl> 2, 3, 4, 4, 1, 1, 1, 4, 2, 3, 4, 4, 3, 3, …
$ grp6_accult_20              <dbl> 2, 3, 2, 4, 4, 4, 3, 4, 4, 3, 2, 3, 3, 4, …
$ grp6_accult_21              <dbl> 1, 3, 2, 4, 4, 4, 4, 4, 3, 2, 3, 4, 3, 4, …
$ grp6_accult_22              <dbl> 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, …
$ grp6_accult_23              <dbl> 4, 4, 4, 1, 2, 1, 4, 4, 4, 4, 4, 4, 4, 2, …
$ grp6_accult_24              <dbl> 4, 3, 1, 4, 4, 1, 1, 2, 1, 4, 1, 4, 1, 1, …
$ grp6_accult_25              <dbl> 1, 1, 1, 4, 4, 4, 1, 1, 1, 4, 1, 3, 1, 1, …
$ grp6_accult_26              <dbl> 2, 4, 4, 1, 1, 1, 4, 3, 3, 3, 4, 4, 4, 3, …
$ grp6_accult_27              <dbl> 4, 2, 1, 4, 4, 4, 1, 3, 1, 4, 1, 4, 1, 1, …
$ grp6_accult_28              <dbl> 4, 2, 1, 4, 4, 3, 4, 2, 3, 3, 1, 4, 3, 4, …
$ grp6_accult_29              <dbl> 2, 4, 4, 4, 2, 2, 4, 4, 3, 4, 4, 3, 3, 3, …
$ grp6_accult_30              <dbl> 4, 4, 4, 3, 2, 1, 4, 3, 4, 4, 4, 4, 4, 4, …
$ grp6_accult_31              <dbl> 4, 4, 4, 3, 3, 1, 4, 4, 4, 4, 4, 4, 4, 4, …
$ grp6_accult_32              <dbl> 3, 3, 4, 1, 2, 1, 4, 2, 3, 4, 4, 4, 2, 3, …
$ grp4_healthac_1             <dbl> 4, 2, 5, 4, 4, 1, 5, 4, 4, 4, 2, 2, 3, 4, …
$ grp4_healthac_2             <dbl> 5, 4, 5, 3, 4, 1, 5, 5, 4, 4, 3, 4, 5, 4, …
$ grp4_healthac_3             <dbl> 2, 3, 1, 4, 2, 3, 3, 1, 4, 4, 4, 3, 4, 2, …
$ grp4_healthac_4             <dbl> 4, 4, 1, 1, 2, 2, 3, 1, 2, 2, 2, 3, 2, 1, …
$ grp4_healthac_5             <dbl> 2, 3, 2, 4, 2, 4, 3, 3, 2, 2, 2, 3, 2, 4, …
$ grp4_healthac_6             <dbl> 1, 4, 2, 2, 3, 4, 3, 4, 4, 2, 2, 2, 5, 4, …
$ grp4_healthac_7             <dbl> 5, 2, 5, 4, 4, 4, 1, 1, 5, 1, 5, 2, 4, 2, …
$ grp4_healthac_8             <dbl> 3, 2, 5, 2, 4, 4, 1, 2, 2, 2, 4, 3, 2, 4, …
$ grp4_healthac_9             <dbl> 3, 3, 5, 4, 4, 2, 1, 3, 4, 1, 4, 2, 2, 2, …
$ grp4_healthac_10            <dbl> 2, 3, 5, 5, 4, 2, 2, 4, 5, 3, 4, 3, 4, 4, …
$ grp4_healthac_11            <dbl> 5, 5, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4, 5, 4, …
$ grp4_healthac_12            <dbl> 5, 4, 5, 5, 4, 3, 5, 5, 3, 5, 4, 4, 3, 4, …
$ grp4_extra1_1               <dbl> 1, 3, 2, 4, 4, 3, 3, 5, 2, 2, 2, 3, 3, 4, …
$ grp4_extra1_2               <dbl> 1, 2, 1, 4, 5, 4, 3, 1, 4, 1, 2, 3, 2, 4, …
$ grp4_extra1_3               <dbl> 2, 2, 2, 5, 5, 3, 3, 3, 2, 1, 2, 2, 2, 4, …
$ grp12_sexat_1               <dbl> 2, 3, 2, 5, 2, 5, 1, 2, 3, 4, 2, 2, 2, 5, …
$ grp12_sexat_2               <dbl> 2, 3, 1, 3, 2, 5, 1, 1, 2, 3, 2, 1, 2, 4, …
$ grp12_sexat_3               <dbl> 4, 2, 2, 3, 4, 5, 3, 4, 5, 4, 2, 2, 4, 5, …
$ grp12_sexat_4               <dbl> 1, 4, 1, 3, 3, 5, 4, 1, 2, 3, 2, 3, 4, 5, …
$ grp12_sexat_5               <dbl> 3, 5, 1, 3, 3, 5, 1, 3, 2, 4, 2, 4, 5, 2, …
$ grp12_sexat_6               <dbl> 3, 4, 1, 2, 1, 5, 1, 1, 2, 4, 2, 2, 5, 1, …
$ grp12_sexat_7               <dbl> 4, 4, 4, 3, 4, 5, 5, 4, 4, 5, 1, 4, 5, 5, …
$ grp12_sexat_8               <dbl> 4, 4, 1, 2, 2, 5, 5, 2, 3, 3, 2, 4, 5, 5, …
$ grp12_sexat_9               <dbl> 3, 2, 2, 2, 2, 1, 2, 5, 2, 3, 2, 3, 4, 4, …
$ grp12_sexat_10              <dbl> 1, 2, 1, 2, 2, 3, 1, 2, 2, 4, 1, 3, 3, 1, …
$ grp12_sexat_11              <dbl> 5, 4, 1, 1, 1, 4, 1, 1, 1, 1, 1, 2, 1, 5, …
$ grp12_sexat_12              <dbl> 3, 3, 1, 1, 1, 2, 1, 2, 1, 2, 2, 3, 1, 4, …
$ grp12_sexat_13              <dbl> 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 2, 2, 1, 1, …
$ grp12_sexat_14              <dbl> 5, 2, 5, 3, 3, 5, 2, 4, 5, 3, 3, 3, 5, 4, …
$ grp12_sexat_15              <dbl> 4, 1, 5, 2, 2, 5, 2, 2, 5, 3, 3, 2, 4, 4, …
$ grp12_sexat_16              <dbl> 5, 1, 5, 1, 3, 5, 2, 1, 2, 1, 2, 2, 1, 4, …
$ grp12_sexat_17              <dbl> 2, 3, 3, 1, 3, 5, 3, 2, 5, 3, 2, 2, 4, 5, …
$ grp12_sexat_18              <dbl> 3, 2, 2, 2, 2, 5, 3, 2, 3, 1, 2, 2, 3, 4, …
$ grp12_sexat_19              <dbl> 3, 2, 1, 4, 2, 2, 1, 2, 1, 2, 1, 3, 5, 4, …
$ grp12_sexat_20              <dbl> 5, 3, 5, 2, 4, 2, 2, 5, 4, 2, 3, 3, 5, 4, …
$ grp12_sexat_21              <dbl> 4, 2, 1, 1, 2, 2, 1, 2, 2, 2, 3, 2, 5, 4, …
$ grp12_sexat_22              <dbl> 4, 4, 4, 2, 2, 1, 3, 2, 4, 4, 3, 3, 5, 2, …
$ grp12_sexat_23              <dbl> 5, 4, 2, 2, 2, 5, 4, 4, 4, 4, 3, 3, 5, 2, …
$ grp12_extra1                <dbl> 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, …
$ grp12_extra2                <dbl> 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 4, 1, 1, 2, …
$ grp13_grit_1                <dbl> 1, 3, 2, 4, 3, 1, 1, 1, 3, 5, 2, 2, 3, 3, …
$ grp13_grit_2                <dbl> 4, 3, 5, 2, 4, 1, 2, 1, 3, 4, 5, 3, 4, 3, …
$ grp13_grit_3                <dbl> 2, 2, 2, 1, 2, 3, 3, 1, 2, 4, 2, 2, 3, 2, …
$ grp13_grit_4                <dbl> 2, 2, 3, 2, 3, 2, 2, 1, 1, 3, 4, 1, 2, 2, …
$ grp13_grit_5                <dbl> 3, 2, 4, 4, 2, 4, 3, 2, 4, 4, 2, 2, 3, 4, …
$ grp13_grit_6                <dbl> 1, 3, 1, 2, 2, 5, 3, 1, 3, 3, 1, 2, 2, 2, …
$ grp13_grit_7                <dbl> 3, 3, 4, 1, 4, 2, 3, 4, 1, 2, 3, 3, 4, 2, …
$ grp13_grit_8                <dbl> 3, 3, 3, 2, 3, 1, 3, 2, 1, 2, 3, 2, 4, 2, …
$ grp10_acaself_1             <dbl> 3, 3, 3, 4, 3, 3, 4, 3, 3, 2, 1, 3, 2, 3, …
$ grp10_acaself_2             <dbl> 3, 3, 3, 4, 4, 3, 3, 2, 3, 3, 1, 3, 3, 3, …
$ grp10_acaself_3             <dbl> 1, 3, 2, 1, 1, 1, 2, 2, 3, 1, 3, 3, 2, 3, …
$ grp10_acaself_4             <dbl> 2, 3, 2, 4, 3, NA, 3, 4, 4, 4, 2, 3, 3, 3,…
$ grp10_acaself_5             <dbl> 2, 3, 4, 1, 1, NA, 2, 2, 2, 3, 4, 3, 4, 2,…
$ grp10_acaself_6             <dbl> 2, 3, 1, 4, 3, NA, 2, 3, 3, 3, 2, 3, 3, 2,…
$ grp10_acaself_7             <dbl> 3, 2, 2, 1, 2, 2, 2, 3, 2, 3, 4, 2, 4, 1, …
$ grp10_acaself_8             <dbl> 3, 2, 2, 1, 3, 1, 2, 1, 1, 4, 4, 2, 3, 1, …
$ grp10_acaself_9             <dbl> 2, 4, 3, 3, 2, 3, 2, 4, 4, 3, 2, 1, 2, 4, …
$ grp10_acaself_10            <dbl> 3, 4, 4, 2, 3, 1, 2, 3, 2, 3, 4, 3, 3, 3, …
$ grp10_extra1                <dbl> 2, 3, 3, 2, 4, 2, 3, 1, 1, 2, 2, 2, 1, 2, …
$ grp10_extra3                <dbl> 3.800, 3.700, 3.600, 3.800, 3.960, 3.880, …
$ grp2_lone_1                 <dbl> 2, 3, 3, 3, 4, 1, 2, 3, 2, 4, 4, 2, 2, 2, …
$ grp2_lone_2                 <dbl> 2, 3, 3, 3, 4, 1, 2, 4, 3, 4, 4, 3, 3, 2, …
$ grp2_lone_3                 <dbl> 3, 3, 3, 3, 4, 1, 3, 3, 3, 4, 4, 4, 3, 2, …
$ grp2_extra1                 <dbl> 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, …
$ grp1_soccon_1               <dbl> 3, 3, 4, 1, 3, 1, 2, 4, 2, 4, 4, 2, 1, 1, …
$ grp1_soccon_2               <dbl> 3, 4, 4, 1, 3, 3, 2, 1, 2, 4, 5, 3, 2, 1, …
$ grp1_soccon_3               <dbl> 3, 4, 4, 2, 3, 3, 2, 2, 2, 4, 5, 2, 1, 1, …
$ grp1_soccon_4               <dbl> 3, 3, 5, 2, 5, 4, 5, 4, 2, 3, 4, 2, 1, 1, …
$ grp1_soccon_5               <dbl> 1, 3, 3, 1, 1, 4, 1, 2, 2, 3, 4, 1, 2, 1, …
$ grp1_soccon_6               <dbl> 5, 4, 5, 1, 2, 1, 1, 4, 1, 3, 4, 1, 2, 1, …
$ grp1_soccon_7               <dbl> 1, 4, 1, 1, 3, 4, 1, 1, 1, 2, 4, 2, 2, 1, …
$ grp1_soccon_8               <dbl> 1, 3, 1, 1, 2, 3, 1, 3, 1, 3, 2, 2, 1, 1, …
$ grp1_extra1                 <dbl> 0.0, 4.0, 12.0, 3.5, 10.0, 0.5, 3.0, 6.0, …
$ grp7_helpseek_1             <dbl> 7, 5, 7, 7, 1, 1, 7, 1, 4, 7, 4, 7, 7, 6, …
$ grp7_helpseek_2             <dbl> 4, 6, 7, 5, 6, 4, 4, 7, 6, 6, 5, 7, 5, 7, …
$ grp7_helpseek_3             <dbl> 7, 1, 7, 5, 6, 5, 6, 2, 7, 3, 1, 4, 2, 2, …
$ grp7_helpseek_4             <dbl> 4, 3, 7, 1, 6, 6, 3, 1, 1, 2, 1, 1, 3, 2, …
$ grp7_helpseek_5             <dbl> 4, 7, 6, 4, 6, 2, 4, 7, 3, 5, 5, 1, 6, 2, …
$ grp7_helpseek_6             <dbl> 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, …
$ grp7_helpseek_7             <dbl> 4, 4, 1, 1, 1, 1, 1, 1, 5, 1, 1, 4, 1, 2, …
$ grp7_helpseek_8             <dbl> 1, 2, 1, 1, 6, 6, 1, 3, 5, 1, 1, 4, 1, 2, …
$ grp7_helpseek_10            <dbl> 1, 5, 1, 2, 1, 7, 1, 4, 2, 4, 6, 1, 1, 1, …
$ grp14_opt_1                 <dbl> 0, 3, 1, 4, 3, 2, 2, 1, 3, 0, 0, 1, 2, 1, …
$ grp14_opt_2                 <dbl> 0, 1, 1, 3, 0, 3, 3, 0, 1, 1, 2, 1, 2, 3, …
$ grp14_opt_3                 <dbl> 2, 3, 4, 1, 1, 1, 1, 1, 3, 3, 3, 3, 2, 3, …
$ grp14_opt_4                 <dbl> 0, 3, 1, 4, 1, 3, 4, 3, 1, 1, 1, 2, 1, 1, …
$ grp14_opt_5                 <dbl> 2, 3, 4, 3, 1, 3, 4, 4, 3, 2, 3, 4, 4, 4, …
$ grp14_opt_6                 <dbl> 2, 3, 4, 3, 3, 4, 1, 4, 3, 1, 4, 4, 2, 3, …
$ grp14_opt_7                 <dbl> 1, 2, 3, 1, 1, 1, 2, 1, 3, 3, 3, 3, 1, 3, …
$ grp14_opt_8                 <dbl> 2, 1, 0, 1, 1, 3, 3, 0, 1, 1, 3, 2, 1, 3, …
$ grp14_opt_9                 <dbl> 1, 2, 3, 0, 2, 3, 1, 2, 1, 3, 3, 2, 2, 3, …
$ grp14_opt_10                <dbl> 2, 2, 1, 4, 3, 4, 3, 2, 3, 2, 1, 2, 3, 1, …
$ grp15_acamot_1              <dbl> 7, 7, 7, 4, 7, 1, 6, 6, 6, 7, 6, 2, 2, 6, …
$ grp15_acamot_2              <dbl> 2, 4, 3, 6, 7, 7, 4, 7, 6, 5, 5, 6, 1, 6, …
$ grp15_acamot_3              <dbl> 6, 7, 6, 7, 7, 1, 5, 7, 6, 2, 6, 6, 6, 6, …
$ grp15_acamot_4              <dbl> 1, 4, 1, 6, 4, 7, 1, 7, 1, 2, 4, 6, 1, 6, …
$ grp15_acamot_5              <dbl> 4, 3, 6, 1, 1, 7, 7, 1, 2, 4, 4, 1, 5, 1, …
$ grp15_acamot_6              <dbl> 1, 5, 2, 5, 2, 7, 1, 5, 3, 2, 3, 6, 1, 6, …
$ grp15_acamot_7              <dbl> 4, 6, 6, 1, 4, 1, 7, 4, 4, 3, 5, 6, 6, 6, …
$ grp15_acamot_8              <dbl> 6, 7, 6, 6, 7, 1, 4, 7, 6, 6, 4, 6, 7, 7, …
$ grp15_acamot_9              <dbl> 1, 2, 2, 6, 7, 7, 2, 7, 3, 3, 4, 7, 1, 6, …
$ grp15_acamot_10             <dbl> 6, 7, 7, 7, 7, 1, 4, 7, 5, 4, 4, 6, 7, 6, …
$ grp15_acamot_11             <dbl> 1, 1, 1, 5, 2, 7, 2, 7, 2, 1, 1, 4, 1, 3, …
$ grp15_acamot_12             <dbl> 6, 4, 7, 1, 1, 2, 7, 1, 1, 2, 5, 1, 2, 1, …
$ grp15_acamot_13             <dbl> 1, 4, 1, 4, 2, 7, 1, 7, 3, 4, 3, 4, 1, 5, …
$ grp15_acamot_14             <dbl> 1, 4, 1, 3, 7, 1, 1, 4, 6, 6, 3, 2, 4, 5, …
$ grp15_acamot_15             <dbl> 4, 7, 7, 7, 7, 1, 1, 7, 6, 2, 4, 2, 3, 7, …
$ grp15_acamot_16             <dbl> 2, 4, 4, 5, 7, 7, 2, 7, 6, 2, 4, 7, 1, 5, …
$ grp15_acamot_17             <dbl> 2, 7, 7, 5, 7, 1, 4, 7, 7, 1, 5, 6, 2, 5, …
$ grp15_acamot_18             <dbl> 1, 1, 1, 3, 2, 7, 1, 7, 2, 1, 1, 4, 1, 5, …
$ grp15_acamot_19             <dbl> 4, 1, 6, 1, 1, 2, 6, 1, 3, 2, 4, 1, 2, 1, …
$ grp15_acamot_20             <dbl> 1, 2, 1, 6, 4, 6, 1, 6, 3, 4, 4, 6, 1, 5, …
$ grp15_acamot_21             <dbl> 1, 6, 2, 6, 6, 1, 5, 2, 4, 5, 2, 4, 5, 5, …
$ grp15_acamot_22             <dbl> 7, 7, 6, 7, 7, 1, 5, 7, 6, 6, 5, 4, 6, 6, …
$ grp15_acamot_23             <dbl> 1, 2, 1, 6, 7, 7, 2, 7, 2, 2, 4, 7, 6, 6, …
$ grp15_acamot_24             <dbl> 2, 7, 7, 7, 7, 1, 1, 4, 6, 4, 3, 4, 3, 6, …
$ grp15_acamot_25             <dbl> 1, 1, 1, 4, 2, 7, 1, 7, 2, 1, 2, 4, 1, 6, …
$ grp15_acamot_26             <dbl> 2, 1, 5, 1, 1, 2, 6, 1, 2, 4, 4, 1, 1, 1, …
$ grp15_acamot_27             <dbl> 1, 7, 1, 5, 7, 7, 1, 6, 4, 2, 2, 4, 1, 5, …
$ grp15_acamot_28             <dbl> 2, 4, 4, 2, 4, 1, 1, 4, 4, 5, 4, 6, 5, 5, …
$ grp15_extra1                <dbl> 4.0, 3.6, 3.6, 3.8, 3.9, 3.9, 4.0, 2.4, 3.…
$ grp15_extra2                <dbl> 3.700, 3.590, 3.600, 4.000, 3.960, 3.880, …
$ grp15_extra3                <dbl> 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, …
$ grp9_friend_1               <dbl> 5, 3, 3, 2, 1, 1, 1, 1, 3, 4, 2, 4, 2, 4, …
$ grp9_friend_2               <dbl> 2, 3, 2, 5, 1, 1, 3, 2, 2, 2, 2, 4, 3, 4, …
$ grp9_friend_3               <dbl> 5, 4, 5, 5, 5, NA, 5, 5, 4, 5, 4, 5, 5, 4,…
$ grp9_friend_4               <dbl> 5, 4, 5, 5, 5, 2, 5, 5, 4, 5, 4, 4, 5, 4, …
$ grp9_friend_5               <dbl> 5, 5, 5, 5, 5, 2, 5, 5, 4, 5, 5, 5, 5, 4, …
$ grp9_friend_6               <dbl> 4, 5, 5, 5, 3, 3, 5, 3, 3, NA, 4, 5, 5, 4,…
$ grp9_friend_7               <dbl> 4, 4, 1, 1, 2, 1, 1, 1, 2, 3, 2, 4, 2, 4, …
$ grp9_friend_8               <dbl> 5, 4, 5, 4, 5, 3, 5, 5, 4, 4, 3, 5, 5, 4, …
$ grp9_friend_9               <dbl> 5, 5, 5, 3, 5, 3, 5, 5, 3, 5, 4, 5, 5, 4, …
$ grp9_friend_10              <dbl> 5, 5, 5, 5, 5, 3, 5, 5, 5, 4, 4, 5, 5, 4, …
$ grp9_friend_11              <dbl> 5, 3, 5, 2, 3, 1, 1, 3, 2, 4, 3, 5, 1, 4, …
$ grp9_friend_12              <dbl> 2, 3, 1, 3, 2, 1, 1, 1, 1, 1, 2, 3, 1, 1, …
$ grp9_friend_13              <dbl> 5, 4, 5, 5, 5, 4, 5, 5, 4, 5, 4, 5, 5, 4, …
$ grp9_friend_14              <dbl> 1, 3, 1, 1, 1, 1, 1, 1, 1, 2, 1, 3, 1, 1, …
$ grp9_friend_15              <dbl> 4, 4, 5, 2, 5, 2, 5, 3, 2, 3, 4, 4, 4, 4, …
$ grp9_friend_16              <dbl> 5, 4, 5, 5, 5, 2, 5, 5, 4, 4, 4, 4, 4, 4, …
$ grp9_friend_17              <dbl> 2, 3, 2, 1, 2, 2, 2, 2, 1, 2, 2, 3, 1, 2, …
$ grp9_friend_18              <dbl> 4, 4, 5, 2, 4, 4, 5, 5, 3, 3, 4, 3, 4, 5, …
$ grp9_friend_19              <dbl> 4, 4, 5, 4, 4, 4, 5, 5, 4, 4, 4, 5, 4, 5, …
$ grp9_friend_20              <dbl> 5, 5, 5, 2, 5, 5, 5, 5, 4, 5, 4, 5, 5, 5, …
$ grp9_friend_21              <dbl> 4, 4, 5, 2, 3, 5, 5, 5, 4, 5, 4, 5, 4, 5, …
$ grp9_friend_22              <dbl> 4, 4, 4, 3, 4, 5, 5, 3, 4, 5, 4, 5, 4, 5, …
$ grp9_friend_23              <dbl> 4, 4, 5, 4, 3, 4, 5, 4, 4, 4, 2, 4, 4, 5, …
$ grp9_extra1                 <dbl> 5, 4, 5, 4, 4, 5, 5, 4, 4, 5, 2, 5, 4, 4, …
$ dass_total                  <dbl> 27.537409, 40.751290, 27.679650, 21.555557…
$ dass_depression             <dbl> 8, 18, 11, 4, 6, 2, 3, 5, 0, 9, 18, 7, 7, …
$ dass_anxiety                <dbl> 10, 10, 5, 5, 3, 3, 3, 16, 7, 3, 5, 6, 2, …
$ dass_stress                 <dbl> 9, 13, 12, 12, 12, 6, 2, 10, 7, 13, 6, 16,…
$ swls_total                  <dbl> 16.328239, 11.310888, 16.400437, 29.305554…
$ ipip_total                  <dbl> 57, 64, 60, 66, 53, 61, 62, 56, 67, 66, 70…
$ ipip_extraversion           <dbl> 9.731296, 12.124355, 9.160175, 5.722222, 7…
$ ipip_agreeableness          <dbl> 12, 13, 12, 15, 16, 12, 13, 12, 14, 12, 17…
$ ipip_conscientiousness      <dbl> 8.740413, 12.103065, 14.233958, 11.402370,…
$ ipip_neuroticism            <dbl> 13.53741, 14.75129, 15.67965, 16.55556, 14…
$ ipip_openness               <dbl> 11, 10, 8, 16, 8, 10, 11, 9, 14, 15, 10, 1…
$ brs_total                   <dbl> 17.19389, 17.37307, 21.48052, 17.16666, 18…
$ rse_total                   <dbl> 23.32824, 33.31089, 27.40044, 25.30555, 30…
$ mspss_total                 <dbl> 60.59694, 51.18653, 84.24026, 80.58333, 80…
$ mspss_family                <dbl> 19, 11, 28, 28, 27, 24, 26, 10, 23, 18, 10…
$ mspss_friends               <dbl> 15, 20, 28, 25, 26, 13, 27, 26, 23, 20, 17…
$ mspss_significant_other     <dbl> 27, 20, 28, 28, 28, 15, 28, 23, 23, 28, 19…
$ academic_engagement_total   <dbl> 50.95562, 48.97786, 47.22450, 49.13093, 53…
$ academic_motivation_total   <dbl> 77.89300, 121.99831, 109.30144, 125.90156,…
$ academic_self_concept_total <dbl> 23.61518, 30.14395, 26.38783, 23.94363, 24…
$ online_engagement_total     <dbl> 61, 67, 48, 68, 52, 71, 59, 70, 72, 56, 37…
$ relationship_needs_total    <dbl> 81, 65, 90, 83, 78, 51, 82, 85, 76, 70, 58…
$ acculturation_total         <dbl> 93, 95, 78, 102, 93, 77, 96, 101, 90, 110,…
$ health_access_total         <dbl> 41, 39, 46, 43, 40, 35, 36, 38, 43, 35, 41…
$ sexual_attitudes_total      <dbl> 76, 65, 52, 51, 53, 89, 50, 55, 65, 67, 48…
$ grit_total                  <dbl> 19.21520, 20.87480, 23.99054, 17.72856, 22…
$ loneliness_total            <dbl> 7.537409, 8.751290, 8.679650, 9.555557, 12…
$ social_connectedness_total  <dbl> 20, 28, 27, 10, 22, 23, 15, 21, 13, 26, 32…
$ help_seeking_total          <dbl> 32.73130, 34.12436, 38.16017, 26.72222, 33…
$ optimism_total              <dbl> 11.19389, 23.37307, 22.48052, 23.16666, 15…
$ friendship_quality_total    <dbl> 94, 91, 94, 76, 83, 59, 90, 84, 72, 84, 76…

What glimpse() tells us:

  • Data type of each variable (chr, dbl, etc.)
  • Number of observations (rows)
  • Number of variables (columns)
  • First few values of each variable

Additional Basic Exploration Commands

Check the first few rows

# View the first 6 rows
head(data)
# A tibble: 6 Γ— 357
  ID    sex        gender_identity sexual_orientation   age race_ethnicity     
  <chr> <dbl+lbl>  <dbl+lbl>       <dbl+lbl>          <dbl> <dbl+lbl>          
1 P0001 2 [Female] 1 [Man]         2 [Gay/Lesbian]       19 1 [White]          
2 P0002 1 [Male]   2 [Woman]       2 [Gay/Lesbian]       18 1 [White]          
3 P0003 1 [Male]   1 [Man]         1 [Heterosexual]      21 2 [Hispanic/Latino]
4 P0004 1 [Male]   1 [Man]         1 [Heterosexual]      21 5 [Multiracial]    
5 P0005 1 [Male]   1 [Man]         2 [Gay/Lesbian]       20 1 [White]          
6 P0006 2 [Female] 3 [Non-binary]  1 [Heterosexual]      19 3 [Asian]          
# β„Ή 351 more variables: year_in_school <dbl+lbl>, income <dbl>,
#   greeklife <dbl>, intstatus <dbl>, environment <dbl>, gen <dbl>,
#   dass_1 <dbl>, dass_2 <dbl>, dass_3 <dbl>, dass_4 <dbl>, dass_5 <dbl>,
#   dass_6 <dbl>, dass_7 <dbl>, dass_8 <dbl>, dass_9 <dbl>, dass_10 <dbl>,
#   dass_11 <dbl>, dass_12 <dbl>, dass_13 <dbl>, dass_14 <dbl>, dass_15 <dbl>,
#   dass_16 <dbl>, dass_17 <dbl>, dass_18 <dbl>, dass_19 <dbl>, dass_20 <dbl>,
#   dass_21 <dbl>, swls_1 <dbl>, swls_2 <dbl>, swls_3 <dbl>, swls_4 <dbl>, …

Check the last few rows

# View the last 6 rows
tail(data)
# A tibble: 6 Γ— 357
  ID    sex        gender_identity sexual_orientation   age race_ethnicity
  <chr> <dbl+lbl>  <dbl+lbl>       <dbl+lbl>          <dbl> <dbl+lbl>     
1 P0195 2 [Female] 1 [Man]         1 [Heterosexual]      20 1 [White]     
2 P0196 2 [Female] 2 [Woman]       4 [Pansexual]         20 4 [Black]     
3 P0197 1 [Male]   1 [Man]         1 [Heterosexual]      21 1 [White]     
4 P0198 2 [Female] 1 [Man]         1 [Heterosexual]      20 1 [White]     
5 P0199 2 [Female] 2 [Woman]       1 [Heterosexual]      22 1 [White]     
6 P0200 2 [Female] 1 [Man]         1 [Heterosexual]      18 1 [White]     
# β„Ή 351 more variables: year_in_school <dbl+lbl>, income <dbl>,
#   greeklife <dbl>, intstatus <dbl>, environment <dbl>, gen <dbl>,
#   dass_1 <dbl>, dass_2 <dbl>, dass_3 <dbl>, dass_4 <dbl>, dass_5 <dbl>,
#   dass_6 <dbl>, dass_7 <dbl>, dass_8 <dbl>, dass_9 <dbl>, dass_10 <dbl>,
#   dass_11 <dbl>, dass_12 <dbl>, dass_13 <dbl>, dass_14 <dbl>, dass_15 <dbl>,
#   dass_16 <dbl>, dass_17 <dbl>, dass_18 <dbl>, dass_19 <dbl>, dass_20 <dbl>,
#   dass_21 <dbl>, swls_1 <dbl>, swls_2 <dbl>, swls_3 <dbl>, swls_4 <dbl>, …

Get variable names

# Get all variable names
names(data)
  [1] "ID"                          "sex"                        
  [3] "gender_identity"             "sexual_orientation"         
  [5] "age"                         "race_ethnicity"             
  [7] "year_in_school"              "income"                     
  [9] "greeklife"                   "intstatus"                  
 [11] "environment"                 "gen"                        
 [13] "dass_1"                      "dass_2"                     
 [15] "dass_3"                      "dass_4"                     
 [17] "dass_5"                      "dass_6"                     
 [19] "dass_7"                      "dass_8"                     
 [21] "dass_9"                      "dass_10"                    
 [23] "dass_11"                     "dass_12"                    
 [25] "dass_13"                     "dass_14"                    
 [27] "dass_15"                     "dass_16"                    
 [29] "dass_17"                     "dass_18"                    
 [31] "dass_19"                     "dass_20"                    
 [33] "dass_21"                     "swls_1"                     
 [35] "swls_2"                      "swls_3"                     
 [37] "swls_4"                      "swls_5"                     
 [39] "ipip_1"                      "ipip_2"                     
 [41] "ipip_3"                      "ipip_4"                     
 [43] "ipip_5"                      "ipip_6"                     
 [45] "ipip_7"                      "ipip_8"                     
 [47] "ipip_9"                      "ipip_10"                    
 [49] "ipip_11"                     "ipip_12"                    
 [51] "ipip_13"                     "ipip_14"                    
 [53] "ipip_15"                     "ipip_16"                    
 [55] "ipip_17"                     "ipip_18"                    
 [57] "ipip_19"                     "ipip_20"                    
 [59] "ipip_21"                     "brs_1"                      
 [61] "brs_2"                       "brs_3"                      
 [63] "brs_4"                       "brs_5"                      
 [65] "brs_6"                       "rse_1"                      
 [67] "rse_2"                       "rse_3"                      
 [69] "rse_4"                       "rse_5"                      
 [71] "rse_6"                       "rse_7"                      
 [73] "rse_8"                       "rse_9"                      
 [75] "rse_10"                      "mspss_1"                    
 [77] "mspss_2"                     "mspss_3"                    
 [79] "mspss_4"                     "mspss_5"                    
 [81] "mspss_6"                     "mspss_7"                    
 [83] "mspss_8"                     "mspss_9"                    
 [85] "mspss_10"                    "mspss_11"                   
 [87] "mspss_12"                    "grp5_oneng_1"               
 [89] "grp5_oneng_2"                "grp5_oneng_3"               
 [91] "grp5_oneng_4"                "grp5_oneng_5"               
 [93] "grp5_oneng_6"                "grp5_oneng_7"               
 [95] "grp5_oneng_8"                "grp5_oneng_9"               
 [97] "grp5_oneng_10"               "grp5_oneng_11"              
 [99] "grp5_oneng_12"               "grp5_oneng_13"              
[101] "grp5_oneng_14"               "grp5_oneng_15"              
[103] "grp5_oneng_16"               "grp5_oneng_17"              
[105] "grp5_oneng_18"               "grp5_oneng_19"              
[107] "grp5_extra1"                 "grp5_extra2"                
[109] "grp5_extra3"                 "grp5_extra4"                
[111] "grp11_acaden_1"              "grp11_acaden_2"             
[113] "grp11_acaden_3"              "grp11_acaden_4"             
[115] "grp11_acaden_5"              "grp11_acaden_6"             
[117] "grp11_acaden_7"              "grp11_acaden_8"             
[119] "grp11_acaden_9"              "grp11_acaden_10"            
[121] "grp11_acaden_11"             "grp11_acaden_12"            
[123] "grp11_acaden_13"             "grp11_acaden_14"            
[125] "grp11_acaden_15"             "grp11_extra1"               
[127] "grp11_extra2"                "grp3_relate_1"              
[129] "grp3_relate_2"               "grp3_relate_3"              
[131] "grp3_relate_4"               "grp3_relate_5"              
[133] "grp3_relate_6"               "grp3_relate_7"              
[135] "grp3_relate_8"               "grp3_relate_9"              
[137] "grp3_relate_10"              "grp3_relate_11"             
[139] "grp3_relate_12"              "grp3_relate_13"             
[141] "grp3_relate_14"              "grp3_relate_15"             
[143] "grp3_relate_16"              "grp3_relate_17"             
[145] "grp3_relate_18"              "grp3_relate_19"             
[147] "grp3_relate_20"              "grp6_accult_1"              
[149] "grp6_accult_2"               "grp6_accult_3"              
[151] "grp6_accult_4"               "grp6_accult_5"              
[153] "grp6_accult_6"               "grp6_accult_7"              
[155] "grp6_accult_8"               "grp6_accult_9"              
[157] "grp6_accult_10"              "grp6_accult_11"             
[159] "grp6_accult_12"              "grp6_accult_13"             
[161] "grp6_accult_14"              "grp6_accult_15"             
[163] "grp6_accult_16"              "grp6_accult_17"             
[165] "grp6_accult_18"              "grp6_accult_19"             
[167] "grp6_accult_20"              "grp6_accult_21"             
[169] "grp6_accult_22"              "grp6_accult_23"             
[171] "grp6_accult_24"              "grp6_accult_25"             
[173] "grp6_accult_26"              "grp6_accult_27"             
[175] "grp6_accult_28"              "grp6_accult_29"             
[177] "grp6_accult_30"              "grp6_accult_31"             
[179] "grp6_accult_32"              "grp4_healthac_1"            
[181] "grp4_healthac_2"             "grp4_healthac_3"            
[183] "grp4_healthac_4"             "grp4_healthac_5"            
[185] "grp4_healthac_6"             "grp4_healthac_7"            
[187] "grp4_healthac_8"             "grp4_healthac_9"            
[189] "grp4_healthac_10"            "grp4_healthac_11"           
[191] "grp4_healthac_12"            "grp4_extra1_1"              
[193] "grp4_extra1_2"               "grp4_extra1_3"              
[195] "grp12_sexat_1"               "grp12_sexat_2"              
[197] "grp12_sexat_3"               "grp12_sexat_4"              
[199] "grp12_sexat_5"               "grp12_sexat_6"              
[201] "grp12_sexat_7"               "grp12_sexat_8"              
[203] "grp12_sexat_9"               "grp12_sexat_10"             
[205] "grp12_sexat_11"              "grp12_sexat_12"             
[207] "grp12_sexat_13"              "grp12_sexat_14"             
[209] "grp12_sexat_15"              "grp12_sexat_16"             
[211] "grp12_sexat_17"              "grp12_sexat_18"             
[213] "grp12_sexat_19"              "grp12_sexat_20"             
[215] "grp12_sexat_21"              "grp12_sexat_22"             
[217] "grp12_sexat_23"              "grp12_extra1"               
[219] "grp12_extra2"                "grp13_grit_1"               
[221] "grp13_grit_2"                "grp13_grit_3"               
[223] "grp13_grit_4"                "grp13_grit_5"               
[225] "grp13_grit_6"                "grp13_grit_7"               
[227] "grp13_grit_8"                "grp10_acaself_1"            
[229] "grp10_acaself_2"             "grp10_acaself_3"            
[231] "grp10_acaself_4"             "grp10_acaself_5"            
[233] "grp10_acaself_6"             "grp10_acaself_7"            
[235] "grp10_acaself_8"             "grp10_acaself_9"            
[237] "grp10_acaself_10"            "grp10_extra1"               
[239] "grp10_extra3"                "grp2_lone_1"                
[241] "grp2_lone_2"                 "grp2_lone_3"                
[243] "grp2_extra1"                 "grp1_soccon_1"              
[245] "grp1_soccon_2"               "grp1_soccon_3"              
[247] "grp1_soccon_4"               "grp1_soccon_5"              
[249] "grp1_soccon_6"               "grp1_soccon_7"              
[251] "grp1_soccon_8"               "grp1_extra1"                
[253] "grp7_helpseek_1"             "grp7_helpseek_2"            
[255] "grp7_helpseek_3"             "grp7_helpseek_4"            
[257] "grp7_helpseek_5"             "grp7_helpseek_6"            
[259] "grp7_helpseek_7"             "grp7_helpseek_8"            
[261] "grp7_helpseek_10"            "grp14_opt_1"                
[263] "grp14_opt_2"                 "grp14_opt_3"                
[265] "grp14_opt_4"                 "grp14_opt_5"                
[267] "grp14_opt_6"                 "grp14_opt_7"                
[269] "grp14_opt_8"                 "grp14_opt_9"                
[271] "grp14_opt_10"                "grp15_acamot_1"             
[273] "grp15_acamot_2"              "grp15_acamot_3"             
[275] "grp15_acamot_4"              "grp15_acamot_5"             
[277] "grp15_acamot_6"              "grp15_acamot_7"             
[279] "grp15_acamot_8"              "grp15_acamot_9"             
[281] "grp15_acamot_10"             "grp15_acamot_11"            
[283] "grp15_acamot_12"             "grp15_acamot_13"            
[285] "grp15_acamot_14"             "grp15_acamot_15"            
[287] "grp15_acamot_16"             "grp15_acamot_17"            
[289] "grp15_acamot_18"             "grp15_acamot_19"            
[291] "grp15_acamot_20"             "grp15_acamot_21"            
[293] "grp15_acamot_22"             "grp15_acamot_23"            
[295] "grp15_acamot_24"             "grp15_acamot_25"            
[297] "grp15_acamot_26"             "grp15_acamot_27"            
[299] "grp15_acamot_28"             "grp15_extra1"               
[301] "grp15_extra2"                "grp15_extra3"               
[303] "grp9_friend_1"               "grp9_friend_2"              
[305] "grp9_friend_3"               "grp9_friend_4"              
[307] "grp9_friend_5"               "grp9_friend_6"              
[309] "grp9_friend_7"               "grp9_friend_8"              
[311] "grp9_friend_9"               "grp9_friend_10"             
[313] "grp9_friend_11"              "grp9_friend_12"             
[315] "grp9_friend_13"              "grp9_friend_14"             
[317] "grp9_friend_15"              "grp9_friend_16"             
[319] "grp9_friend_17"              "grp9_friend_18"             
[321] "grp9_friend_19"              "grp9_friend_20"             
[323] "grp9_friend_21"              "grp9_friend_22"             
[325] "grp9_friend_23"              "grp9_extra1"                
[327] "dass_total"                  "dass_depression"            
[329] "dass_anxiety"                "dass_stress"                
[331] "swls_total"                  "ipip_total"                 
[333] "ipip_extraversion"           "ipip_agreeableness"         
[335] "ipip_conscientiousness"      "ipip_neuroticism"           
[337] "ipip_openness"               "brs_total"                  
[339] "rse_total"                   "mspss_total"                
[341] "mspss_family"                "mspss_friends"              
[343] "mspss_significant_other"     "academic_engagement_total"  
[345] "academic_motivation_total"   "academic_self_concept_total"
[347] "online_engagement_total"     "relationship_needs_total"   
[349] "acculturation_total"         "health_access_total"        
[351] "sexual_attitudes_total"      "grit_total"                 
[353] "loneliness_total"            "social_connectedness_total" 
[355] "help_seeking_total"          "optimism_total"             
[357] "friendship_quality_total"   

Before starting with data, let’s review some basic concepts

Understanding dplyr Verbs and the Pipe Operator πŸ”—

Before we dive into variable selection, let’s briefly cover the key tools we’ll be using from the tidyverse package family.

The Magic of dplyr Verbs πŸͺ„

dplyr provides intuitive β€œverbs” (functions) for data manipulation:

  • select(): Choose which columns (variables) to keep

  • filter(): Choose which rows (observations) to keep

  • mutate(): Create new variables or modify existing ones

The Pipe Operator %>% πŸ”§

The pipe operator (%>%) lets you chain operations together, making your code more readable:

πŸ’‘ Read the pipe as β€œand then”:

You can get your pipe using the following key binding: - πŸ’‘ Ctrl + Shift + M (Windows/Linux) - πŸ’‘ Cmd + Shift + M (macOS)

  • data %>% select() %>% filter() = β€œtake the data AND THEN select variables AND THEN filter rows”
# Instead of nested functions (hard to read):
# result <- function3(function2(function1(data, arg1), arg2), arg3)

# We can use pipes (much clearer!):
# result <- data %>%
#   function1(arg1) %>%
#   function2(arg2) %>%
#   function3(arg3)

# Quick example with our data:
data %>%
    select(ID, grp1_extra1) %>%
    head(3)
# A tibble: 3 Γ— 2
  ID    grp1_extra1
  <chr>       <dbl>
1 P0001           0
2 P0002           4
3 P0003          12

The Assignment Arrow <- πŸ“¦

The assignment arrow (<-) creates objects in your environment:

  • Left side: The name you choose for your new object

  • Right side: The data/operations that create the object

You can get the Assignment Arrow using the following key binding:

  • πŸ’‘ Alt + - (Windows/Linux)
  • πŸ’‘ Option + - (macOS)
# You can name your cleaned data whatever makes sense to you!
my_clean_data <- data %>%
    select(ID, grp1_extra1)

# Or be more descriptive:
loneliness_study_data <- data %>%
    select(ID, starts_with("grp2_lone"))

# The name is entirely up to you - choose something meaningful!

🎯 Pro Tip: Choose object names that are:

  • Descriptive: research_data instead of data1

  • Consistent: Use either snake_case or camelCase throughout your project

  • Meaningful: Future you (and your collaborators) will thank you!

πŸ“š Want to Learn More?

For a comprehensive guide to data science in R, we highly recommend:

β€œR for Data Science” by Hadley Wickham and Garrett Grolemund

  • πŸ“– Free online: https://r4ds.had.co.nz/

  • πŸ›’ Available in print and digital formats

  • ⭐ The definitive guide to the tidyverse approach to data science

Now let’s put these tools to work! πŸ’ͺ

Step 1: Selecting Your Variables 🎯

When conducting research, you rarely use ALL variables in your dataset. Instead, you select the specific variables you need for your analysis.

Variables We Need:

  • ID: Participant identifier

  • Loneliness items: All variables starting with grp2_lone

  • Extraversion: grp1_extra1

  • International student status: intstatus

Using select() to Choose Variables

# Select our variables of interest
research_data <- data %>%
    select(
        ID, # participant ID
        starts_with("grp2_lone"), # all loneliness scale items
        grp1_extra1, # extraversion item
        intstatus # international student status
    )

# Let's see what we selected
glimpse(research_data)
Rows: 200
Columns: 6
$ ID          <chr> "P0001", "P0002", "P0003", "P0004", "P0005", "P0006", "P00…
$ grp2_lone_1 <dbl> 2, 3, 3, 3, 4, 1, 2, 3, 2, 4, 4, 2, 2, 2, 2, 1, 3, 2, 3, 2…
$ grp2_lone_2 <dbl> 2, 3, 3, 3, 4, 1, 2, 4, 3, 4, 4, 3, 3, 2, 3, 2, 3, 3, 2, 3…
$ grp2_lone_3 <dbl> 3, 3, 3, 3, 4, 1, 3, 3, 3, 4, 4, 4, 3, 2, 3, 2, 3, 3, 2, 2…
$ grp1_extra1 <dbl> 0.0, 4.0, 12.0, 3.5, 10.0, 0.5, 3.0, 6.0, 5.0, 3.0, 9.0, 7…
$ intstatus   <dbl> 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0…

Step 2: Scoring the Loneliness Scale πŸ“

Multi-item scales (like loneliness) need to be combined into a single score. We’ll create a total score by summing all the items.

Creating a Simple Sum Score

# Create loneliness total score
research_data_scored <- research_data %>%
    mutate(
        loneliness_total = grp2_lone_1 + grp2_lone_2 + grp2_lone_3, # sum items
        loneliness_mean = (grp2_lone_1 + grp2_lone_2 + grp2_lone_3)/3)  # mean item

# Check our new variable
research_data_scored %>%
    select(starts_with("grp2_lone"), loneliness_total, loneliness_mean)
# A tibble: 200 Γ— 5
   grp2_lone_1 grp2_lone_2 grp2_lone_3 loneliness_total loneliness_mean
         <dbl>       <dbl>       <dbl>            <dbl>           <dbl>
 1           2           2           3                7            2.33
 2           3           3           3                9            3   
 3           3           3           3                9            3   
 4           3           3           3                9            3   
 5           4           4           4               12            4   
 6           1           1           1                3            1   
 7           2           2           3                7            2.33
 8           3           4           3               10            3.33
 9           2           3           3                8            2.67
10           4           4           4               12            4   
# β„Ή 190 more rows

Step 3. Let’s try by your self.

  1. Identify in the codebook the items codes for the scale Anxiety scale
  2. Create a new data frame with the participants ID and the Anxiety scale items
  3. Calculate the composite score of your Anxiety scale using instructions in codebook (sum items multiply by 2)
# Example for Depression Scale
# Items: Depression: dass_3, dass_5, dass_10, dass_13, dass_16, dass_17, dass_21 then multiply by 2

data_depression <- data |> 
  select(
    ID, 
    dass_3, dass_5, dass_10, dass_13, 
    dass_16, dass_17, dass_21) |> # Select items for Depression Scale
  mutate(sum_depression = dass_3 + dass_5 + 
           dass_10 + dass_13 + 
           dass_16, + dass_17 + dass_21) |>    # Calculate sum of items  
  mutate(score_depresion = sum_depression*2)  # Calculate composite score as sum of items  by 2  

Key Takeaways 🎯

When preparing variables for analysis, always remember to:

  1. πŸ” Select only the variables you need using select() and helper functions like starts_with()

  2. πŸ”§ Check and convert data types

    • ID variables: character/text

    • Continuous scores: numeric

    • Categorical variables: factors with meaningful labels

  3. βœ… Always verify your work with glimpse(), summary(), and visual inspection

Next Steps πŸš€

Your data is now ready for analysis! You can:

  • Run descriptive statistics
  • Create visualizations
  • Conduct statistical tests
  • Build regression models

Remember: Proper data preparation is the foundation of good analysis! πŸ’ͺ


This tutorial covered the essential steps of variable selection and data preparation. Practice these steps with different datasets to become proficient in data preparation techniques.