Prepare Panel data

set.seed(8675309)
target_n <- 1000
diaryWaves <- 30
panelWaves <- 6
studyDays <- 100
studyStartDate <- as_datetime("2024-08-20 00:00:00")

Generate PIDs

# generate 1000 10-digit random string that are unique and store as a vector
set.seed(123)
# Set the target number of observations per wave


platform_pids <- replicate(1000, paste(sample(0:9, 10, replace = TRUE), collapse = ""))

library(tidyverse)
library(readr)
library(tibble)

filepath <- "raw/Platform+3+-+Panel_August+19,+2024_20.45/Platform 3 - Panel_August 19, 2024_20.45.csv"
# Step 1: Read the first row to get the column names
column_names <- read_csv(filepath, n_max = 1, col_names = FALSE) %>%
  as.character()
## Rows: 1 Columns: 172
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (172): X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15,...
## 
## ℹ 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.
# Step 2: Read the second row to get the descriptions
column_descriptions <- read_csv(filepath, skip = 1, n_max = 1, col_names = FALSE) %>%
  as.character()
## Rows: 1 Columns: 172
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (172): X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15,...
## 
## ℹ 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.
# Step 3: Read the actual data, skipping the first two rows
panel <- read_csv(filepath, skip = 3, col_names = column_names)
## Rows: 6481 Columns: 172
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (147): Status, ResponseId, DistributionChannel, problematicPlay, positi...
## dbl   (18): Progress, Duration (in seconds), psqi_1#1_1_1, psqi_1#1_1_2, psq...
## lgl    (4): Finished, UserLanguage, mctq_2_1, PID
## dttm   (3): StartDate, EndDate, RecordedDate
## 
## ℹ 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.
# Step 4: Attach descriptions as metadata (as an attribute)
attr(panel, "column_descriptions") <- column_descriptions

# Convert to tibble
panel_tibble <- as_tibble(panel)

# count how many observations are there per wave
panel_tibble %>%
  group_by(wave) %>%
  summarise(n = n())
## # A tibble: 6 × 2
##    wave     n
##   <dbl> <int>
## 1     1  1118
## 2     2  1033
## 3     3  1088
## 4     4  1084
## 5     5  1150
## 6     6  1008
library(dplyr)

# Randomly drop observations from each wave
panel_balanced <- panel_tibble %>%
  group_by(wave) %>%
  # For each wave, sample `target_n` observations without replacement
  sample_n(size = target_n)

# Verify that each wave has the correct number of observations
panel_balanced %>%
  group_by(wave) %>%
  summarise(n = n())
## # A tibble: 6 × 2
##    wave     n
##   <dbl> <int>
## 1     1  1000
## 2     2  1000
## 3     3  1000
## 4     4  1000
## 5     5  1000
## 6     6  1000

Allocate PIDs

library(dplyr)

# Create unique PIDs for each participant
platform_pids <- replicate(target_n, paste(sample(0:9, 10, replace = TRUE), collapse = ""))

# Assign PIDs using a loop
panel_balanced <- panel_balanced %>%
  arrange(wave)

for (i in 1:panelWaves) {
  # Calculate the start and end indices for each wave
  start_index <- (i - 1) * target_n + 1
  end_index <- i * target_n
  
  # Assign PIDs to each wave
  panel_balanced$PID[start_index:end_index] <- platform_pids
}

# Verify that each participant has data for each wave
panel_balanced %>%
  group_by(PID, wave) %>%
  summarise(n = n()) %>%
  ungroup() %>%
  arrange(PID, wave)
## `summarise()` has grouped output by 'PID'. You can override using the `.groups`
## argument.
## # A tibble: 6,000 × 3
##    PID         wave     n
##    <chr>      <dbl> <int>
##  1 0023430900     1     1
##  2 0023430900     2     1
##  3 0023430900     3     1
##  4 0023430900     4     1
##  5 0023430900     5     1
##  6 0023430900     6     1
##  7 0028714117     1     1
##  8 0028714117     2     1
##  9 0028714117     3     1
## 10 0028714117     4     1
## # ℹ 5,990 more rows
# Calculate the current earliest StartDate
currentEarliestDate <- min(panel_balanced$StartDate, na.rm = TRUE)

# Calculate the difference in days and round it
dateDifference <- round(as.numeric(difftime(studyStartDate, currentEarliestDate, units = "days")))

# Shift the StartDate and EndDate
panel_balanced <- panel_balanced %>%
    mutate(
        StartDate = StartDate + days(dateDifference),
        EndDate = EndDate + days(dateDifference)
    )

# Glimpse the updated tibble
glimpse(panel_balanced)
## Rows: 6,000
## Columns: 172
## Groups: wave [6]
## $ StartDate               <dttm> 2024-08-19 19:29:55, 2024-08-19 16:58:00, 202…
## $ EndDate                 <dttm> 2024-08-19 19:29:55, 2024-08-19 16:58:00, 202…
## $ Status                  <chr> "Survey Test", "Survey Test", "Survey Test", "…
## $ Progress                <dbl> 100, 100, 100, 100, 100, 100, 100, 100, 100, 1…
## $ `Duration (in seconds)` <dbl> 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0…
## $ Finished                <lgl> TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE…
## $ RecordedDate            <dttm> 2024-08-19 19:29:55, 2024-08-19 16:58:00, 202…
## $ ResponseId              <chr> "R_398hNWlAFVc0bhY", "R_eL5t8bdyLAk5gs6", "R_b…
## $ DistributionChannel     <chr> "test", "test", "test", "test", "test", "test"…
## $ UserLanguage            <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ problematicPlay         <chr> "Ullamcorper id commodo? Vel orci fringilla au…
## $ positives               <chr> "Eleifend convallis viverra! Pharetra? Bibendu…
## $ gdt_1                   <chr> "Sometimes", "Often", "Never", "Never", "Somet…
## $ gdt_2                   <chr> "Sometimes", "Never", "Very often", "Often", "…
## $ gdt_3                   <chr> "Never", "Sometimes", "Sometimes", "Never", "S…
## $ gdt_4                   <chr> "Sometimes", "Never", "Rarely", "Often", "Neve…
## $ mctq_1                  <chr> "Yes", "No", "Yes", "No", "No", "No", "Yes", "…
## $ mctq_2_1                <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ mctq_3_1                <chr> "Wisi proin? Ante. Platea vitae proin primis p…
## $ mctq_3_2                <chr> "Eu magnis commodo posuere elementum pretium u…
## $ mctq_3_3                <chr> "Convallis? Velit ultrices phasellus! Cursus m…
## $ mctq_3_4                <chr> "Imperdiet leo sed eget enim. Consequat tincid…
## $ mctq_3_5                <chr> "Est, aenean! Eu aliquet maecenas suspendisse …
## $ mctq_3_6                <chr> "Primis potenti. Metus nullam primis velit. Lu…
## $ mctq_4_1                <chr> "Yes", "No", "No", "Yes", "No", "Yes", "Yes", …
## $ mctq_5_1                <chr> "No", NA, NA, "No", NA, "No", "Yes", NA, NA, N…
## $ mctq_6_1                <chr> "Commodo primis accusamus? Sagittis justo lect…
## $ mctq_6_2                <chr> "Magna praesent sodales lectus! Tincidunt rutr…
## $ mctq_6_3                <chr> "Eros, magnis dolor venenatis accumsan dictums…
## $ mctq_6_4                <chr> "Ac, diam felis etiam eros felis quam fringill…
## $ mctq_6_5                <chr> "Quis suscipit montes orci? Nec facilisis susp…
## $ mctq_6_6                <chr> "Wisi accumsan in venenatis vivamus vivamus qu…
## $ mctq_7_1                <chr> "No", "Yes", "Yes", "Yes", "Yes", "No", "Yes",…
## $ mctq_7_2                <chr> "Yes", "No", "No", "No", "Yes", "Yes", "Yes", …
## $ mctq_8_1                <chr> "Hobbies", NA, NA, NA, "Child(ren)/pet(s)", "O…
## $ mctq_9                  <chr> NA, NA, NA, NA, NA, "Cras. Duis consequat matt…
## $ `psqi_1#1_1_1`          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `psqi_1#1_1_2`          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `psqi_1#2_1`            <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_2                  <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `psqi_3#1_1_1`          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `psqi_3#1_1_2`          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `psqi_3#2_1`            <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `psqi_4#1_1_1`          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `psqi_4#1_1_2`          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_5_1                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_5_2                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_5_3                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_5_4                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_5_5                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_5_6                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_5_7                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_5_8                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_5_9                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_5_c                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_5_cr_1             <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_6                  <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_7                  <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_8                  <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_9                  <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_10                 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_10_c_1             <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_10_c_2             <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_10_c_3             <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_10_c_4             <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_10_c_5             <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_10_c_5_TEXT        <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ eps_1_1                 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ eps_1_2                 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ eps_1_3                 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ eps_1_4                 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ eps_1_5                 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ eps_1_6                 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ eps_1_7                 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ eps_1_8                 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_1`            <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_2`            <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_3`            <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_4`            <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_5`            <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_6`            <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_7`            <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_8`            <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_9`            <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_10`           <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_11`           <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_12`           <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_13`           <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_14`           <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_15`           <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_1                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_2                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_3                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_4                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_5                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_6                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_7                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_8                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_9                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_10               <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_11               <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_12               <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_13               <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_14               <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_15               <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `selfreportPlay #1_1_1` <dbl> 1173863291, 1979751218, 69084134, 1361391656, …
## $ `selfreportPlay #1_1_2` <dbl> 671683394, 325946141, 347563313, 835508695, 56…
## $ `selfreportPlay #1_2_1` <dbl> 242698505, 382364246, 1139161226, 1285214748, …
## $ `selfreportPlay #1_2_2` <dbl> 247331248, 1380782894, 1485621744, 1069507223,…
## $ `selfreportPlay #1_3_1` <dbl> 1785196789, 2048555811, 1249458613, 574087255,…
## $ `selfreportPlay #1_3_2` <dbl> 857892698, 240732791, 1232429600, 1632874821, …
## $ recentSessions_1_1      <chr> "Arcu proin? Tempor. Leo iaculis velit nibh la…
## $ recentSessions_1_2      <chr> "Nonummy venenatis metus maecenas volutpat mat…
## $ recentSessions_1_3      <chr> "Posuere proin elit nullam vivamus atque eleif…
## $ recentSessions_1_4      <chr> "Ante! Natoque? Dapibus cursus quam potenti? O…
## $ recentSessions_2_1      <chr> "In platea proin eleifend donec lacus elementu…
## $ recentSessions_2_2      <chr> "Ullamcorper cras pellentesque consectetuer? T…
## $ recentSessions_2_3      <chr> "Tempus. Aliquam ab luctus et donec. Tempor ru…
## $ recentSessions_2_4      <chr> "Etiam dui metus nulla. Suspendisse! Iaculis d…
## $ recentSessions_3_1      <chr> "Luctus faucibus eleifend non duis. Commodo! R…
## $ recentSessions_3_2      <chr> "Odio, interdum ut purus porttitor temporibus …
## $ recentSessions_3_3      <chr> "Nunc sem? Justo sapien luctus! Accusamus aene…
## $ recentSessions_3_4      <chr> "Cursus placerat donec! Rutrum rhoncus egestas…
## $ csas                    <dbl> 5, 8, 3, 4, 9, 2, 9, 0, 9, 0, 0, 9, 9, 10, 5, …
## $ affectiveValence_1      <dbl> 31, 82, 40, 62, 4, 91, 95, 65, 88, 29, 60, 3, …
## $ wemwbs_1                <chr> "2 - Rarely", "4 - Often", "4 - Often", "4 - O…
## $ wemwbs_2                <chr> "4 - Often", "1 - None of the time", "5 - All …
## $ wemwbs_3                <chr> "5 - All of the time", "4 - Often", "4 - Often…
## $ wemwbs_4                <chr> "5 - All of the time", "2 - Rarely", "4 - Ofte…
## $ wemwbs_5                <chr> "2 - Rarely", "1 - None of the time", "2 - Rar…
## $ wemwbs_6                <chr> "3 - Some of the time", "2 - Rarely", "2 - Rar…
## $ wemwbs_7                <chr> "1 - None of the time", "3 - Some of the time"…
## $ wemwbs_attCheck_1       <chr> "3 - Some of the time", NA, "2 - Rarely", NA, …
## $ wemwbs_attCheck_2       <chr> NA, "3 - Some of the time", NA, NA, "5 - All o…
## $ wemwbs_attCheck_3       <chr> NA, NA, NA, "3 - Some of the time", NA, NA, NA…
## $ wemwbs_attCheck_4       <chr> NA, NA, NA, NA, NA, "2 - Rarely", NA, NA, NA, …
## $ wemwbs_attCheck_5       <chr> NA, NA, NA, NA, NA, NA, NA, "5 - All of the ti…
## $ wemwbs_attCheck_6       <chr> NA, NA, NA, NA, NA, NA, "1 - None of the time"…
## $ wemwbs_attCheck_7       <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ promis_1                <chr> "Never", "Never", "Never", "Sometimes", "Rarel…
## $ promis_2                <chr> "Sometimes", "Sometimes", "Never", "Never", "S…
## $ promis_3                <chr> "Often", "Rarely", "Often", "Always", "Sometim…
## $ promis_4                <chr> "Always", "Sometimes", "Often", "Often", "Some…
## $ promis_5                <chr> "Often", "Rarely", "Rarely", "Always", "Often"…
## $ promis_6                <chr> "Always", "Sometimes", "Always", "Never", "Oft…
## $ promis_7                <chr> "Always", "Often", "Never", "Often", "Rarely",…
## $ promis_8                <chr> "Rarely", "Sometimes", "Rarely", "Often", "Alw…
## $ bangs_1                 <chr> "3", "7 Strongly agree", "1 \nStrongly Disagre…
## $ bangs_2                 <chr> "5", "7 Strongly agree", "7 Strongly agree", "…
## $ bangs_3                 <chr> "2", "1 \nStrongly Disagree", "3", "4Neither A…
## $ bangs_4                 <chr> "2", "4Neither Agree nor Disagree", "6", "5", …
## $ bangs_5                 <chr> "7 Strongly agree", "1 \nStrongly Disagree", "…
## $ bangs_6                 <chr> "7 Strongly agree", "1 \nStrongly Disagree", "…
## $ bangs_7                 <chr> "4Neither Agree nor Disagree", "6", "2", "3", …
## $ bangs_8                 <chr> "1 \nStrongly Disagree", "1 \nStrongly Disagre…
## $ bangs_9                 <chr> "1 \nStrongly Disagree", "3", "1 \nStrongly Di…
## $ bangs_10                <chr> "2", "6", "6", "6", "6", "1 \nStrongly Disagre…
## $ bangs_11                <chr> "1 \nStrongly Disagree", "4Neither Agree nor D…
## $ bangs_12                <chr> "1 \nStrongly Disagree", "4Neither Agree nor D…
## $ bangs_13                <chr> "7 Strongly agree", "3", "5", "1 \nStrongly Di…
## $ bangs_14                <chr> "1 \nStrongly Disagree", "2", "2", "4Neither A…
## $ bangs_15                <chr> "7 Strongly agree", "4Neither Agree nor Disagr…
## $ bangs_16                <chr> "3", "7 Strongly agree", "3", "4Neither Agree …
## $ bangs_17                <chr> "5", "6", "7 Strongly agree", "3", "5", "4Neit…
## $ bangs_18                <chr> "6", "2", "3", "1 \nStrongly Disagree", "7 Str…
## $ displacement_1          <chr> "No impact", "Slightly supported", "Moderately…
## $ displacement_2          <chr> "Moderately supported", "Greatly supported", "…
## $ displacement_3          <chr> "Moderately supported", "Slightly interfered",…
## $ displacement_4          <chr> "Greatly supported", "Slightly interfered", "M…
## $ displacement_5          <chr> "Moderately interfered", "Moderately interfere…
## $ PID                     <chr> "7631308436", "7716144743", "7162593751", "929…
## $ wave                    <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1…
#save the data to synthetic-data as RDS
saveRDS(panel_balanced, "synthetic-data/panel_balanced.rds")

Prepare Diary data

number_of_diary_days <- diaryWaves

library(tidyverse)
library(readr)
library(tibble)

filepath <- "raw/Platform+2+-+Diary_August+19,+2024_14.19/Platform 2 - Diary_August 19, 2024_14.19.csv"
# Step 1: Read the first row to get the column names
column_names <- read_csv(filepath, n_max = 1, col_names = FALSE) %>%
  as.character()
## Rows: 1 Columns: 81
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (81): X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, ...
## 
## ℹ 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.
# Step 2: Read the second row to get the descriptions
column_descriptions <- read_csv(filepath, skip = 1, n_max = 1, col_names = FALSE) %>%
  as.character()
## Rows: 1 Columns: 81
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (81): X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, ...
## 
## ℹ 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.
# Step 3: Read the actual data, skipping the first two rows
diary <- read_csv(filepath, skip = 3, col_names = column_names)
## Rows: 2392 Columns: 81
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (41): Status, ResponseId, DistributionChannel, UserLanguage, played24hr...
## dbl  (29): Progress, Duration (in seconds), LocationLatitude, LocationLongit...
## lgl   (8): IPAddress, Finished, RecipientLastName, RecipientFirstName, Recip...
## dttm  (3): StartDate, EndDate, RecordedDate
## 
## ℹ 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.
# Step 4: Attach descriptions as metadata (as an attribute)
attr(diary, "column_descriptions") <- column_descriptions

# Convert to tibble
diary_tibble <- as_tibble(diary)

# count how many observations are there per wave
diary_tibble %>%
  group_by(wave) %>%
  summarise(n = n())
## # A tibble: 1 × 2
##   wave      n
##   <lgl> <int>
## 1 NA     2392
# Assuming you have 'panel_balanced' and 'diary_tibble' dataframes

# Get unique PIDs
unique_pids <- unique(panel_balanced$PID)

# Function to sample for a single PID
sample_for_pid <- function(pid, number_of_diary_days, diary_tibble) {
  sampled_rows <- diary_tibble[sample(nrow(diary_tibble), number_of_diary_days), ]
  sampled_rows$PID <- pid
  sampled_rows$wave <- 1:number_of_diary_days
  return(sampled_rows)
}

# Apply the function to each unique PID
sampled_data <- lapply(unique_pids, 
                      sample_for_pid, 
                      number_of_diary_days = number_of_diary_days,  # Replace with your actual value
                      diary_tibble = diary_tibble)

# Combine the results into a single dataframe
diary_tibble_sampled <- do.call(rbind, sampled_data)
# count how many observations are there per wave
diary_tibble_sampled %>%
  group_by(wave) %>%
  summarise(n = n())
## # A tibble: 30 × 2
##     wave     n
##    <int> <int>
##  1     1  1000
##  2     2  1000
##  3     3  1000
##  4     4  1000
##  5     5  1000
##  6     6  1000
##  7     7  1000
##  8     8  1000
##  9     9  1000
## 10    10  1000
## # ℹ 20 more rows
# Calculate the current earliest session start date
currentEarliestDate <- min(diary_tibble_sampled$StartDate, na.rm = TRUE)

# Calculate the difference in days
dateDifference <- round(as.numeric(difftime(studyStartDate, currentEarliestDate, units = "days")))

# Shift the sessionStart and sessionEnd dates
diary_tibble_sampled <- diary_tibble_sampled %>%
    mutate(
        StartDate = StartDate + days(dateDifference),
        EndDate = EndDate + days(dateDifference)
    )

# export the data to synthetic-data as RDS
saveRDS(diary_tibble_sampled, "synthetic-data/diary_balanced.rds")

Prepare Steam Data

library(dplyr)
library(readr)
library(progress)

# Read the steam data
number_of_days_with_steam_data<-10
number_of_steam_players <- 250
steam_filepath <- "raw/steam_updated_reshaped_file.csv" # Replace with your actual path
steam_tibble <- read_csv(steam_filepath, show_col_types = FALSE)
# filter rows where played is No
steam_tibble <- steam_tibble %>%
  filter(played == "Yes")

# Ensure steam_tibble is grouped by ID
steam_tibble_grouped <- steam_tibble %>%
  group_by(ID)

# Get unique PIDs from panel_balanced
unique_pids <- unique(panel_balanced$PID)

# Initialize an empty tibble to store the results
sampled_tibble <- tibble()

# Create a progress bar
pb <- progress_bar$new(
  format = "  Sampling [:bar] :percent in :elapsed",
  total = length(unique_pids[1:number_of_steam_players]), clear = FALSE, width = 60
)

# Iterate through each unique PID and sample 10 observations
for (pid in unique_pids[1:number_of_steam_players]) {
  # Sample 10 observations from steam_tibble for each ID
  sampled_data <- steam_tibble_grouped %>%
    group_modify(~ sample_n(.x, size = number_of_days_with_steam_data, replace = TRUE)) %>%
    mutate(
      PID = pid,
      days_since_study_start = sample(1:studyDays, size = number_of_days_with_steam_data, replace = FALSE),
      # add days_since_study_start to studyStartDate
      date = studyStartDate + days(days_since_study_start - 1)
    )
  
  # Append the sampled data to the result tibble
  sampled_tibble <- bind_rows(sampled_tibble, sampled_data)
  
  # Update the progress bar
  pb$tick()
}

# remove ID column
sampled_tibble <- sampled_tibble %>%
  select(-ID)
# rename the time column to time_hh
sampled_tibble <- sampled_tibble %>%
  rename(time_hh = time, minutes_played = minutes, game_title=Name) %>% mutate(platform = "Steam")


# Add descriptors to each column
comment(sampled_tibble$time_hh) <- "Hour of the day when the game was played/was sampled"
comment(sampled_tibble$played) <- "Indicates if a game was played (Yes/No)"
comment(sampled_tibble$genre) <- "Genre of the game the game played"
comment(sampled_tibble$minutes_played) <- "Total minutes played"
comment(sampled_tibble$AppID) <- "Unique application ID for the game within Steam"
comment(sampled_tibble$game_title) <- "Title of the game"
comment(sampled_tibble$PID) <- "Participant ID"
comment(sampled_tibble$days_since_study_start) <- "Days since the start of the study"

# repace played with logical
sampled_tibble$played <- sampled_tibble$played == "Yes"

# save the data to synthetic-data as RDS
saveRDS(sampled_tibble, "synthetic-data/steam_balanced.rds")

Prepare Nintendo Data

library(dplyr)
library(readr)
library(progress)

# Assuming panel_balanced is already loaded and contains a column named PID
# Read the Nintendo data
number_of_session_with_nintendo_data <- 10
number_of_nintendo_players <- 250
nintendo_filepath <- "raw/nintendo_telemetry.csv" # Replace with your actual path
nintendo_tibble <- read_csv(nintendo_filepath, show_col_types = FALSE)
nintendo_metadata <- read_csv("raw/nintendo_metadata.csv", show_col_types = FALSE)             

# Left join the metadata to the nintendo_tibble by NoAname == titleID, adding the genre column
nintendo_tibble <- left_join(nintendo_tibble, nintendo_metadata %>% select(NoAname, genres), by = c("titleID" = "NoAname"))

# Rename pid to id
nintendo_tibble <- nintendo_tibble %>%
    rename(id = pid)

# Create a progress bar
pb <- progress_bar$new(total = length(unique(panel_balanced$PID)))

# Initialize an empty tibble to store the results
sampled_tibble <- tibble()

nintendo_user_startindex <- 100
nintend_user_endindex <- 100 + number_of_nintendo_players

# Iterate through each unique PID in panel_balanced
for (pid in unique(panel_balanced$PID[nintendo_user_startindex:nintend_user_endindex])) {
    # Randomly sample a user from nintendo_tibble
    sampled_user <- nintendo_tibble %>%
        group_by(id) %>%
        filter(n() >= number_of_session_with_nintendo_data) %>%
        ungroup() %>%
        sample_n(1) %>%
        pull(id)
    
    # Get all sessions for the sampled user
    sampled_sessions <- nintendo_tibble %>%
        filter(id == sampled_user)
    
    # Assign the sampled sessions to the current PID
    sampled_sessions <- sampled_sessions %>%
        mutate(PID = pid) %>% select(-id)
    
    # Bind the sampled sessions to the results tibble
    sampled_tibble <- bind_rows(sampled_tibble, sampled_sessions)
    
    # Update the progress bar
    pb$tick()
}

# Rename duration to duration_min
sampled_tibble <- sampled_tibble %>%
    rename(duration_min = duration) %>% mutate(platform = "Nintendo")

# Calculate the current earliest session start date
currentEarliestDate <- min(sampled_tibble$sessionStart, na.rm = TRUE)

# Calculate the difference in days
dateDifference <- round(as.numeric(difftime(studyStartDate, currentEarliestDate, units = "days")))

# Shift the sessionStart and sessionEnd dates
sampled_tibble <- sampled_tibble %>%
    mutate(
        sessionStart = sessionStart + days(dateDifference),
        sessionEnd = sessionEnd + days(dateDifference)
    )

# Glimpse the resulting sampled tibble
glimpse(sampled_tibble)
## Rows: 171,763
## Columns: 9
## $ titleID       <chr> "Animal Crossing New Horizons", "Animal Crossing New Hor…
## $ sessionStart  <dttm> 2024-08-22 22:11:57, 2024-08-22 23:42:33, 2024-08-27 20…
## $ sessionEnd    <dttm> 2024-08-22 22:53:38, 2024-08-23 01:12:42, 2024-08-27 21…
## $ duration_min  <dbl> 41.6, 87.3, 48.6, 0.1, 0.6, 0.3, 0.5, 0.2, 24.1, 25.4, 0…
## $ deviceType    <chr> "Lite", "Lite", "Lite", "Lite", "Lite", "Lite", "Lite", …
## $ operationMode <chr> "Handheld", "Handheld", "Handheld", "Handheld", "Handhel…
## $ genres        <chr> "Simulator", "Simulator", "Simulator", "Simulator", "Pla…
## $ PID           <chr> "3578600335", "3578600335", "3578600335", "3578600335", …
## $ platform      <chr> "Nintendo", "Nintendo", "Nintendo", "Nintendo", "Nintend…
# Add comments to each column
comment(sampled_tibble$titleID) <- "The title of the game played during the session."
comment(sampled_tibble$sessionStart) <- "The start time of the gaming session."
comment(sampled_tibble$sessionEnd) <- "The end time of the gaming session."
comment(sampled_tibble$duration_min) <- "The duration of the gaming session in minutes."
comment(sampled_tibble$deviceType) <- "The type of device used for the gaming session."
comment(sampled_tibble$operationMode) <- "The mode of operation during the session (e.g., Handheld, TV Docked)."
comment(sampled_tibble$genres) <- "The genre(s) of the game played, if available."
comment(sampled_tibble$PID) <- "The unique identifier for the user in the panel."

# save the data to synthetic-data as RDS
saveRDS(sampled_tibble, "synthetic-data/nintendo_balanced.rds")

Prepare XBOX Data

# read tab delimited file oii_data_2022_07_01.txt
xbox_tibble <- read_tsv("raw/oii_data_2022_07_01.txt")
## Rows: 1239848 Columns: 7
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: "\t"
## chr (6): ParticipantId, GameId, PublisherId, Genre, SessionStartTime, Sessio...
## dbl (1): DateId
## 
## ℹ 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.
library(dplyr)
library(lubridate)

xbox_tibble <- xbox_tibble %>%
    mutate(
        DateId = ymd(as.character(DateId)),  # Convert DateId to Date
        SessionStartTime = mdy_hms(SessionStartTime),  # Convert SessionStartTime to POSIXct
        SessionEndTime = mdy_hms(SessionEndTime)       # Convert SessionEndTime to POSIXct
    )

# filter rows where either SessionStartTime or SessionEndTime is NA
xbox_tibble <- xbox_tibble %>%
    filter(!is.na(SessionStartTime) & !is.na(SessionEndTime))

# Glimpse the updated tibble
glimpse(xbox_tibble)
## Rows: 1,239,848
## Columns: 7
## $ DateId           <date> 2022-07-01, 2022-07-01, 2022-07-01, 2022-07-01, 2022…
## $ ParticipantId    <chr> "6842eeaea59642144519f01a493c8d5c4fdc989ad62dedeeb166…
## $ GameId           <chr> "0c6237b3911a21d8b3ff8acdb078fe4cb1615bcc871aaa2e5c0a…
## $ PublisherId      <chr> "b1bd7eac624b0cc432c59d6f147667a811d7c0b51050a56badcb…
## $ Genre            <chr> "Strategy", "Action + Adventure", "Action + Adventure…
## $ SessionStartTime <dttm> 2022-07-01, 2022-07-01, 2022-07-01, 2022-07-01, 2022…
## $ SessionEndTime   <dttm> 2022-07-01 00:00:00, 2022-07-01 03:45:00, 2022-07-01…
library(dplyr)
library(readr)
library(progress)

# Assuming panel_balanced is already loaded and contains a column named PID
# Read the Nintendo data
number_of_session_with_xbox_data <- 5
number_of_xbox_players <- 250


# Rename pid to id
xbox_tibble <- xbox_tibble %>%
    rename(id = ParticipantId)

# Create a progress bar
pb <- progress_bar$new(total = length(unique(panel_balanced$PID)))

# Initialize an empty tibble to store the results
sampled_tibble <- tibble()

xbox_user_startindex <- 200
xbox_user_endindex <- 200 + number_of_xbox_players

# Iterate through each unique PID in panel_balanced
for (pid in unique(panel_balanced$PID[xbox_user_startindex:xbox_user_endindex])) {
    # Randomly sample a user from xbox_tibble
    sampled_user <- xbox_tibble %>%
        group_by(id) %>%
        filter(n() >= number_of_session_with_xbox_data) %>%
        ungroup() %>%
        sample_n(1) %>%
        pull(id)
    
    # Get all sessions for the sampled user
    sampled_sessions <- xbox_tibble %>%
        filter(id == sampled_user)
    
    # Assign the sampled sessions to the current PID
    sampled_sessions <- sampled_sessions %>%
        mutate(PID = pid) %>% select(-id)
    
    # Bind the sampled sessions to the results tibble
    sampled_tibble <- bind_rows(sampled_tibble, sampled_sessions)
    
    # Update the progress bar
    pb$tick()
}

# Rename duration to duration_min
sampled_tibble <- sampled_tibble %>%
    mutate(
        duration_min = as.numeric(SessionEndTime-SessionStartTime) / 60,  # Convert duration from seconds to minutes
        platform = "XBOX"
    )

# Calculate the current earliest session start date
currentEarliestDate <- min(sampled_tibble$SessionStartTime, na.rm = TRUE)

# Calculate the difference in days
dateDifference <- round(as.numeric(difftime(studyStartDate, currentEarliestDate, units = "days")))

# Shift the sessionStart and sessionEnd dates
sampled_tibble <- sampled_tibble %>%
    mutate(
        SessionStartTime = SessionStartTime + days(dateDifference),
        SessionEndTime = SessionEndTime + days(dateDifference)
    )

# Add comments to each column
comment(sampled_tibble$DateId) <- "Month start date in the form of YYYYMMDD"
comment(sampled_tibble$GameId) <- "Hashed GameNames in case this is 3rd party titles"
comment(sampled_tibble$PublisherId) <- "Hashed Publisher name in case this is 3rd Party"
comment(sampled_tibble$Genre) <- "Primary genre of the title"
comment(sampled_tibble$SessionStartTime) <- "Session start time stamp"
comment(sampled_tibble$SessionEndTime) <- "Session end time stamp"
comment(sampled_tibble$PID) <- "Internal UserId"
comment(sampled_tibble$duration_min) <- "Duration of the session in minutes"
comment(sampled_tibble$platform) <- "Platform used for the session"


# Glimpse the resulting sampled tibble
glimpse(sampled_tibble)
## Rows: 65,290
## Columns: 9
## $ DateId           <date> 2022-07-01, 2022-07-01, 2022-07-01, 2022-07-01, 2022…
## $ GameId           <chr> "c3a689aa76b5888f49f1f26f516dca08ad2ffc6135dad75264c0…
## $ PublisherId      <chr> "c31f977d8bac2f944af095e037762e77bf01e24090ad267077ef…
## $ Genre            <chr> "Shooter", "Shooter", "Shooter", "Shooter", "Shooter"…
## $ SessionStartTime <dttm> 2024-08-20 00:00:00, 2024-08-20 00:05:00, 2024-08-20…
## $ SessionEndTime   <dttm> 2024-08-20 00:00:00, 2024-08-20 00:20:00, 2024-08-20…
## $ PID              <chr> "6876309224", "6876309224", "6876309224", "6876309224…
## $ duration_min     <dbl> 0, 15, 0, 35, 0, 120, 0, 0, 125, 0, 0, 25, 0, 0, 160,…
## $ platform         <chr> "XBOX", "XBOX", "XBOX", "XBOX", "XBOX", "XBOX", "XBOX…
# save the data to synthetic-data as RDS
saveRDS(sampled_tibble, "synthetic-data/xbox_balanced.rds")

Glimpse

# load the data
steam_tibble <- readRDS("synthetic-data/steam_balanced.rds")
nintendo_tibble <- readRDS("synthetic-data/nintendo_balanced.rds")
xbox_tibble <- readRDS("synthetic-data/xbox_balanced.rds")
panel_balanced <- readRDS("synthetic-data/panel_balanced.rds")
diary_balanced <- readRDS("synthetic-data/diary_balanced.rds")

print("Panel \n")
## [1] "Panel \n"
glimpse(panel_balanced)
## Rows: 6,000
## Columns: 172
## Groups: wave [6]
## $ StartDate               <dttm> 2024-08-19 19:29:55, 2024-08-19 16:58:00, 202…
## $ EndDate                 <dttm> 2024-08-19 19:29:55, 2024-08-19 16:58:00, 202…
## $ Status                  <chr> "Survey Test", "Survey Test", "Survey Test", "…
## $ Progress                <dbl> 100, 100, 100, 100, 100, 100, 100, 100, 100, 1…
## $ `Duration (in seconds)` <dbl> 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0…
## $ Finished                <lgl> TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE…
## $ RecordedDate            <dttm> 2024-08-19 19:29:55, 2024-08-19 16:58:00, 202…
## $ ResponseId              <chr> "R_398hNWlAFVc0bhY", "R_eL5t8bdyLAk5gs6", "R_b…
## $ DistributionChannel     <chr> "test", "test", "test", "test", "test", "test"…
## $ UserLanguage            <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ problematicPlay         <chr> "Ullamcorper id commodo? Vel orci fringilla au…
## $ positives               <chr> "Eleifend convallis viverra! Pharetra? Bibendu…
## $ gdt_1                   <chr> "Sometimes", "Often", "Never", "Never", "Somet…
## $ gdt_2                   <chr> "Sometimes", "Never", "Very often", "Often", "…
## $ gdt_3                   <chr> "Never", "Sometimes", "Sometimes", "Never", "S…
## $ gdt_4                   <chr> "Sometimes", "Never", "Rarely", "Often", "Neve…
## $ mctq_1                  <chr> "Yes", "No", "Yes", "No", "No", "No", "Yes", "…
## $ mctq_2_1                <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ mctq_3_1                <chr> "Wisi proin? Ante. Platea vitae proin primis p…
## $ mctq_3_2                <chr> "Eu magnis commodo posuere elementum pretium u…
## $ mctq_3_3                <chr> "Convallis? Velit ultrices phasellus! Cursus m…
## $ mctq_3_4                <chr> "Imperdiet leo sed eget enim. Consequat tincid…
## $ mctq_3_5                <chr> "Est, aenean! Eu aliquet maecenas suspendisse …
## $ mctq_3_6                <chr> "Primis potenti. Metus nullam primis velit. Lu…
## $ mctq_4_1                <chr> "Yes", "No", "No", "Yes", "No", "Yes", "Yes", …
## $ mctq_5_1                <chr> "No", NA, NA, "No", NA, "No", "Yes", NA, NA, N…
## $ mctq_6_1                <chr> "Commodo primis accusamus? Sagittis justo lect…
## $ mctq_6_2                <chr> "Magna praesent sodales lectus! Tincidunt rutr…
## $ mctq_6_3                <chr> "Eros, magnis dolor venenatis accumsan dictums…
## $ mctq_6_4                <chr> "Ac, diam felis etiam eros felis quam fringill…
## $ mctq_6_5                <chr> "Quis suscipit montes orci? Nec facilisis susp…
## $ mctq_6_6                <chr> "Wisi accumsan in venenatis vivamus vivamus qu…
## $ mctq_7_1                <chr> "No", "Yes", "Yes", "Yes", "Yes", "No", "Yes",…
## $ mctq_7_2                <chr> "Yes", "No", "No", "No", "Yes", "Yes", "Yes", …
## $ mctq_8_1                <chr> "Hobbies", NA, NA, NA, "Child(ren)/pet(s)", "O…
## $ mctq_9                  <chr> NA, NA, NA, NA, NA, "Cras. Duis consequat matt…
## $ `psqi_1#1_1_1`          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `psqi_1#1_1_2`          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `psqi_1#2_1`            <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_2                  <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `psqi_3#1_1_1`          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `psqi_3#1_1_2`          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `psqi_3#2_1`            <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `psqi_4#1_1_1`          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `psqi_4#1_1_2`          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_5_1                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_5_2                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_5_3                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_5_4                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_5_5                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_5_6                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_5_7                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_5_8                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_5_9                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_5_c                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_5_cr_1             <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_6                  <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_7                  <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_8                  <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_9                  <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_10                 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_10_c_1             <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_10_c_2             <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_10_c_3             <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_10_c_4             <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_10_c_5             <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ psqi_10_c_5_TEXT        <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ eps_1_1                 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ eps_1_2                 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ eps_1_3                 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ eps_1_4                 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ eps_1_5                 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ eps_1_6                 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ eps_1_7                 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ eps_1_8                 <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_1`            <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_2`            <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_3`            <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_4`            <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_5`            <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_6`            <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_7`            <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_8`            <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_9`            <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_10`           <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_11`           <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_12`           <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_13`           <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_14`           <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `BFI-2-XS_15`           <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_1                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_2                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_3                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_4                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_5                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_6                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_7                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_8                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_9                <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_10               <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_11               <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_12               <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_13               <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_14               <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ trojan_15               <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ `selfreportPlay #1_1_1` <dbl> 1173863291, 1979751218, 69084134, 1361391656, …
## $ `selfreportPlay #1_1_2` <dbl> 671683394, 325946141, 347563313, 835508695, 56…
## $ `selfreportPlay #1_2_1` <dbl> 242698505, 382364246, 1139161226, 1285214748, …
## $ `selfreportPlay #1_2_2` <dbl> 247331248, 1380782894, 1485621744, 1069507223,…
## $ `selfreportPlay #1_3_1` <dbl> 1785196789, 2048555811, 1249458613, 574087255,…
## $ `selfreportPlay #1_3_2` <dbl> 857892698, 240732791, 1232429600, 1632874821, …
## $ recentSessions_1_1      <chr> "Arcu proin? Tempor. Leo iaculis velit nibh la…
## $ recentSessions_1_2      <chr> "Nonummy venenatis metus maecenas volutpat mat…
## $ recentSessions_1_3      <chr> "Posuere proin elit nullam vivamus atque eleif…
## $ recentSessions_1_4      <chr> "Ante! Natoque? Dapibus cursus quam potenti? O…
## $ recentSessions_2_1      <chr> "In platea proin eleifend donec lacus elementu…
## $ recentSessions_2_2      <chr> "Ullamcorper cras pellentesque consectetuer? T…
## $ recentSessions_2_3      <chr> "Tempus. Aliquam ab luctus et donec. Tempor ru…
## $ recentSessions_2_4      <chr> "Etiam dui metus nulla. Suspendisse! Iaculis d…
## $ recentSessions_3_1      <chr> "Luctus faucibus eleifend non duis. Commodo! R…
## $ recentSessions_3_2      <chr> "Odio, interdum ut purus porttitor temporibus …
## $ recentSessions_3_3      <chr> "Nunc sem? Justo sapien luctus! Accusamus aene…
## $ recentSessions_3_4      <chr> "Cursus placerat donec! Rutrum rhoncus egestas…
## $ csas                    <dbl> 5, 8, 3, 4, 9, 2, 9, 0, 9, 0, 0, 9, 9, 10, 5, …
## $ affectiveValence_1      <dbl> 31, 82, 40, 62, 4, 91, 95, 65, 88, 29, 60, 3, …
## $ wemwbs_1                <chr> "2 - Rarely", "4 - Often", "4 - Often", "4 - O…
## $ wemwbs_2                <chr> "4 - Often", "1 - None of the time", "5 - All …
## $ wemwbs_3                <chr> "5 - All of the time", "4 - Often", "4 - Often…
## $ wemwbs_4                <chr> "5 - All of the time", "2 - Rarely", "4 - Ofte…
## $ wemwbs_5                <chr> "2 - Rarely", "1 - None of the time", "2 - Rar…
## $ wemwbs_6                <chr> "3 - Some of the time", "2 - Rarely", "2 - Rar…
## $ wemwbs_7                <chr> "1 - None of the time", "3 - Some of the time"…
## $ wemwbs_attCheck_1       <chr> "3 - Some of the time", NA, "2 - Rarely", NA, …
## $ wemwbs_attCheck_2       <chr> NA, "3 - Some of the time", NA, NA, "5 - All o…
## $ wemwbs_attCheck_3       <chr> NA, NA, NA, "3 - Some of the time", NA, NA, NA…
## $ wemwbs_attCheck_4       <chr> NA, NA, NA, NA, NA, "2 - Rarely", NA, NA, NA, …
## $ wemwbs_attCheck_5       <chr> NA, NA, NA, NA, NA, NA, NA, "5 - All of the ti…
## $ wemwbs_attCheck_6       <chr> NA, NA, NA, NA, NA, NA, "1 - None of the time"…
## $ wemwbs_attCheck_7       <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ promis_1                <chr> "Never", "Never", "Never", "Sometimes", "Rarel…
## $ promis_2                <chr> "Sometimes", "Sometimes", "Never", "Never", "S…
## $ promis_3                <chr> "Often", "Rarely", "Often", "Always", "Sometim…
## $ promis_4                <chr> "Always", "Sometimes", "Often", "Often", "Some…
## $ promis_5                <chr> "Often", "Rarely", "Rarely", "Always", "Often"…
## $ promis_6                <chr> "Always", "Sometimes", "Always", "Never", "Oft…
## $ promis_7                <chr> "Always", "Often", "Never", "Often", "Rarely",…
## $ promis_8                <chr> "Rarely", "Sometimes", "Rarely", "Often", "Alw…
## $ bangs_1                 <chr> "3", "7 Strongly agree", "1 \nStrongly Disagre…
## $ bangs_2                 <chr> "5", "7 Strongly agree", "7 Strongly agree", "…
## $ bangs_3                 <chr> "2", "1 \nStrongly Disagree", "3", "4Neither A…
## $ bangs_4                 <chr> "2", "4Neither Agree nor Disagree", "6", "5", …
## $ bangs_5                 <chr> "7 Strongly agree", "1 \nStrongly Disagree", "…
## $ bangs_6                 <chr> "7 Strongly agree", "1 \nStrongly Disagree", "…
## $ bangs_7                 <chr> "4Neither Agree nor Disagree", "6", "2", "3", …
## $ bangs_8                 <chr> "1 \nStrongly Disagree", "1 \nStrongly Disagre…
## $ bangs_9                 <chr> "1 \nStrongly Disagree", "3", "1 \nStrongly Di…
## $ bangs_10                <chr> "2", "6", "6", "6", "6", "1 \nStrongly Disagre…
## $ bangs_11                <chr> "1 \nStrongly Disagree", "4Neither Agree nor D…
## $ bangs_12                <chr> "1 \nStrongly Disagree", "4Neither Agree nor D…
## $ bangs_13                <chr> "7 Strongly agree", "3", "5", "1 \nStrongly Di…
## $ bangs_14                <chr> "1 \nStrongly Disagree", "2", "2", "4Neither A…
## $ bangs_15                <chr> "7 Strongly agree", "4Neither Agree nor Disagr…
## $ bangs_16                <chr> "3", "7 Strongly agree", "3", "4Neither Agree …
## $ bangs_17                <chr> "5", "6", "7 Strongly agree", "3", "5", "4Neit…
## $ bangs_18                <chr> "6", "2", "3", "1 \nStrongly Disagree", "7 Str…
## $ displacement_1          <chr> "No impact", "Slightly supported", "Moderately…
## $ displacement_2          <chr> "Moderately supported", "Greatly supported", "…
## $ displacement_3          <chr> "Moderately supported", "Slightly interfered",…
## $ displacement_4          <chr> "Greatly supported", "Slightly interfered", "M…
## $ displacement_5          <chr> "Moderately interfered", "Moderately interfere…
## $ PID                     <chr> "7631308436", "7716144743", "7162593751", "929…
## $ wave                    <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1…
print("Diary \n")
## [1] "Diary \n"
glimpse(diary_balanced)
## Rows: 30,000
## Columns: 81
## $ StartDate               <dttm> 2024-11-23 10:47:41, 2024-11-23 10:48:11, 202…
## $ EndDate                 <dttm> 2024-11-23 10:47:41, 2024-11-23 10:48:11, 202…
## $ Status                  <chr> "Survey Test", "Survey Test", "Survey Test", "…
## $ IPAddress               <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ Progress                <dbl> 100, 100, 100, 100, 100, 100, 100, 100, 100, 1…
## $ `Duration (in seconds)` <dbl> 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ Finished                <lgl> TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE…
## $ RecordedDate            <dttm> 2024-08-19 10:47:41, 2024-08-19 10:48:11, 202…
## $ ResponseId              <chr> "R_42WjeUkiAL2Lgqi", "R_804COr3yMDNruvk", "R_b…
## $ RecipientLastName       <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ RecipientFirstName      <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ RecipientEmail          <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ ExternalReference       <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ LocationLatitude        <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ LocationLongitude       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ DistributionChannel     <chr> "test", "test", "test", "test", "test", "test"…
## $ UserLanguage            <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ played24hr              <chr> "No", "Yes", "Yes", "No", "No", "No", "No", "N…
## $ socialGaming            <chr> NA, "Multiplayer with real-world friends,Multi…
## $ mostRecentGame          <chr> NA, "Nec temporibus gravida. Elementum ultric"…
## $ bangs_1                 <chr> NA, "3", "5", NA, NA, NA, NA, NA, "7 Strongly …
## $ bangs_2                 <chr> NA, "2", "6", NA, NA, NA, NA, NA, "5", "2", "5…
## $ bangs_3                 <chr> NA, "6", "3", NA, NA, NA, NA, NA, "1 \nStrongl…
## $ bangs_4                 <chr> NA, "7 Strongly agree", "6", NA, NA, NA, NA, N…
## $ bangs_5                 <chr> NA, "3", "4Neither Agree nor Disagree", NA, NA…
## $ bangs_6                 <chr> NA, "7 Strongly agree", "5", NA, NA, NA, NA, N…
## $ displacedActivity       <chr> NA, "Tortor vivamus vel faucibus nunc venenati…
## $ lifeSat_1               <dbl> 75, 27, 33, 26, 69, 50, 37, 26, 0, 9, 82, 15, …
## $ affectiveValence_1      <dbl> 5, 83, 55, 65, 8, 77, 49, 43, 57, 35, 40, 40, …
## $ bpnsfs_1                <chr> "3", "1 - Not at all true", "5 - Completely tr…
## $ bpnsfs_2                <chr> "2", "4", "3", "4", "2", "2", "5 - Completely …
## $ bpnsfs_3                <chr> "4", "4", "3", "2", "1 - Not at all true", "1 …
## $ bpnsfs_4                <chr> "3", "1 - Not at all true", "3", "4", "5 - Com…
## $ bpnsfs_5                <chr> "1 - Not at all true", "4", "2", "4", "3", "4"…
## $ bpnsfs_6                <chr> "5 - Completely true", "5 - Completely true", …
## $ sd_0                    <chr> "Regular day off", "Regular day off", "Regular…
## $ sd_0_8_TEXT             <chr> NA, NA, NA, NA, NA, NA, "Molestie dapibus? Veh…
## $ `sd_1#1_1_1`            <dbl> 404421850, 67204383, 1627259138, 712947369, 17…
## $ `sd_1#1_1_2`            <dbl> 1192978314, 47560032, 366648782, 1049382126, 7…
## $ `sd_1#2_1`              <chr> "PM", "AM", "AM", "PM", "PM", "PM", "PM", "AM"…
## $ `sd_2#1_1_1`            <dbl> 1154409129, 1282241295, 2104018384, 330983631,…
## $ `sd_2#1_1_2`            <dbl> 1834620464, 702446275, 1261455350, 715436928, …
## $ `sd_2#2_1`              <chr> "AM", "PM", "PM", "PM", "PM", "AM", "AM", "AM"…
## $ sd_3                    <dbl> 22352004, 1945831747, 32822754, 1466113962, 18…
## $ `sd_4#1_1_1`            <dbl> 49171046, 2137108705, 1538595531, 599210939, 1…
## $ `sd_4#1_1_2`            <dbl> 1912367032, 1888399205, 757997633, 232017641, …
## $ `sd_4#2_1`              <chr> "AM", "PM", "AM", "AM", "PM", "AM", "PM", "PM"…
## $ `sd_5#1_1_1`            <dbl> 2073977616, 1375223952, 1031347821, 1648423485…
## $ `sd_5#1_1_2`            <dbl> 1674261903, 1340397953, 2123555493, 455173333,…
## $ `sd_5#2_1`              <chr> "AM", "PM", "AM", "PM", "PM", "PM", "AM", "PM"…
## $ sd_6                    <chr> "Fair", "Poor", "Poor", "Good", "Very good", "…
## $ timeUse_5               <dbl> 5, 7, 13, 7, 0, 5, 12, 14, 1, 6, 6, 2, 1, 2, 1…
## $ timeUse_6               <dbl> 11, 5, 9, 3, 9, 12, 6, 1, 7, 2, 5, 7, 8, 9, 9,…
## $ timeUse_1               <dbl> 4, 9, 1, 12, 10, 6, 0, 1, 5, 7, 3, 4, 14, 12, …
## $ timeUse_2               <dbl> 0, 0, 1, 2, 5, 1, 5, 8, 8, 9, 0, 10, 1, 1, 1, …
## $ timeUse_3               <dbl> 4, 2, 0, 0, 0, 0, 1, 0, 2, 0, 10, 0, 0, 0, 0, …
## $ timeUse_4               <dbl> 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1…
## $ timeUse_7               <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0…
## $ timeUse_8               <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ timeUse_9               <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ timeUse_10              <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ timeUse_11              <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ timeUse_12              <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ timeUse_13              <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ timeUse_14              <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ stress_argument         <chr> "No", "Yes", "No", "No", "No", "Yes", "Yes", "…
## $ howStress_arg           <chr> NA, "Very", NA, NA, NA, "Not very", "Not very"…
## $ stress_letpass          <chr> "Yes", "No", "No", "No", "No", "Yes", "No", "Y…
## $ howStress_letPass       <chr> "Not at all", NA, NA, NA, NA, "Not very", NA, …
## $ stress_school           <chr> "No", "No", "No", "No", "No", "No", "Yes", "No…
## $ howStress_school        <chr> NA, NA, NA, NA, NA, NA, "Very", NA, NA, NA, NA…
## $ stress_home             <chr> "No", "Yes", "No", "Yes", "No", "Yes", "No", "…
## $ howStress_home          <chr> NA, "Very", NA, "Not at all", NA, "Very", NA, …
## $ stress_discrim          <chr> "No", "No", "No", "No", "No", "No", "No", "Yes…
## $ howStress_discrim       <chr> NA, NA, NA, NA, NA, NA, NA, "Not very", "Somew…
## $ stress_relative         <chr> "No", "Yes", "Yes", "Yes", "No", "Yes", "Yes",…
## $ howStress_relative      <chr> NA, "Not at all", "Not at all", "Somewhat", NA…
## $ stress_other            <chr> "No", "Yes", "No", "Yes", "Yes", "Yes", "Yes",…
## $ howStress_other         <chr> NA, "Somewhat", NA, "Somewhat", "Not very", "N…
## $ PID                     <chr> "7631308436", "7631308436", "7631308436", "763…
## $ wave                    <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,…
print("Steam \n")
## [1] "Steam \n"
glimpse(steam_tibble)
## Rows: 727,500
## Columns: 10
## $ time_hh                <dbl> 1, 0, 0, 2, 1, 1, 0, 0, 1, 2, 8, 3, 14, 8, 19, …
## $ played                 <lgl> TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,…
## $ genre                  <chr> "Casual,Indie,Strategy", "Casual,Indie,Strategy…
## $ minutes_played         <dbl> 30, 45, 45, 25, 30, 30, 45, 45, 30, 25, 45, 40,…
## $ AppID                  <dbl> 2191370, 1316830, 1316830, 733020, 2191370, 219…
## $ game_title             <chr> "A Path to the Princess", "Simply Puzzles: Code…
## $ PID                    <chr> "7631308436", "7631308436", "7631308436", "7631…
## $ days_since_study_start <int> 62, 86, 76, 37, 26, 91, 99, 45, 58, 35, 27, 19,…
## $ date                   <dttm> 2024-10-20, 2024-11-13, 2024-11-03, 2024-09-25…
## $ platform               <chr> "Steam", "Steam", "Steam", "Steam", "Steam", "S…
print("Nintendo \n")
## [1] "Nintendo \n"
glimpse(nintendo_tibble)
## Rows: 171,763
## Columns: 9
## $ titleID       <chr> "Animal Crossing New Horizons", "Animal Crossing New Hor…
## $ sessionStart  <dttm> 2024-08-22 22:11:57, 2024-08-22 23:42:33, 2024-08-27 20…
## $ sessionEnd    <dttm> 2024-08-22 22:53:38, 2024-08-23 01:12:42, 2024-08-27 21…
## $ duration_min  <dbl> 41.6, 87.3, 48.6, 0.1, 0.6, 0.3, 0.5, 0.2, 24.1, 25.4, 0…
## $ deviceType    <chr> "Lite", "Lite", "Lite", "Lite", "Lite", "Lite", "Lite", …
## $ operationMode <chr> "Handheld", "Handheld", "Handheld", "Handheld", "Handhel…
## $ genres        <chr> "Simulator", "Simulator", "Simulator", "Simulator", "Pla…
## $ PID           <chr> "3578600335", "3578600335", "3578600335", "3578600335", …
## $ platform      <chr> "Nintendo", "Nintendo", "Nintendo", "Nintendo", "Nintend…
print("XBOX \n")
## [1] "XBOX \n"
glimpse(xbox_tibble)
## Rows: 65,290
## Columns: 9
## $ DateId           <date> 2022-07-01, 2022-07-01, 2022-07-01, 2022-07-01, 2022…
## $ GameId           <chr> "c3a689aa76b5888f49f1f26f516dca08ad2ffc6135dad75264c0…
## $ PublisherId      <chr> "c31f977d8bac2f944af095e037762e77bf01e24090ad267077ef…
## $ Genre            <chr> "Shooter", "Shooter", "Shooter", "Shooter", "Shooter"…
## $ SessionStartTime <dttm> 2024-08-20 00:00:00, 2024-08-20 00:05:00, 2024-08-20…
## $ SessionEndTime   <dttm> 2024-08-20 00:00:00, 2024-08-20 00:20:00, 2024-08-20…
## $ PID              <chr> "6876309224", "6876309224", "6876309224", "6876309224…
## $ duration_min     <dbl> 0, 15, 0, 35, 0, 120, 0, 0, 125, 0, 0, 25, 0, 0, 160,…
## $ platform         <chr> "XBOX", "XBOX", "XBOX", "XBOX", "XBOX", "XBOX", "XBOX…