[R] ?replace characters within vector data
marc_schwartz at comcast.net
Fri Jul 6 04:48:28 CEST 2007
On Fri, 2007-07-06 at 12:40 +1000, Alexander.Herr at csiro.au wrote:
> Hi List,
> I want replace characters within a vector. Outside R I could use sed,
> but I'd like to automate it in R. For example
> I want to change to:
> The obvious replace command only deals with whole data entries?
> Any hints would be appreciated.
See ?gsub and also ?regex
 "xxxyyz" "xxxyyza" "xxxyyzzb"
> gsub("x", "a", vectorx)
 "aaayyz" "aaayyza" "aaayyzzb"
More information about the R-help