Hi,
I think you can make it work by combining gsub() and sapply() (or
lapply()), though I don't really know how (those *apply() functions are
still kind of a mystery for me).
Maybe someone else can help you
Ivan
Le 5/19/2010 12:35, Dani Valverde a écrit :
Hello,
Is there any function like g
Try this:
DF <- data.frame(a = head(letters), A = head(LETTERS))
DF[] <- lapply(DF, gsub, pattern = "a", replacement = "X")
m <- cbind(a = head(letters), A = head(LETTERS))
m[] <- gsub("a", "X", m)
In the future please provide test data and desired output as per
posting guide (see bottom of ever
Exactly how do you want to do that? (PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.)
Provide a before/after example of what you want. You could use the
'apply' functions.
On Wed, May 19, 2010 at 6:35
Hello,
Is there any function like gsub(), that can match and replace patterns
in a matrix or a data frame?
Cheers!
Dani
--
Daniel Valverde Saubí
Grup de Biologia Molecular de Llevats
Facultat de Veterinària de la Universitat Autònoma de Barcelona
Edifici V, Campus UAB
08193 Cerdanyola del Val
4 matches
Mail list logo