An answer to this tweet “Are there any #Rstats tidy expeRts who’d be interested in improving the efficiency of this code that gathers multiple variables from wide to long?
This works but it’s not pretty. There must be a prettier way…"
Wide data frame has three time points where participants answer two questions on two topics.
create data from original code #Simmed data Time1.Topic1.Question1 <- rnorm(500) data <- data.frame(Time1.Topic1.Question1) data$Time1.TOpic1.Question2 <- rnorm(500) data$Time1.