[R] changing character strings with hash marks

Uwe Ligges ligges at statistik.tu-dortmund.de
Thu Dec 13 23:38:20 CET 2012



On 13.12.2012 22:30, simona mancini wrote:
> Hi R users,
>
> I am quite new to R and I don't know how to deal with this (surely) easy issue. I need to replace words in sentences with as many hash marks as the number of characters per each word, as in the following example:
>
> Mary plays football
> #### ##### ########

gsub("[[:alpha:]]", "#", "Mary plays football")

Uwe Ligges


> Any suggestion about the function to be used?
> Thanks a lot.
>
> S.
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>




More information about the R-help mailing list