assign headers based on existing row in dataframe in R

The Solution to assign headers based on existing row in dataframe in R is


The key here is to unlist the row first.

colnames(DF) <- as.character(unlist(DF[1,]))
DF = DF[-1, ]

~ Answered on 2016-05-20 08:10:52


Most Viewed Questions: