title: Applying function to specific columns while preserving other
body: <p>I have a function to center my data:</p>
  <pre><code>    center_colmeans &lt;- function(x) {
        xcenter = colMeans(x)
        x - rep(xcenter, rep.int(nrow(x), ncol(x)))
      }
    
     mtcars$cyl &lt;- as.character(mtcars$cyl)
     center_colmeans(mtcars)
  </code></pre>
  <p>This runs fine if I remove cyl (since it's a string). such as this:</p>
  <pre><code>   center_colmeans(mtcars[4:8])
  </code></pre>
  <p>But I want to run &quot;center_colmeans&quot; on all numeric variables, while preserving cyl as it is. In my data, I have multiple string columns that I won't to preserve as is. I need them in my final data set with the centered means. Any idea's appreciated!</p>