title: How do I convert integers to numeric and have 0s to the hundredths?
body: <p>Given the following dataframe, I want to convert the first column, <code>data_2018</code> to be numeric and have digits to the hundredths</p>
  
  <pre><code>structure(list(data_2018 = c(4, 4, 4, 4, 4, 4, NaN, NaN, NaN), 
      data_2017 = c(NA, "+0.33", "+0.58", "+0.24", "+0.67", "+0.83", 
      NA, NA, NA), a_mean = c("+0.59", "+0.26", "+0.5", "+0.4", 
      "+0.51", "+0.39", NA, NA, NA), b_mean = c("+0.54", "+0.27", 
      "+0.55", "+0.31", "+0.62", "+0.37", NA, NA, NA)), row.names = c(NA, 
  -9L), class = "data.frame")
  </code></pre>
  
  <p>I've tried the following, but neither seem to work:</p>
  
  <pre><code>df[1] &lt;- lapply(df[1], as.numeric)
  df[1] &lt;- round(df[1], digits = 2)
  </code></pre>
  
  <p>This is the block of code that I run to generate <code>df</code>. Not sure how to tweak this to round the first column, so if I can manage to do it in here, that would be nicer and cleaner:</p>
  
  <pre><code>round_df &lt;- function(x, digits) {
    # round all numeric variables
    # x: data frame 
    # digits: number of digits to round
    numeric_columns &lt;- sapply(x, mode) == 'numeric'
    x[numeric_columns] &lt;-  round(x[numeric_columns], digits)
    x
  }
  
  df &lt;- as.data.frame(cbind(data_2018 = round_df(old_df$data_2018, 2), 
                                       sapply(c("data_2017", "a_mean", "b_mean"), 
                                              function(c) (round_df(old_df$data_2018 - df[[c]], 2)))))
  </code></pre>
  
  <p>I've tried editing the <code>old_df</code> before this block as well, but keep getting returned the same integers</p>
  
  <p>Old_df:</p>
  
  <pre><code>structure(list(data_name = structure(1:9, .Label = c("A", 
  "B", "C", 
  "D", "E", 
  "F", "G", 
  "H", "I"
  ), class = "factor"), data_2018 = c(4, 4, 4, 4, 4, 4, NaN, NaN, 
  NaN), b_mean = c(3.4613889058431, 3.72575757720254, 3.45000000560985, 
  3.68731343212412, 3.38352940888966, 3.6260294248076, 3.10442119411633, 
  3.66819985569986, 3.46452822147108), a_mean = c(3.40740741623773, 
  3.74117646497839, 3.49967318422654, 3.59940157217138, 3.48692812639124, 
  3.60947714132421, 3.45057719920105, 3.55519480519481, 3.58463203390955
  ), data_2017 = c(NaN, 3.67499995231628, 3.41666662693024, 3.7619047164917, 
  3.33333325386047, 3.16666662693024, 3.3589743742576, 3.55769230769231, 
  3.32051282662612), tool = c("e", "e", "e", "e", "e", 
  "e", "y", "y", "y"), status = c(NA, 6, 6, 6, 
  6, 6, NA, NA, NA)), row.names = c(2L, 3L, 4L, 5L, 8L, 9L, 1L, 
  6L, 7L), class = "data.frame")
  </code></pre>