Re: [R] Removing funny characters from a column of a data frame

2011-08-07 Thread Joshua Wiley
Hi Vikas, You're overworking yourself here, gsub is vectorized! df$V5 <- gsub("[^AaCcGgTt\\.,]", "", df$V5) This will be *substantially* faster than looping (using apply) over every row of your data frame, since you just care about the 5th column anyways. Also, I switched your regexp for one th

[R] Removing funny characters from a column of a data frame

2011-08-07 Thread Bansal, Vikas
Dear all, The 5th column of my data frame is like this- .$.$.$.$.$,$,$...,.,,.,,....,,,,,T...,,,.,,,...,, ,..,,,...,,,..,,..,,,,,,.,,...G....,,.,, ,t.,,c,,.a.,,,.A,,,...,..,,,.,,,,...,,,$ .