I have a dataframe with 3 column: participant ID, questionID and a column containing wether or not they gave the correct (1) response or not (0). It looks like this:
> head(df)
# A tibble: 6 x 3
ID questionID correct
<dbl> <int> <dbl>
1 1 1 1
2 2 2 0
3 3 3 1
4 4 4 0
5 5 5 0
6 6 6 1
And can be recreated using:
set.seed(0)
df <- tibble(ID = seq(1, 100, 1),
questionID = rep(seq(1, 10,), 10),
correct = base::sample(c(0, 1), size = 100, replace = TRUE))
Now I would like each question to have their own column, with the ultimate goal of fitting a 2PL model to it. The data should for that purpose look like 1 row per participant, and 11 columns (ID and 10 question Columns).
How do I achieve this?