This snippet should get you going.
library(tidyverse)
current <- data.frame(
question = c('q1', 'q1', 'q2', 'q2'),
last = c('a', 'c', 'a', 'c'),
first = c('b', 'd', 'b', 'd'),
answer = c(1,2,3,4)
)
new <- current %>%
pivot_wider(
id_cols = 2:3,
names_from = question,
values_from = answer
)