Hello,
I don't know why I am exactly struggling with this problem but essentially I have multiple functions putting out a set of numbers (as below) and I just want to be able to merge them into one list and finally one dataframe. The final output should be 1,4,NA in the first row with 2,2,1 in the second row etc.
library(tidyverse)
f1 <- c(1,2,3,NA,5)
f2 <- c(4,2,1,3,NA)
f3 <- c(NA,1,2,3,4)
temp_list <- list()
for (x in 1:length(f1)) {
temp_list[x] <- c(f1[x],f2[x],f3[x])
}
I tried a variety of ways such as temp_list[x] <- c(f1[x],f2[x],f3[x]) and others such as temp_list[x] <- f1[x] %>% append(f2[x]) %>% append(f3[x]) but it would seem the problem is not at the right side of the allocation but an issue with temp_list[x].
I'm probably missing something super obvious. Any help would be appreciated