How to change the first row to be the header in R?

This could be in a simple way :

step 1: Copy 1st row to header:

names(dat) <- dat[1,]

step 2: Delete 1st row :

dat <- dat[-1,]

Leave a Comment