Skip to content

changing character strings with hash marks

4 messages · simona mancini, Bert Gunter, arun +1 more

#
Hi,
You could also use:

gsub("\\w","#","Mary plays football")
#[1] "#### ##### ########"
#or
gsub("[A-Za-z]", "#", "Mary plays football")

A.K.

----- Original Message -----
From: Uwe Ligges <ligges at statistik.tu-dortmund.de>
To: simona mancini <mancinisimona at yahoo.it>
Cc: "r-help at r-project.org" <r-help at r-project.org>
Sent: Thursday, December 13, 2012 5:38 PM
Subject: Re: [R] changing character strings with hash marks
On 13.12.2012 22:30, simona mancini wrote:
gsub("[[:alpha:]]", "#", "Mary plays football")

Uwe Ligges
______________________________________________
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.
#
On 13.12.2012 22:30, simona mancini wrote:
gsub("[[:alpha:]]", "#", "Mary plays football")

Uwe Ligges