Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shape file extension: update extension guide #458

Closed
nhward opened this issue Nov 23, 2024 · 9 comments
Closed

Shape file extension: update extension guide #458

nhward opened this issue Nov 23, 2024 · 9 comments

Comments

@nhward
Copy link

nhward commented Nov 23, 2024

I am keen to extend Rio for shape files (which are technically a sets of four files). Shape files contain data that includes spatial features such as points, lines and polygons.
I have read everything I can find on extending Rio but I cannot get the code below to work. Is there a step that is not mentioned?

library(sf)
library(rio)

.import.rio_shp <- function(file, ...) {
  sf::read_sf(dsn = file, quiet = TRUE)
}

file <- system.file("shape/nc.shp", package="sf")
rio::get_info(file)
rio::import(file)

I am running R4.4.2 and the Rio 1.2.3

@chainsawriot
Copy link
Collaborator

@nhward Thank you for reporting this.

And you are right that the extension guide is outdated and adding just the S3 method is not enough. get_info() can't detect the file format. And it should also be addressed.

I will update this later.

@chainsawriot chainsawriot changed the title Shape file extension Shape file extension: update extension guide Nov 26, 2024
@chainsawriot
Copy link
Collaborator

chainsawriot commented Dec 13, 2024

One way of handling this is to make get_info() returns a type called "unknown" (rather than NA) first, when the file extension can't be found in the list. For "unknown" type, it would use tryCatch() to try to import it using a user-supplied custom S3 method first, e.g. .import.rio_shp. If it works, work. If it fails, fail and say not supported.

But it might change how the current "enhance" type works.

@chainsawriot
Copy link
Collaborator

#335

chainsawriot added a commit that referenced this issue Dec 17, 2024
The S3 method can be dispatched. But the problem is that it can't be
tested with testthat. Why?
@chainsawriot chainsawriot mentioned this issue Dec 17, 2024
@chainsawriot
Copy link
Collaborator

@nhward It should be working now. Please give it a try.

@nhward
Copy link
Author

nhward commented Dec 19, 2024

I have installed the latest github package.
The reproducible example still does not work.
"Error: Format not supported"

@chainsawriot
Copy link
Collaborator

@nhward

Could you provide us the output of this reprex? It would help with the debugging.

## remotes::install_github("gesistsa/rio")
library(sf)
library(rio)
.import.rio_shp <- function(file, ...) {
  sf::read_sf(dsn = file, quiet = TRUE)
}
file <- system.file("shape/nc.shp", package="sf")
rio::get_info(file)
rio::import(file)
sessionInfo()

Thank you very much!

Here's mine.

## remotes::install_github("gesistsa/rio")
library(sf)
#> Linking to GEOS 3.10.2, GDAL 3.4.1, PROJ 8.2.1; sf_use_s2() is TRUE
library(rio)

.import.rio_shp <- function(file, ...) {
  sf::read_sf(dsn = file, quiet = TRUE)
}

file <- system.file("shape/nc.shp", package="sf")
rio::get_info(file)
#> $input
#> [1] "shp"
#> 
#> $format
#> [1] "shp"
#> 
#> $type
#> [1] "unknown"
#> 
#> $format_name
#> [1] NA
#> 
#> $import_function
#> [1] NA
#> 
#> $export_function
#> [1] NA
#> 
#> $file
#> [1] "/home/chainsawriot/R/x86_64-pc-linux-gnu-library/4.3/sf/shape/nc.shp"

rio::import(file)
#>      AREA PERIMETER CNTY_ CNTY_ID         NAME  FIPS FIPSNO CRESS_ID BIR74
#> 1   0.114     1.442  1825    1825         Ashe 37009  37009        5  1091
#> 2   0.061     1.231  1827    1827    Alleghany 37005  37005        3   487
#> 3   0.143     1.630  1828    1828        Surry 37171  37171       86  3188
#> 4   0.070     2.968  1831    1831    Currituck 37053  37053       27   508
#> 5   0.153     2.206  1832    1832  Northampton 37131  37131       66  1421
#> 6   0.097     1.670  1833    1833     Hertford 37091  37091       46  1452
#> 7   0.062     1.547  1834    1834       Camden 37029  37029       15   286
#> 8   0.091     1.284  1835    1835        Gates 37073  37073       37   420
#> 9   0.118     1.421  1836    1836       Warren 37185  37185       93   968
#> 10  0.124     1.428  1837    1837       Stokes 37169  37169       85  1612
#> 11  0.114     1.352  1838    1838      Caswell 37033  37033       17  1035
#> 12  0.153     1.616  1839    1839   Rockingham 37157  37157       79  4449
#> 13  0.143     1.663  1840    1840    Granville 37077  37077       39  1671
#> 14  0.109     1.325  1841    1841       Person 37145  37145       73  1556
#> 15  0.072     1.085  1842    1842        Vance 37181  37181       91  2180
#> 16  0.190     2.204  1846    1846      Halifax 37083  37083       42  3608
#> 17  0.053     1.171  1848    1848   Pasquotank 37139  37139       70  1638
#> 18  0.199     1.984  1874    1874       Wilkes 37193  37193       97  3146
#> 19  0.081     1.288  1880    1880      Watauga 37189  37189       95  1323
#> 20  0.063     1.000  1881    1881   Perquimans 37143  37143       72   484
#> 21  0.044     1.158  1887    1887       Chowan 37041  37041       21   751
#> 22  0.064     1.213  1892    1892        Avery 37011  37011        6   781
#> 23  0.086     1.267  1893    1893       Yadkin 37197  37197       99  1269
#> 24  0.128     1.554  1897    1897     Franklin 37069  37069       35  1399
#> 25  0.108     1.483  1900    1900      Forsyth 37067  37067       34 11858
#> 26  0.170     1.680  1903    1903     Guilford 37081  37081       41 16184
#> 27  0.111     1.392  1904    1904     Alamance 37001  37001        1  4672
#> 28  0.180     2.151  1905    1905       Bertie 37015  37015        8  1324
#> 29  0.104     1.294  1907    1907       Orange 37135  37135       68  3164
#> 30  0.077     1.271  1908    1908       Durham 37063  37063       32  7970
#> 31  0.142     1.640  1913    1913         Nash 37127  37127       64  4021
#> 32  0.059     1.319  1927    1927     Mitchell 37121  37121       61   671
#> 33  0.131     1.521  1928    1928    Edgecombe 37065  37065       33  3657
#> 34  0.122     1.516  1932    1932     Caldwell 37027  37027       14  3609
#> 35  0.080     1.307  1936    1936       Yancey 37199  37199      100   770
#> 36  0.118     1.899  1937    1937       Martin 37117  37117       59  1549
#> 37  0.219     2.130  1938    1938         Wake 37183  37183       92 14484
#> 38  0.118     1.601  1946    1946      Madison 37115  37115       58   765
#> 39  0.155     1.781  1947    1947      Iredell 37097  37097       49  4139
#> 40  0.069     1.201  1948    1948        Davie 37059  37059       30  1207
#> 41  0.066     1.070  1950    1950    Alexander 37003  37003        2  1333
#> 42  0.145     1.791  1951    1951     Davidson 37057  37057       29  5509
#> 43  0.134     1.755  1958    1958        Burke 37023  37023       12  3573
#> 44  0.100     1.331  1962    1962   Washington 37187  37187       94   990
#> 45  0.099     1.411  1963    1963      Tyrrell 37177  37177       89   248
#> 46  0.116     1.664  1964    1964     McDowell 37111  37111       56  1946
#> 47  0.201     1.805  1968    1968     Randolph 37151  37151       76  4456
#> 48  0.180     2.142  1973    1973      Chatham 37037  37037       19  1646
#> 49  0.094     1.307  1979    1979       Wilson 37195  37195       98  3702
#> 50  0.134     1.590  1980    1980        Rowan 37159  37159       80  4606
#> 51  0.168     1.791  1984    1984         Pitt 37147  37147       74  5094
#> 52  0.106     1.444  1986    1986      Catawba 37035  37035       18  5754
#> 53  0.168     1.995  1988    1988     Buncombe 37021  37021       11  7515
#> 54  0.207     1.851  1989    1989     Johnston 37101  37101       51  3999
#> 55  0.144     1.690  1996    1996      Haywood 37087  37087       44  2110
#> 56  0.094     3.640  2000    2000         Dare 37055  37055       28   521
#> 57  0.203     3.197  2004    2004     Beaufort 37013  37013        7  2692
#> 58  0.141     2.316  2013    2013        Swain 37173  37173       87   675
#> 59  0.070     1.105  2016    2016       Greene 37079  37079       40   870
#> 60  0.065     1.093  2026    2026          Lee 37105  37105       53  2252
#> 61  0.146     1.778  2027    2027   Rutherford 37161  37161       81  2992
#> 62  0.142     1.655  2029    2029        Wayne 37191  37191       96  6638
#> 63  0.154     1.680  2030    2030      Harnett 37085  37085       43  3776
#> 64  0.118     1.506  2032    2032    Cleveland 37045  37045       23  4866
#> 65  0.078     1.384  2034    2034      Lincoln 37109  37109       55  2216
#> 66  0.125     1.601  2039    2039      Jackson 37099  37099       50  1143
#> 67  0.181     1.980  2040    2040        Moore 37125  37125       63  2648
#> 68  0.143     1.887  2041    2041  Mecklenburg 37119  37119       60 21588
#> 69  0.091     1.321  2042    2042     Cabarrus 37025  37025       13  4099
#> 70  0.130     1.732  2044    2044   Montgomery 37123  37123       62  1258
#> 71  0.103     1.461  2045    2045       Stanly 37167  37167       84  2356
#> 72  0.095     1.471  2047    2047    Henderson 37089  37089       45  2574
#> 73  0.078     1.202  2056    2056       Graham 37075  37075       38   415
#> 74  0.104     1.548  2065    2065       Lenoir 37107  37107       54  3589
#> 75  0.098     1.389  2067    2067 Transylvania 37175  37175       88  1173
#> 76  0.091     1.470  2068    2068       Gaston 37071  37071       36  9014
#> 77  0.060     1.036  2071    2071         Polk 37149  37149       75   533
#> 78  0.131     1.677  2082    2082        Macon 37113  37113       57   797
#> 79  0.241     2.214  2083    2083      Sampson 37163  37163       82  3025
#> 80  0.082     1.388  2085    2085      Pamlico 37137  37137       69   542
#> 81  0.120     1.686  2088    2088     Cherokee 37039  37039       20  1027
#> 82  0.172     1.835  2090    2090   Cumberland 37051  37051       26 20366
#> 83  0.121     1.978  2091    2091        Jones 37103  37103       52   578
#> 84  0.163     1.716  2095    2095        Union 37179  37179       90  3915
#> 85  0.138     1.621  2096    2096        Anson 37007  37007        4  1570
#> 86  0.098     1.262  2097    2097         Hoke 37093  37093       47  1494
#> 87  0.167     2.709  2099    2099         Hyde 37095  37095       48   338
#> 88  0.204     1.871  2100    2100       Duplin 37061  37061       31  2483
#> 89  0.121     1.855  2107    2107     Richmond 37153  37153       77  2756
#> 90  0.051     1.096  2109    2109         Clay 37043  37043       22   284
#> 91  0.177     2.916  2119    2119       Craven 37049  37049       25  5868
#> 92  0.080     1.188  2123    2123     Scotland 37165  37165       83  2255
#> 93  0.195     1.783  2146    2146       Onslow 37133  37133       67 11158
#> 94  0.240     2.004  2150    2150      Robeson 37155  37155       78  7889
#> 95  0.125     2.868  2156    2156     Carteret 37031  37031       16  2414
#> 96  0.225     2.107  2162    2162       Bladen 37017  37017        9  1782
#> 97  0.214     2.152  2185    2185       Pender 37141  37141       71  1228
#> 98  0.240     2.365  2232    2232     Columbus 37047  37047       24  3350
#> 99  0.042     0.999  2238    2238  New Hanover 37129  37129       65  5526
#> 100 0.212     2.024  2241    2241    Brunswick 37019  37019       10  2181
#>     SID74 NWBIR74 BIR79 SID79 NWBIR79                       geometry
#> 1       1      10  1364     0      19 MULTIPOLYGON (((-81.47276 3...
#> 2       0      10   542     3      12 MULTIPOLYGON (((-81.23989 3...
#> 3       5     208  3616     6     260 MULTIPOLYGON (((-80.45634 3...
#> 4       1     123   830     2     145 MULTIPOLYGON (((-76.00897 3...
#> 5       9    1066  1606     3    1197 MULTIPOLYGON (((-77.21767 3...
#> 6       7     954  1838     5    1237 MULTIPOLYGON (((-76.74506 3...
#> 7       0     115   350     2     139 MULTIPOLYGON (((-76.00897 3...
#> 8       0     254   594     2     371 MULTIPOLYGON (((-76.56251 3...
#> 9       4     748  1190     2     844 MULTIPOLYGON (((-78.30876 3...
#> 10      1     160  2038     5     176 MULTIPOLYGON (((-80.02567 3...
#> 11      2     550  1253     2     597 MULTIPOLYGON (((-79.53051 3...
#> 12     16    1243  5386     5    1369 MULTIPOLYGON (((-79.53051 3...
#> 13      4     930  2074     4    1058 MULTIPOLYGON (((-78.74912 3...
#> 14      4     613  1790     4     650 MULTIPOLYGON (((-78.8068 36...
#> 15      4    1179  2753     6    1492 MULTIPOLYGON (((-78.49252 3...
#> 16     18    2365  4463    17    2980 MULTIPOLYGON (((-77.33221 3...
#> 17      3     622  2275     4     933 MULTIPOLYGON (((-76.29893 3...
#> 18      4     200  3725     7     222 MULTIPOLYGON (((-81.02057 3...
#> 19      1      17  1775     1      33 MULTIPOLYGON (((-81.80622 3...
#> 20      1     230   676     0     310 MULTIPOLYGON (((-76.48053 3...
#> 21      1     368   899     1     491 MULTIPOLYGON (((-76.68874 3...
#> 22      0       4   977     0       5 MULTIPOLYGON (((-81.94135 3...
#> 23      1      65  1568     1      76 MULTIPOLYGON (((-80.49554 3...
#> 24      2     736  1863     0     950 MULTIPOLYGON (((-78.25455 3...
#> 25     10    3919 15704    18    5031 MULTIPOLYGON (((-80.0381 36...
#> 26     23    5483 20543    38    7089 MULTIPOLYGON (((-79.53782 3...
#> 27     13    1243  5767    11    1397 MULTIPOLYGON (((-79.24619 3...
#> 28      6     921  1616     5    1161 MULTIPOLYGON (((-76.78307 3...
#> 29      4     776  4478     6    1086 MULTIPOLYGON (((-79.01814 3...
#> 30     16    3732 10432    22    4948 MULTIPOLYGON (((-79.01814 3...
#> 31      8    1851  5189     7    2274 MULTIPOLYGON (((-78.18693 3...
#> 32      0       1   919     2       4 MULTIPOLYGON (((-82.11885 3...
#> 33     10    2186  4359     9    2696 MULTIPOLYGON (((-77.67122 3...
#> 34      6     309  4249     9     360 MULTIPOLYGON (((-81.32813 3...
#> 35      0      12   869     1      10 MULTIPOLYGON (((-82.27921 3...
#> 36      2     883  1849     1    1033 MULTIPOLYGON (((-77.17846 3...
#> 37     16    4397 20857    31    6221 MULTIPOLYGON (((-78.92107 3...
#> 38      2       5   926     2       3 MULTIPOLYGON (((-82.89597 3...
#> 39      4    1144  5400     5    1305 MULTIPOLYGON (((-80.72652 3...
#> 40      1     148  1438     3     177 MULTIPOLYGON (((-80.45677 3...
#> 41      0     128  1683     2     150 MULTIPOLYGON (((-81.10889 3...
#> 42      8     736  7143     8     941 MULTIPOLYGON (((-80.06441 3...
#> 43      5     326  4314    15     407 MULTIPOLYGON (((-81.81628 3...
#> 44      5     521  1141     0     651 MULTIPOLYGON (((-76.40843 3...
#> 45      0     116   319     0     141 MULTIPOLYGON (((-76.1673 35...
#> 46      5     134  2215     5     128 MULTIPOLYGON (((-81.81628 3...
#> 47      7     384  5711    12     483 MULTIPOLYGON (((-79.76499 3...
#> 48      2     591  2398     3     687 MULTIPOLYGON (((-79.55536 3...
#> 49     11    1827  4706    13    2330 MULTIPOLYGON (((-78.06533 3...
#> 50      3    1057  6427     8    1504 MULTIPOLYGON (((-80.29824 3...
#> 51     14    2620  6635    11    3059 MULTIPOLYGON (((-77.47388 3...
#> 52      5     790  6883    21     914 MULTIPOLYGON (((-80.96143 3...
#> 53      9     930  9956    18    1206 MULTIPOLYGON (((-82.2581 35...
#> 54      6    1165  4780    13    1349 MULTIPOLYGON (((-78.53874 3...
#> 55      2      57  2463     8      62 MULTIPOLYGON (((-82.74389 3...
#> 56      0      43  1059     1      73 MULTIPOLYGON (((-75.78317 3...
#> 57      7    1131  2909     4    1163 MULTIPOLYGON (((-77.10377 3...
#> 58      3     281   883     2     406 MULTIPOLYGON (((-83.33182 3...
#> 59      4     534  1178     4     664 MULTIPOLYGON (((-77.80518 3...
#> 60      5     736  2949     6     905 MULTIPOLYGON (((-79.18244 3...
#> 61     12     495  3543     8     576 MULTIPOLYGON (((-81.97144 3...
#> 62     18    2593  8227    23    3073 MULTIPOLYGON (((-78.16319 3...
#> 63      6    1051  4789    10    1453 MULTIPOLYGON (((-78.61274 3...
#> 64     10    1491  5526    21    1729 MULTIPOLYGON (((-81.32282 3...
#> 65      8     302  2817     7     350 MULTIPOLYGON (((-80.95677 3...
#> 66      2     215  1504     5     307 MULTIPOLYGON (((-83.10629 3...
#> 67      5     844  3534     5    1151 MULTIPOLYGON (((-79.60747 3...
#> 68     44    8027 30757    35   11631 MULTIPOLYGON (((-81.0493 35...
#> 69      3     856  5669    20    1203 MULTIPOLYGON (((-80.50294 3...
#> 70      3     472  1598     8     588 MULTIPOLYGON (((-80.07141 3...
#> 71      5     370  3039     7     528 MULTIPOLYGON (((-80.07141 3...
#> 72      5     158  3679     8     264 MULTIPOLYGON (((-82.57003 3...
#> 73      0      40   488     1      45 MULTIPOLYGON (((-83.69563 3...
#> 74     10    1826  4225    14    2047 MULTIPOLYGON (((-77.83658 3...
#> 75      3      92  1401     4     104 MULTIPOLYGON (((-82.8877 35...
#> 76     11    1523 11455    26    2194 MULTIPOLYGON (((-81.32282 3...
#> 77      1      95   673     0      79 MULTIPOLYGON (((-82.21017 3...
#> 78      0       9  1157     3      22 MULTIPOLYGON (((-83.10629 3...
#> 79      4    1396  3447     4    1524 MULTIPOLYGON (((-78.11377 3...
#> 80      1     222   631     1     277 MULTIPOLYGON (((-76.94324 3...
#> 81      2      32  1173     1      42 MULTIPOLYGON (((-84.29104 3...
#> 82     38    7043 26370    57   10614 MULTIPOLYGON (((-78.49929 3...
#> 83      1     297   650     2     305 MULTIPOLYGON (((-77.049 34....
#> 84      4    1034  5273     9    1348 MULTIPOLYGON (((-80.84016 3...
#> 85     15     952  1875     4    1161 MULTIPOLYGON (((-79.91995 3...
#> 86      7     987  1706     6    1172 MULTIPOLYGON (((-79.3403 34...
#> 87      0     134   427     0     169 MULTIPOLYGON (((-76.51894 3...
#> 88      4    1061  2777     7    1227 MULTIPOLYGON (((-77.68983 3...
#> 89      4    1043  3108     7    1218 MULTIPOLYGON (((-79.68596 3...
#> 90      0       1   419     0       5 MULTIPOLYGON (((-83.938 34....
#> 91     13    1744  7595    18    2342 MULTIPOLYGON (((-76.89761 3...
#> 92      8    1206  2617    16    1436 MULTIPOLYGON (((-79.45597 3...
#> 93     29    2217 14655    23    3568 MULTIPOLYGON (((-77.53864 3...
#> 94     31    5904  9087    26    6899 MULTIPOLYGON (((-78.86451 3...
#> 95      5     341  3339     4     487 MULTIPOLYGON (((-77.14896 3...
#> 96      8     818  2052     5    1023 MULTIPOLYGON (((-78.2615 34...
#> 97      4     580  1602     3     763 MULTIPOLYGON (((-78.02592 3...
#> 98     15    1431  4144    17    1832 MULTIPOLYGON (((-78.65572 3...
#> 99     12    1633  6917     9    2100 MULTIPOLYGON (((-77.96073 3...
#> 100     5     659  2655     6     841 MULTIPOLYGON (((-78.65572 3...

sessionInfo()
#> R version 4.3.3 (2024-02-29)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 22.04.5 LTS
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so;  LAPACK version 3.10.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=de_DE.UTF-8        LC_COLLATE=en_US.UTF-8    
#>  [5] LC_MONETARY=de_DE.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=de_DE.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C       
#> 
#> time zone: Europe/Berlin
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] rio_1.2.4 sf_1.0-19
#> 
#> loaded via a namespace (and not attached):
#>  [1] vctrs_0.6.5        cli_3.6.3          knitr_1.49         rlang_1.1.4       
#>  [5] xfun_0.49          DBI_1.2.3          KernSmooth_2.23-22 glue_1.8.0        
#>  [9] htmltools_0.5.8.1  e1071_1.7-16       rmarkdown_2.29     grid_4.3.3        
#> [13] tibble_3.2.1       evaluate_1.0.1     classInt_0.4-10    fastmap_1.2.0     
#> [17] yaml_2.3.10        lifecycle_1.0.4    compiler_4.3.3     fs_1.6.5          
#> [21] pkgconfig_2.0.3    Rcpp_1.0.13-1      R.oo_1.27.0        R.utils_2.12.3    
#> [25] digest_0.6.37      class_7.3-22       reprex_2.1.1       pillar_1.10.0     
#> [29] magrittr_2.0.3     R.methodsS3_1.8.2  tools_4.3.3        withr_3.0.2       
#> [33] proxy_0.4-27       units_0.8-5

Created on 2024-12-19 with reprex v2.1.1

@chainsawriot chainsawriot reopened this Dec 19, 2024
@nhward
Copy link
Author

nhward commented Dec 19, 2024

> library(sf)
> library(rio)
> .import.rio_shp <- function(file, ...) {
+   sf::read_sf(dsn = file, quiet = TRUE)
+ }
> file <- system.file("shape/nc.shp", package="sf")
> rio::get_info(file)
$input
[1] "shp"

$format
[1] NA

$type
[1] NA

$format_name
[1] NA

$import_function
[1] NA

$export_function
[1] NA

$file
[1] "/usr/lib/R/site-library/sf/shape/nc.shp"

> rio::import(file)
Error: Format not supported
> sessionInfo()
R version 4.4.2 (2024-10-31)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 24.04.1 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so;  LAPACK version 3.12.0

locale:
 [1] LC_CTYPE=en_NZ.UTF-8       LC_NUMERIC=C               LC_TIME=en_NZ.UTF-8        LC_COLLATE=en_NZ.UTF-8     LC_MONETARY=en_NZ.UTF-8   
 [6] LC_MESSAGES=en_NZ.UTF-8    LC_PAPER=en_NZ.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_NZ.UTF-8 LC_IDENTIFICATION=C       

time zone: Pacific/Auckland
tzcode source: system (glibc)

attached base packages:
[1] parallel  stats     graphics  grDevices datasets  utils     methods   base     

other attached packages:
 [1] magrittr_2.0.3        shinyWidgets_0.8.7    bsicons_0.1.2         shinymeta_0.2.0.3     conductor_0.1.1       bslib_0.8.0          
 [7] foreach_1.5.2         cli_3.6.3             tibble_3.2.1          stringr_1.5.1         shinycssloaders_1.1.0 shinyjs_2.1.0        
[13] shiny_1.10.0          sf_1.0-15             nanoparquet_0.3.1     fst_0.9.8             yaml_2.3.10           qs_0.27.2            
[19] readODS_2.3.1         rmatio_0.19.0         jsonlite_1.8.9        xml2_1.3.6            pzfx_0.3.0            hexView_0.3-4        
[25] clipr_0.8.0           arrow_18.1.0          markdown_1.13         dplyr_1.1.4           fs_1.6.5              httr_1.4.7           
[31] shinyFiles_0.9.3      rio_1.2.4            

loaded via a namespace (and not attached):
 [1] tidyselect_1.2.1    R.utils_2.12.3      fastmap_1.2.0       promises_1.3.2      stringfish_0.16.0   digest_0.6.37      
 [7] fstcore_0.9.18      mime_0.12           lifecycle_1.0.4     processx_3.8.4      compiler_4.4.2      rlang_1.1.4        
[13] sass_0.4.9          tools_4.4.2         utf8_1.2.4          pkgbuild_1.4.5      curl_6.0.1          bit_4.5.0.1        
[19] classInt_0.4-10     KernSmooth_2.23-24  miniUI_0.1.1.1      R.cache_0.16.0      purrr_1.0.2         desc_1.4.3         
[25] R.oo_1.27.0         grid_4.4.2          fansi_1.0.6         tidymodules_0.1.6   xtable_1.8-4        e1071_1.7-16       
[31] waiter_0.2.5        iterators_1.0.14    shinyanimate_0.4.0  crayon_1.5.3        snippr_0.0.0.9000   remotes_2.5.0      
[37] generics_0.1.3      RcppParallel_5.1.9  rstudioapi_0.17.1   DBI_1.2.3           cachem_1.1.0        proxy_0.4-27       
[43] RApiSerialize_0.1.4 assertthat_0.2.1    vctrs_0.6.5         Matrix_1.7-1        callr_3.7.6         bit64_4.5.2        
[49] jquerylib_0.1.4     units_0.8-5         glue_1.8.0          ps_1.8.1            codetools_0.2-20    stringi_1.8.4      
[55] later_1.4.1         bspm_0.5.7          styler_1.10.3       pillar_1.10.0       htmltools_0.5.8.1   sourcetools_0.1.7-1
[61] R6_2.5.1            lattice_0.22-6      R.methodsS3_1.8.2   memoise_2.0.1       httpuv_1.6.15       class_7.3-22       
[67] Rcpp_1.0.13-1       pkgconfig_2.0.3    

@chainsawriot
Copy link
Collaborator

Could you please restart your R session (It doesn't look like a clean session) and retry? If it still doesn't work, could you please run this and show us the output?

rio:::.query_format

It's just weird that your rio:::.query_format() still has the old behavior of 1.2.3, i.e. returning NA for type.

@nhward
Copy link
Author

nhward commented Dec 19, 2024

It seems that a restart of RStudio was all that was required. I have not encountered that before. How curious.
Everything is working now. Shape files are being read.

Well done and thanks

Requested output below:

rio:::.query_format
function (input, file) 
{
    unique_rio_formats <- unique(rio_formats[, colnames(rio_formats) != 
        "note"])
    if (file == "clipboard") {
        output <- as.list(unique_rio_formats[unique_rio_formats$format == 
            "clipboard", ])
        output$file <- file
        return(output)
    }
    matched_formats <- unique_rio_formats[unique_rio_formats$input == 
        input, ]
    if (nrow(matched_formats) == 0) {
        return(list(input = input, format = input, type = "unknown", 
            format_name = NA, import_function = NA, export_function = NA, 
            file = file))
    }
    output <- as.list(matched_formats)
    output$file <- file
    return(output)
}
<bytecode: 0x65395fbd4c40>
<environment: namespace:rio>
> 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants