[WIP] Continue factor analysis.

master
junos 2023-07-03 20:10:45 +02:00
parent ec51d7d406
commit 2f22f2052a
1 changed files with 11 additions and 0 deletions

View File

@ -9,6 +9,7 @@ library(conflicted)
library(here)
library(tidyverse)
library(magrittr)
library(lavaan)
library(kableExtra)
conflicts_prefer(
@ -30,6 +31,7 @@ styler::style_file(
)
```
The data were preprocessed and cleaned using [expl_esm_labels.py](../exploration/expl_esm_labels.py) script and read as csv here.
```{r read_data}
COL_TYPES <- cols(
@ -38,6 +40,7 @@ COL_TYPES <- cols(
username = col_factor(),
device_id = col_factor(),
esm_trigger = col_factor(),
esm_instructions = col_factor(),
double_esm_user_answer_timestamp = col_double(),
datetime_lj = col_datetime(format = ""),
date_lj = col_date(format = ""),
@ -47,3 +50,11 @@ COL_TYPES <- cols(
df_SAM <- read_csv(here("data", "raw", "df_esm_SAM_threat_challenge.csv"), col_types = COL_TYPES)
df_COPE <- read_csv(here("data", "raw", "df_esm_COPE.csv"), col_types = COL_TYPES)
```
Demonstrate factor analysis for a single participant.
```{r}
df_COPE %>%
group_by(question_id, questionnaire_id) %>%
count()
```