Applying dplyr's rename to all columns while using pipe operator

前端 未结 5 1319

I\'m working with an imported data set that corresponds to the extract below:

set.seed(1)
dta <- data.frame(\"This is Column One\" = runif(n = 10),
               


        
5条回答
  •  难免孤独
    2021-01-04 03:43

    Using Stringr and Dplyr, and the dot operator:

    dta %>%
       dplyr::rename_all(funs(
                         stringr::str_replace_all( ., "[[:punct:]]", "_" )
       ))
    

提交回复
热议问题