title: Converting Northing/Easting into Decimal Degrees in R
body: <p>I'm trying to convert vectors that contain northing and easting data into decimal degrees using R. So far I have been able to the package rgdal to perform a projection, but I am running into a problem. The argument for the UTM zone must be a single character string, but I have multiple UTM zones in my data. Is there a way to use the rgdal::SpatialPoints() function to set multiple UTM zones? I tried inputting set character strings and using a vector in the CRS() function, but I received a warning message that only the first zone was used.</p>
  
  <pre><code>
  df&lt;- data.frame(X = c(774869, 771437, 1051883, 524468), 
                  Y = c(414498, 403790, 184967, 779682), 
                  WGS.1984.UTM.Zone = c("57N", "57N", "54N", "59N"))
  
   library(rgdal)
    sputm &lt;- SpatialPoints(df[c("X", "Y")], proj4string=CRS("+proj=utm +zone=57N +datum=WGS84"))  
    spgeo &lt;- spTransform(sputm, CRS("+proj=longlat +datum=WGS84"))
  
  
  #resultant coordinates are all transformed relative to UTM zone 57N
  
  df$projargs&lt;- paste("+proj=utm +zone=", df$WGS.1984.UTM.Zone, " +datum=WGS84", sep = "")
  
  #trying again with set projargs character strings
  
  spUTM&lt;- SpatialPoints(df[c("X", "Y")], proj4string=CRS(df$projargs))
  
  </code></pre>
  
  <p>Warning messages:</p>
  
  <p>1: In if (!is.na(projargs)) { :
    the condition has length > 1 and only the first element will be used</p>
  
  <p>2: In if (!is.na(projargs)) { :
    the condition has length > 1 and only the first element will be used</p>
  
  <p>3: In if (is.na(projargs)) uprojargs &lt;- projargs else uprojargs &lt;- paste(unique(unlist(strsplit(projargs,  :
    the condition has length > 1 and only the first element will be used</p>