Reputation: 587
Column names in dataset are unrecognizable values. But, the name of what the column should be is the 1st row. How can I re-assign those values as the column name? This needs to be done with 30+ columns. Here's a screenshot of the dataset:
Upvotes: 0
Views: 1915
Reputation: 1987
Simple: colnames(dataset) <- dataset[1,]
Although really you should be reading in the column names when you read the dataset with header=T
in whatever your read function of choice is. This will have the added benefit of letting your columns be their actual datatypes, as with the header row now they're all going to be strings.
Upvotes: 2