Hi On 5 Apr 2006 at 7:48, Lapointe, Pierre wrote:
From: "Lapointe, Pierre" <[EMAIL PROTECTED]> To: "'[email protected]'" <[email protected]> Date sent: Wed, 5 Apr 2006 07:48:33 -0400 Subject: [R] gsub in data frame > Hello, > > I have this data frame: > > ### begin > > d <-data.frame(matrix(c("1","--","bla",2),2,2)) > d > > # I want to replace the "--" by "\N" and still get a data frame. > > # I tried: > > out <-gsub("--","\\\\N",as.matrix(d)) #using as.matrix to get rid of > factors out cat(out) > > # But I lost my data frame > > ### end > > Any idea? re formate it back? data.frame(matrix(out,2,2)) X1 X2 1 1 bla 2 \\N 2 HTH Petr > > > Regards, > > Pierre Lapointe > > ************************************************** > AVIS DE NON-RESPONSABILITE: Ce document transmis par > courrie...{{dropped}} > > ______________________________________________ > [email protected] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html Petr Pikal [EMAIL PROTECTED] ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
