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]]