gsub - replacing several string occurences in r -
i want replace several strings one. i've researched , found gsub can replace elements 1 @ time.
if warning saying first 1 used.
data$evtype <- gsub( c("x","y") , "xy", data$evtype)
i trying sapply
data$evtype <- sapply(data$evtype, gsub, c("x", "y"), "xy")
it's been more 5 minutes , still processing. stack overflow message time now. :-/ there elegant short solution this? there package can use this? needs small because need several cases have duplicate names. please help!
thanks useful comments. done frank suggested. gsub( "x|y" , "xy", data$evtype).
instead of using vector.
Comments
Post a Comment