I am looking for a way to make column names and dataframe names from a list of dataframes into a single dataframe. They have unequal length of columns. What's the best way to do this?
dlist <- list(mtcars[1:2], mtcars[1:3], mtcars[1:4])
names(dlist) <- c("mtcars1", "mtcars2", "mtcars3")
Tried:
dlist |> map(~colnames(.x))
Expected output:
1 mtcars1 mpg cyl NA NA
2 mtcars2 mpg cyl disp NA
3 mtcars3 mpg cyl disp hp