I'm currently having some issues setting up my dataframe in a correct way. I would like to end up with the following columns Participant ID, SpeakerDialect (TSpeaker), SpeakerNumber(TSpeaker) and Score.
The output I'm getting from google forms is 4 columns of scores and one with the timestamp(participant ID). Now here comes the trouble. I would like to add some information about the video that they gave a score to the data frame. I made it work by using the following code - but here the Timestamp is not included. When adding the timestamp it completely messes it up. It is a repeated measures design, so the same timestamp will have to be repeated 4 times in the final dataframe
trustworth1 <- read.csv('Danskernes holdninger til politiske udsagn 1.csv')
trustworth1 <- trustworth1 %>% select(Hvor.troværdig.er.personen., Hvor.troværdig.er.personen..1, Hvor.troværdig.er.personen..2, Hvor.troværdig.er.personen..3)
TSpeaker <- c('2', '3', '4', '1')
TDialect <- c('1', '2', '2', '1')
trustworth1 <- trustworth1 %>% t()
trustworth1 <- cbind(TSpeaker, TDialect, trustworth1) %>%
as.tibble()
trustworth1 <- unite(trustworth1, Score, starts_with('V'), sep = ", ", remove = FALSE, na.rm = FALSE)
trustworth1 <- trustworth1 %>% select(TSpeaker,TDialect, Score)
trustworth1 <- separate_rows(trustworth1, c(Score), convert = FALSE)
Test dataframe
TimeStamp <- c(1, 2, 3, 4, 5, 6, 7)
Speaker1 <- c(4, 7, 9, 3, 2, 4, 9)
Speaker2 <- c(7, 1, 9, 0, 2, 5, 10)
Speaker3 <- c(3, 1, 9, 2, 9, 5, 10)
Speaker4 <- c(1, 1, 6, 0, 6, 5, 1)
df <- data.frame(TimeStamp, Speaker1, Speaker2, Speaker3, Speaker4)
Dialect of speaker 1 is 1
Dialect of speaker 2 is 2
Dialect of speaker 3 is 1
Dialect of speaker 4 is 2
Ideally I would end up with a data frame with 4 rows per participant, one for each rating of the speakers
RAW DATA:
TimeStamp
<chr>
Speaker2
<int>
Speaker3
<int>
Speaker4
<int>
Speaker1
<int>
1 2020/12/07 11:33:39 AM CET 3 8 6 9
2 2020/12/07 12:16:33 PM CET 5 5 5 5
3 2020/12/07 12:29:11 PM CET 6 7 8 9
4 2020/12/07 12:47:39 PM CET 7 8 8 9
5 2020/12/07 1:04:01 PM CET 5 5 5 5
6 2020/12/07 1:05:33 PM CET 0 8 9 5
6 rows
Any ideas?