set the first row as a header in R code example Example 1: make the first row as header in r dat <- dat[-1,] Example 2: make the first row as header in r names(dat) <- dat[1,]