ipeaGIT / aopdata

Download data from the Access to Opportunities Project (AOP)

Home Page:https://ipeagit.github.io/aopdata/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Filter only available cities when reading access for public transport

kauebraga opened this issue · comments

Right now, the behavior when trying to download accessibility by public transport for all cities returns an error:

# download data
aop_data <- aopdata::read_access(city = "all", mode = "public_transport", year = 2019, geometry = TRUE)

`Using mode public_transport
Downloading accessibility data for the year 2019
  |======================================================================================================| 100%
Error in aopdata::read_access(city = "all", mode = "public_transport",  : 
  One of the selected cities does not have public transport data for that year.`

I think it would be nice to pre-filter only cities with public transport for that year and return the accessibility estimates for them, instead of returning an error.
A message indicating the cities would be nice as well.

I thought I had fixed this [rolling eye emoji]

Even when I specify the city, the function doesn't seem to work.

> aopdata::read_access(city = 'Rio de Janeiro')
Using mode walk
Downloading accessibility data from the year 2019
  |===================================================================================| 100%
Downloading land use data from the year 2019
Downloading population data from year 2010
Error in data.table::setkeyv(aop_access, c("abbrev_muni", "name_muni",  : 
  some columns are not in the data.table: name_muni,code_muni

@igorlaltuf , I belive you are using and earlier version of the package. Please try installing the latest dev version from github

utils::remove.packages('aopdata')

devtools::install_github("ipeaGIT/aopdata", subdir = "r-package")
library(aopdata)

df <- aopdata::read_access(city = 'Rio de Janeiro')

@rafapereirabr , thank you! Worked perfectly. I'm organizing an introductory R class for my labmates and I'm going to use the aopdata package as an example of the potential that R has in urban studies research. Congratulations on the work.

Thank you, @igorlaltuf . We are currently working on an online book with a hands-on approach to accessibilty modeling in R. We should have a 1st version ready by September 2022

Solved. Please try usig the updated dev version and let me know if the problem persists.

utils::remove.packages('aopdata')

devtools::install_github("ipeaGIT/aopdata", subdir = "r-package")
library(aopdata)