First of all I would use the colnames() function instead of the names to set new headers to a data frame.
But to your question: you are trying to assign a dataframe to column names whereas the names function requires a vector of strings. So make sure that if you are reading a dataframe you only use the column that has the header names