R set first two row as column names code example Example: how to set the first column as row names in r df2 <- df[,-1] rownames(df2) <- df[,1]