UPDATED:
I have dataframes inside a list that looks like this:
v1 <- data.frame(time = c(1, 3, 5, 9, 33),
X = c(4, 3, 2, 3, 12),
SE = c(1, 2, 3, 2, 1))
v2 <- data.frame(time = c(1, 3, 5, 9, 33),
Y = c(12, 3, NA, 2, 4),
SE = c(1, 2, 1, 12, 3))
list <- list(v1, v2)
I want to melt/reduce it to look like this:
time variable value SE
1 1 X 4 1
2 3 X 3 2
3 5 X 2 3
4 9 X 3 2
5 33 X 12 1
6 1 Y 12 1
7 3 Y 3 2
8 5 Y NA 1
9 9 Y 2 12
10 33 Y 4 3
So far I've tried this code to no avail.
data <- list %>% reduce(full_join, by = "time")
data2 <- melt(data, id = c("time"))
Thank you!