The initial code for finding the list of unique column headers from a se...

...t of data frames.
extends() instead of append() at this line will accomplish what you are trying to achieve in the next line.