here is the solution to your question test <- data.frame(C1=c('a,b,c,d'),C2=c('g,h,f'))
you should use gsub instead sub if you want it to be on all elements of each column tFun <- function(x) {gsub(",",";",x)} newTest <- apply(test, 2, tFun ) Cheers, [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.