Git Product home page Git Product logo

geolocchina's People

Contributors

chrismuir avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

pcdi

geolocchina's Issues

Geocode mismatch when prov and county_2015 strings in input

This issue is related to instances in which geolocChina::geo_locate() has to resort to searching through the county_2015 package data substrings to try to fill in the output city variables.

# Establish variables for examples below
base_str <- "工业路25号"
df <- geolocChina::get_package_data()

When using the county_2015 substrings after no matches have been found for province, city, nor county, the function works great:

x <- paste0("北市区", base_str)
geolocChina::geo_locate(x)
#>           location province city county province_code city_code county_code
#> 1 北市区工业路25号     河北 保定   <NA>            13      1306          NA

df[df$region == "北市区", ]
#>      region geocode region_type
#> 3238 北市区  130603 county_2015

However, if there was a province match, but the function uses the county_2015 substrings to try to fill in missing city output data, there are no checks to ensure the output geocodes align (first two digits of the city geocode must match the provincial geocode):

x <- paste0("浙江省", "北市区", base_str)
geolocChina::geo_locate(x)
#>                 location province city county province_code city_code county_code
#> 1 浙江省北市区工业路25号     浙江 保定   <NA>            33      1306          NA

The expected output should be this:

#>           location province city county province_code city_code county_code
#> 1 浙江省工业路25号     浙江 <NA>   <NA>            33        NA          NA

I believe the fix is easy, currently cpp function substring_lookup_cnty_2015() handles substring lookups for the county_2015 substrings; I think I just need a version of this that takes in a parent code and validates any substring matches against it, similar to the cpp function substring_lookup_city_w_code().

hard-coded installation path (--no-staged-install)

On this setup

> sessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS High Sierra 10.13.6

I get the following error: ERROR: hard-coded installation path: please report to the package maintainer and use ‘--no-staged-install’. So geolocChina has to be installed through devtools::install_github("ChrisMuir/geolocChina", INSTALL_opts ="--no-staged-install").

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.