title: Error in function to normalize data applied to a data frame
body: <p>I have downloaded the bike-sharing-dataset from the UCI Machine learning repository and am trying to implement a multivariate linear regression in R. Here is the format of the data:</p>
  
  <pre><code>&gt; head(data1)
    season mnth hr holiday weekday workingday weathersit temp  atemp  hum windspeed cnt
  1      1    1  0       0       6          0          1 0.24 0.2879 0.81    0.0000  16
  2      1    1  1       0       6          0          1 0.22 0.2727 0.80    0.0000  40
  3      1    1  2       0       6          0          1 0.22 0.2727 0.80    0.0000  32
  4      1    1  3       0       6          0          1 0.24 0.2879 0.75    0.0000  13
  5      1    1  4       0       6          0          1 0.24 0.2879 0.75    0.0000   1
  6      1    1  5       0       6          0          2 0.24 0.2576 0.75    0.0896   1
  </code></pre>
  
  <p>I am trying to normalize specific columns (that have not already been normalized) with the following function: </p>
  
  <pre><code>normalize &lt;- function(x) {
    return ((x - min(x)) / (max(x) - min(x)))
  }
  </code></pre>
  
  <p>The problem is that when I run:</p>
  
  <pre><code> dfNorm &lt;- as.data.frame(lapply(data1["season", "mnth", "hr", "weekday", "weathersit"], normalize)) 
  </code></pre>
  
  <p>I get the following error:</p>
  
  <blockquote>
    <p>Error in <code>[.data.frame</code>(data1, "season", "month", "hour", "weekday",
    "weathersit") :    unused arguments ("weekday", "weathersit")</p>
  </blockquote>
  
  <p>Why am I getting this error and how can I fix it?</p>