rstringreplaceletter-spacing

replacing "." with a character in R


I have a string that is

NAME = "Brad.Pitt"

I want to replace "." with a space (" "). I tried using sub, gsub, str_replace, str_replace all. They aren't working fine. Is there anything that I am missing out ?


Solution

  • Try:

    NAME = "Brad.Pitt"
    
    gsub("\\.", " ", NAME)