uribo / jpndistrict

🗾 Create Japansese Administration Area Maps
http://uribo.github.io/jpndistrict
Other
22 stars 3 forks source link

Mismatching variable names in `jpn_pref()` #17

Closed uribo closed 6 years ago

uribo commented 6 years ago
library(jpndistrict)
#> Loading required package: jpmesh
#> This package provide map data is based on the Digital Map 25000
#> (Map Image) published by Geospatial Information Authority of Japan
#> (Approval No.603FY2017 information usage <http://www.gsi.go.jp>)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
sf_pref33_distinct <- 
    jpn_pref(33)
sf_pref33 <- 
    jpn_pref(33, district = FALSE)

glimpse(sf_pref33_distinct)
#> Observations: 30
#> Variables: 5
#> $ pref_code  <chr> "33", "33", "33", "33", "33", "33", "33", "33", "33...
#> $ prefecture <chr> "岡山県", "岡山県", "岡山県", "岡山県", "岡山県", "岡山県", "岡山県", "岡...
#> $ city_code  <chr> "33101", "33102", "33103", "33104", "33202", "33203...
#> $ city       <chr> "岡山市 北区", "岡山市 中区", "岡山市 東区", "岡山市 南区", "倉敷市", "津山市...
#> $ geometry   <GEOMETRY [°]> POLYGON ((133.9098 34.948, ..., MULTIPOLYG...
glimpse(sf_pref33)
#> Observations: 1
#> Variables: 3
#> $ jis_code   <chr> "33"
#> $ prefecture <chr> "岡山県"
#> $ geometry   <MULTIPOLYGON [°]> MULTIPOLYGON (((133.3294 34...

Created on 2018-06-20 by the reprex package (v0.2.0).

Session info ``` r devtools::session_info() #> Session info ------------------------------------------------------------- #> setting value #> version R version 3.5.0 (2018-04-23) #> system x86_64, darwin17.5.0 #> ui unknown #> language En #> collate ja_JP.UTF-8 #> tz Asia/Tokyo #> date 2018-06-20 #> Packages ----------------------------------------------------------------- #> package * version date source #> assertthat 0.2.0 2017-04-11 CRAN (R 3.5.0) #> backports 1.1.2 2017-12-13 CRAN (R 3.5.0) #> base * 3.5.0 2018-05-02 local #> bindr 0.1.1 2018-03-13 CRAN (R 3.5.0) #> bindrcpp * 0.2.2 2018-03-29 CRAN (R 3.5.0) #> class 7.3-14 2015-08-30 CRAN (R 3.5.0) #> classInt 0.2-3 2018-04-16 CRAN (R 3.5.0) #> compiler 3.5.0 2018-05-02 local #> crosstalk 1.0.0 2016-12-21 CRAN (R 3.5.0) #> datasets * 3.5.0 2018-05-02 local #> DBI 1.0.0 2018-05-02 CRAN (R 3.5.0) #> devtools 1.13.5 2018-02-18 CRAN (R 3.5.0) #> digest 0.6.15 2018-01-28 CRAN (R 3.5.0) #> dplyr * 0.7.5 2018-05-19 CRAN (R 3.5.0) #> e1071 1.6-8 2017-02-02 CRAN (R 3.5.0) #> evaluate 0.10.1 2017-06-24 CRAN (R 3.5.0) #> glue 1.2.0 2017-10-29 CRAN (R 3.5.0) #> graphics * 3.5.0 2018-05-02 local #> grDevices * 3.5.0 2018-05-02 local #> grid 3.5.0 2018-05-02 local #> htmltools 0.3.6 2017-04-28 CRAN (R 3.5.0) #> htmlwidgets 1.2 2018-04-19 CRAN (R 3.5.0) #> httpuv 1.4.3 2018-05-10 CRAN (R 3.5.0) #> jpmesh * 1.1.0 2018-02-25 CRAN (R 3.5.0) #> jpndistrict * 0.3.2 2018-06-14 CRAN (R 3.5.0) #> knitr 1.20 2018-02-20 CRAN (R 3.5.0) #> later 0.7.3 2018-06-08 CRAN (R 3.5.0) #> leaflet 2.0.1 2018-06-04 CRAN (R 3.5.0) #> magrittr 1.5 2014-11-22 CRAN (R 3.5.0) #> memoise 1.1.0 2017-04-21 CRAN (R 3.5.0) #> methods * 3.5.0 2018-05-02 local #> mime 0.5 2016-07-07 CRAN (R 3.5.0) #> miniUI 0.1.1.1 2018-05-18 CRAN (R 3.5.0) #> pillar 1.2.3 2018-05-25 CRAN (R 3.5.0) #> pkgconfig 2.0.1 2017-03-21 CRAN (R 3.5.0) #> promises 1.0.1 2018-04-13 CRAN (R 3.5.0) #> purrr 0.2.5 2018-05-29 CRAN (R 3.5.0) #> R6 2.2.2 2017-06-17 CRAN (R 3.5.0) #> Rcpp 0.12.17 2018-05-18 CRAN (R 3.5.0) #> rlang 0.2.1 2018-05-30 CRAN (R 3.5.0) #> rmarkdown 1.10 2018-06-11 CRAN (R 3.5.0) #> rprojroot 1.3-2 2018-01-03 CRAN (R 3.5.0) #> sf 0.6-4 2018-06-18 Github (r-spatial/sf@f431e00) #> shiny 1.1.0 2018-05-17 CRAN (R 3.5.0) #> spData 0.2.9.0 2018-06-17 CRAN (R 3.5.0) #> stats * 3.5.0 2018-05-02 local #> stringi 1.2.3 2018-06-12 CRAN (R 3.5.0) #> stringr 1.3.1 2018-05-10 CRAN (R 3.5.0) #> tibble 1.4.2 2018-01-22 CRAN (R 3.5.0) #> tidyr 0.8.1 2018-05-18 CRAN (R 3.5.0) #> tidyselect 0.2.4 2018-02-26 CRAN (R 3.5.0) #> tools 3.5.0 2018-05-02 local #> units 0.6-1 2018-06-18 Github (r-quantities/units@0ed0689) #> utils * 3.5.0 2018-05-02 local #> withr 2.1.2 2018-03-15 CRAN (R 3.5.0) #> xtable 1.8-2 2016-02-05 CRAN (R 3.5.0) #> yaml 2.1.19 2018-05-01 CRAN (R 3.5.0) ```
uribo commented 6 years ago

Should work a like this.

library(jpndistrict)
#> Loading required package: jpmesh
#> This package provide map data is based on the Digital Map 25000
#> (Map Image) published by Geospatial Information Authority of Japan
#> (Approval No.603FY2017 information usage <http://www.gsi.go.jp>)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union

sf_pref33_distinct <- 
  jpn_pref(33)
sf_pref33 <- 
  jpn_pref(33, district = FALSE)

glimpse(sf_pref33_distinct)
#> Observations: 30
#> Variables: 5
#> $ pref_code  <chr> "33", "33", "33", "33", "33", "33", "33", "33", "33...
#> $ prefecture <chr> "岡山県", "岡山県", "岡山県", "岡山県", "岡山県", "岡山県", "岡山県", "岡...
#> $ city_code  <chr> "33101", "33102", "33103", "33104", "33202", "33203...
#> $ city       <chr> "岡山市 北区", "岡山市 中区", "岡山市 東区", "岡山市 南区", "倉敷市", "津山市...
#> $ geometry   <GEOMETRY [°]> POLYGON ((133.9098 34.948, ..., MULTIPOLYG...
glimpse(sf_pref33)
#> Observations: 1
#> Variables: 3
#> $ pref_code  <chr> "33"
#> $ prefecture <chr> "岡山県"
#> $ geometry   <MULTIPOLYGON [°]> MULTIPOLYGON (((133.3294 34...

Created on 2018-06-20 by the reprex package (v0.2.0).