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

Updates to ckan_fetch() and examples #115

Merged
merged 4 commits into from
Jun 27, 2019
Merged

Conversation

sharlagelfand
Copy link
Contributor

A few changes to the functionality of ckan_fetch() and the functions it depends on:

  • Uses sf::st_read() instead of the deprecatedmaptools::readShapePoints(), closes fetch() fails on SHP due to deprecated method in maptools #114
  • Updated examples in ckan_fetch() due to http://publicdata.eu/ moving -- have changed them to some very 🇨🇦 centric ones!
  • Allows reading and parsings of xlsx files (in addition to xls files already supported)
  • (Some whitespace changes that just happen as a result of saving the file in RStudio -- not nitpicking your spaces!)

for the xlsx change, e.g. ckan_fetch() would return nothing with the current version ofckanr but works fine with the PR'd version:

library(ckanr)
#> Loading required package: DBI
ckanr_setup("https://ckan0.cf.opendata.inter.sandbox-toronto.ca")

res <- resource_show(id = "16772166-372d-422a-9bf0-a3d39c12d3a7", as = "table")

res$url
#> [1] "https://www.toronto.ca/ext/open_data/catalog/data_set_files/2017_Subway_Platform_Usage_Open_Data_Toronto.xlsx"

ckan_fetch(res$url)
#> New names:
#> * `` -> ...2
#> * `` -> ...3
#> * `` -> ...4
#> * `` -> ...5
#> * `` -> ...6
#> # A tibble: 79 x 6
#>    `Toronto Transit Commission`        ...2     ...3      ...4  ...5  ...6 
#>    <chr>                               <chr>    <chr>     <chr> <chr> <chr>
#>  1 Subway Station usage counts, 2017   <NA>     <NA>      <NA>  <NA>  <NA> 
#>  2 Showing number of customers travel… <NA>     <NA>      <NA>  <NA>  <NA> 
#>  3 <NA>                                <NA>     <NA>      <NA>  <NA>  <NA> 
#>  4 Rank, Total, of 74                  Station  Subway/R… To    From  Total
#>  5 1                                   BLOOR-Y… 1 Yonge-… 93924 1107… 2046…
#>  6 2                                   BLOOR-Y… 2 Bloor-… 96309 1001… 1964…
#>  7 3                                   UNION    1 Yonge-… 67881 60774 1286…
#>  8 4                                   ST. GEO… 1 Yonge-… 62131 64797 1269…
#>  9 5                                   ST. GEO… 2 Bloor-… 62668 62508 1251…
#> 10 6                                   FINCH    1 Yonge-… 43356 48707 92063
#> # … with 69 more rows

Created on 2019-06-26 by the reprex package (v0.2.1)

I didn't see any existing tests for ckan_fetch(), read_session(), or fetch_GET() but please let me know if I missed them!

Also, please let me know if I should update the codemeta to reflect the removal of maptools and addition of sf -- I think yes but wasn't 100% sure! I'll do so if needed.

Thanks!

@sckott
Copy link
Contributor

sckott commented Jun 27, 2019

thanks @sharlagelfand having a look

@sckott
Copy link
Contributor

sckott commented Jun 27, 2019

  • make sure to run document() or equiv. to update the manual file
  • i badly need to add tests for this function - i'll do that soon, after this
  • please do update codemeta

@sharlagelfand
Copy link
Contributor Author

thanks! i've updated the codemeta using codemetar::write_codemeta(). I ran document() before and don't see any changes doing it again now.

@sckott sckott added this to the v0.2 milestone Jun 27, 2019
@sckott
Copy link
Contributor

sckott commented Jun 27, 2019

thanks looks good

@sckott sckott merged commit e1705fc into ropensci:master Jun 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fetch() fails on SHP due to deprecated method in maptools
2 participants