Hi, Have you tried gsub?
> a = "abc.degg.hijk" > gsub("."," ",a,fixed=TRUE) [1] "abc degg hijk" Martyn -----Original Message----- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Tolga I Uzuner Sent: 19 July 2010 12:38 To: r-help@r-project.org Subject: Re: [R] Help with replacing a substring in a string Actually, I think I got it, need to use gsub. From: Tolga I Uzuner Sent: 19 July 2010 12:11 To: 'r-help@r-project.org' Subject: Help with replacing a substring in a string Dear R Users, I am trying to replace a substring in a string with something else. For example: if we have "abc.degg.hijk" I would like to replace all the "." with a SPACE to become "abc degg hijk" I have tried the replace.substring.wild function in the Hmisc package but get this error: > replace.substring.wild("abc.degg.hijk","*.*"," ") Error in replace.substring.wild("abc.degg.hijk", "*.*", " ") : does not handle > 1 * in old > Can't really figure out from the function description or the error message what I am doing wrong. Any assistance would be appreciated, thanks in advance. Regards, Tolga This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ________________________________________________________________________ This e-mail has been scanned for all viruses by Star.\ _...{{dropped:12}} ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.