Add a prefix to column names

后端 未结 4 804
情深已故
情深已故 2020-11-28 03:52

When reading the following helpfile it should be possible to add a prefix to the column names :

colnames(x, do.NULL = TRUE, prefix = \"col\")
4条回答
  •  無奈伤痛
    2020-11-28 04:35

    The updated tidyverse method (with dplyr 1.0.2) uses rename_with() as the rename_all() function has been superseded.

    iris %>% rename_with( ~ paste("Sub", .x, sep = "_"))
    

提交回复
热议问题