Character pattern replacement using gsub, loops, and data.table
Is there a reason that you are using mapply to gsub through the number columns as well? You can just replace in the first column if that is all you need, which gets some speed improvement, about 2x on my machine. I also tried using stringi instead of gsub but it was not faster. This is also a speedup on the order of milliseconds though!



library(data.table)
#&gt; Warning: package 'data.table' was built under R version 3.5.1
library(microbenchmark)
#&gt; Warning: package 'microbenchmark' was built under R version 3.5.1
library(stringi)
df1 &lt;- data.frame(name = rep(LETTERS, 250), number = rep(c(1:26), 250), stringsAsFactors = FALSE)
df1$name[df1$name == "D" | df1$name == "F" | df1$name == "L"] &lt;- "foo*"
df2 &lt;- data.frame(name = rep(LETTERS, 250), number = rep(c(1:26), 250), stringsAsFactors = FALSE)
df2$name[df2$name == "A" | df2$name == "R" | df2$name == "T"] &lt;- "*foo*"
df3 &lt;- data.frame(name = rep(LETTERS, 250), number = rep(c(1:26), 250), stringsAsFactors = FALSE)
df3$name[df3$name == "C" | df3$name == "Q" | df3$name == "W"] &lt;- "f*oo"

df &lt;- list(df1, df2, df3)
dt &lt;- lapply(df, as.data.table)

mapply.remove.asterisk = function(x){
  df2 &lt;- data.frame(mapply(gsub, "\\*", "", x, perl = TRUE))
  colnames(df2) &lt;- colnames(x)
}

dt.remove.asterisk = function (x) {
  x[, lapply(.SD, function(x) gsub("\\*", "", x, perl = TRUE))]
}

stringi.remove.asterisk = function (x) {
  out &lt;- x
  out$name &lt;- stri_replace_all_regex(x$name, "\\*", "")
  out
}

gsub.remove.asterisk = function(x) {
  out &lt;- x
  out$name &lt;- gsub("\\*", "", x$name)
  out
}

mapgsubtest = function(x) {
  df.test &lt;- lapply(x, mapply.remove.asterisk)
}

dtgsubtest = function(x) {
  dt.test &lt;- lapply(x, dt.remove.asterisk)
}

strisubtest = function(x) {
  str.test &lt;- lapply(x, stringi.remove.asterisk)
}

gsubtest = function(x){
  gsub.test &lt;- lapply(x, gsub.remove.asterisk)
}

microbenchmark(mapgsubtest(df), dtgsubtest(dt), strisubtest(df), gsubtest(df))
#&gt; Unit: milliseconds
#&gt;             expr      min       lq     mean   median       uq       max
#&gt;  mapgsubtest(df) 8.031179 8.789332 9.429985 9.164945 9.740215 12.913776
#&gt;   dtgsubtest(dt) 7.276307 7.867076 8.553440 8.217892 8.855339 22.473660
#&gt;  strisubtest(df) 8.149333 8.745572 9.391304 9.221469 9.846153 13.492875
#&gt;     gsubtest(df) 4.153983 4.667258 5.053101 4.789789 5.231771  9.813332
#&gt;  neval
#&gt;    100
#&gt;    100
#&gt;    100
#&gt;    100


Created on 2018-10-20 by the reprex package (v0.2.0).