I have a list of, say, n=10 data.tables (or data.frames).
Performing names(myList)
returns the unique table names.
Performing names(myList[[i]])
(for i in 1:n) returns identical output for each value of i
- i.e. each data.table has identical column names.
I need to merge all the data tables into one large data table, but would like to preserve the name of the list data.table for each column somehow, in order to keep an overview of where each column originated from.
Is there a trick to doing this, such as giving the columns keys? Or must one just prepend the table name to each of the columns in the final result? This would make the names pretty long in my case.
I want to avoid having to remember (or think about) which columns belongs to which table. Just for comparisons sake, I'd like to run str(myBigTable)
or summary(myBigTable)
and see something like Excel shows here [but vertically displayed in R]: