How do you delete the header in a dataframe?

前端 未结 7 644
故里飘歌
故里飘歌 2021-01-04 19:40

I want to delete the header from a dataframe that I have. I read in the data from a csv file then I transposed it, but it created a new header that is the name of the file a

7条回答
  •  攒了一身酷
    2021-01-04 20:18

    It comes with some years of delay but you can simply use a vector renaming de columns:

    ## if you want to delete all column names:
    colnames(df)[] <- ""
    
    ## if you want to delete let's say column 1:
    colnames(df)[1] <- ""
    
    ## if you want to delete 1 to 3 and 7:
    colnames(df)[c(1:3,7)] <- ""
    
    
    
    
    

提交回复
热议问题