how to keep spaces in name in r code example Example: R df space in column name names(x)<-str_replace_all(names(x), c(" " = "." , "," = "" ))