title: tidyverse error Error: All select() inputs must resolve to integer column positions
body: <p>I am having problems implementing my script because of this error:</p>
  
  <pre><code>Error: All select() inputs must resolve to integer column positions.
  </code></pre>
  
  <p>I found the same error from these links:</p>
  
  <p><a href="https://stackoverflow.com/questions/45513770/average-of-multiple-columns-in-dplyr-getting-error-must-resolve-to-integer-colu">1</a></p>
  
  <p><a href="https://stackoverflow.com/questions/41587473/error-all-select-inputs-must-resolve-to-integer-column-positions-the-followin">2</a></p>
  
  <p>I am calculating the distance between lat-lon points using R.
  Here's my script:</p>
  
  <pre><code>library(tidyverse)
  #functions
  dms_to_rad &lt;- function(d, m, s) (d + m / 60 + s / 3600) * pi / 180
  great_circle_distance &lt;- function(lat1, long1, lat2, long2) {
    a &lt;- sin(0.5 * (lat2 - lat1))
    b &lt;- sin(0.5 * (long2 - long1))
  12742 * asin(sqrt(a * a + cos(lat1) * cos(lat2) * b * b))
  }
  
  #read file
  dir1 = "JTWC_1979.csv"
  dir2 = "Ambulong_proc_1979.csv"
  jtwc &lt;- read.csv(dir1) %&gt;%
  unite('key',c('Year','Month','Day','Hour'))
  stn &lt;- read.csv(dir2) %&gt;%
  unite('key',c('Year','Month','Day','Hour'))
  
  #aggregating 
  stn &lt;- left_join(jtwc,stn,by = "key") %&gt;%
    drop_na() %&gt;%
    mutate_at(vars(Lat.x,Lon.x,Lat.y,Lon.y),funs(dms_to_rad(.,0,0))) %&gt;%
    mutate(dist = great_circle_distance(Lat.x,Lon.x,Lat.y,Lon.y))
  
  write.csv(stn,file="dist.csv",row.names=T)
  </code></pre>
  
  <p>File1:</p>
  
  <pre><code>SN  CY  Year    Month   Day Hour    Lat Lon
  196101  1   1961    1   14  12  8.3 134.7
  196101  1   1961    1   14  18  8.8 133.4
  196101  1   1961    1   15  0   9.1 132.5
  196101  1   1961    1   15  6   9.3 132.2
  196101  1   1961    1   15  12  9.5 132
  196101  1   1961    1   15  18  9.9 131.8
  196125  1   1961    1   14  12  10.0 136
  196125  1   1961    1   14  18  10.5 136.5
  </code></pre>
  
  <p>file 2:</p>
  
  <pre><code> Year    Month Day RR Hour Lat  Lon
   1961    1   14  0   0   14.0917 121.055
   1961    1   14  0   6   14.0917 121.055
   1961    1   14  0   12  14.0917 121.055
   1961    1   14  0   18  14.0917 121.055
   1961    1   15  0   0   14.0917 121.055
   1961    1   15  0   6   14.0917 121.055
  </code></pre>
  
  <p>The "SN" column is a unique identifier in file1. What I want to do:</p>
  
  <p>[1] Calculate the distance(jtwc$dist) when the two files have the same Year,Month,Day, and Hour.</p>
  
  <p>[2] In case a row has the same Year,Month,Day,and Hour but different SN number in file1,I will use the values in the row with the same Year,Month,Day,and Hour in file2 in computing the distance.</p>
  
  <p>Any suggestions on how to do this correctly?</p>