I have a dirty dataset that I could not read it with header = T. After I read and clean it, I would like to use the now first row data as the column name. I tri
header = T
Similar to some of the other answers, here is a dplyr/tidyverse option:
dplyr
tidyverse
library(tidyverse) names(df) <- df %>% slice(1) %>% unlist() df <- df %>% slice(-1)