title: R: SpatialPointsDataFrame code no longer working. Error in !res[[1]] : invalid argument type
body: <p>I have been following <a href="https://stephendavidgregory.github.io/useful/UKgrid_to_LatLon" rel="noreferrer">this workflow</a> to convert coordinates from Eastings / Northings to Latitude / Longitude in R. Up until today it has been working fine. Here is a reproducible example:</p>
  
  <pre><code>require(rgdal)
  # create test coordinates
  x &lt;- 259269 y &lt;- 074728
  
  # create test dataframe 
  dat &lt;- data.frame(x, y) 
  class(dat) # "data.frame"
  
  ### shortcuts 
  ukgrid &lt;- "+init=epsg:27700" 
  latlong &lt;- "+init=epsg:4326"
  
  ### Create coordinates object 
  coords &lt;- cbind(Easting = as.numeric(as.character(x)),
                  Northing = as.numeric(as.character(y)))
  class(coords) # matrix
  dat_SP &lt;- SpatialPointsDataFrame(coords,
                                data = dat,
                                proj4string = CRS("+init=epsg:27700"))
  
  # Error in !res[[1]] : invalid argument type
  
  # Following steps ----
  
  # Convert
  dat_SP_LL &lt;- spTransform(dat_SP, CRS(latlong)
  
  # replace Lat, Long
  dat_SP_LL@data$Long &lt;- coordinates(dat_SP_LL)[, 1]
  dat_SP_LL@data$Lat &lt;- coordinates(dat_SP_LL)[, 2]
  </code></pre>
  
  <p>I think this may be related to the proj4string argument, but have been unable to resolve it. Any help is appreciated.</p>
  
  <p>My session info:</p>
  
  <pre><code>&gt; sessionInfo()
  R version 3.6.1 (2019-07-05)
  Platform: x86_64-w64-mingw32/x64 (64-bit)
  Running under: Windows 10 x64 (build 18362)
  
  Matrix products: default
  
  locale:
  [1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252   
  [3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C                           
  [5] LC_TIME=English_United Kingdom.1252    
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
   [1] forcats_0.5.0      stringr_1.4.0      dplyr_0.8.3        purrr_0.3.3       
   [5] readr_1.3.1        tibble_3.0.1       tidyverse_1.3.0    ggspatial_1.1.2   
   [9] tmap_3.0           rnrfa_2.0.3        gdalUtils_2.0.3.2  zoon_0.6.5        
  [13] biomod2_3.4.6      sdm_1.0-89         SDMTools_1.1-221.1 SSDM_0.2.8        
  [17] odbc_1.2.2         DBI_1.1.0          rgeos_0.5-3        rgdal_1.5-8       
  [21] tidyr_1.1.0        ggplot2_3.3.1      knitr_1.25         raster_3.0-7      
  [25] sp_1.3-1          
  </code></pre>