What would be the best way to combine the output of the following into a single dataframe? My function inputs a dataframe from a list of dataframes using the lapply function. I process the data inside my lapply function and return the output. My goal is to return the output and column bind the data into a dataframe, on occasion my return output is unequal in length which is causing the bind_cols function to fail. I would appreciate your comments and input on this.
data <- list of dataframes.
main <- data.frame(barcodes=..., other_info=...)
newFrame <- lapply(data, function(x){
testFrame <- data.frame(x) %>%
select(conc,barcodes) %>%
full_join(main) %>% ### main also has a column called barcodes
select(conc) %>%
return()
}) %>% bind_cols()
Error: Error in `bind_cols()`:
! Can't recycle `..1` (size 81) to match `..3` (size 82).