Replace characters in column names gsub

前端 未结 2 1571
面向向阳花
面向向阳花 2020-12-15 07:50

I am reading in a bunch of CSVs that have stuff like \"sales - thousands\" in the title and come into R as \"sales...thousands\". I\'d like to use a regular expression (or o

2条回答
  •  执念已碎
    2020-12-15 08:29

    names(a) <- gsub(x = names(a), pattern = "\\.", replacement = "#")  
    

    you can use gsub function to replace . with another special character like #.

提交回复
热议问题