Giter VIP home page Giter VIP logo

regioncode's People

Contributors

17-panyx avatar already-love avatar calvin-sen avatar chenyuanqian18 avatar gohuntsuan avatar kimi-debug-maker avatar li-juiche avatar sammo3182 avatar sing-alou avatar syfyufei avatar xinyigua avatar yangtzesyy avatar zhumeng-gif avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

regioncode's Issues

Name of "xinjiang"

In the published version, the Chinese title of Xinjiang is incorrect. "**维吾尔自治区" instead.

Function: Guessing

Given a vector of codes or names, the function can guess which year they matched the most

Ning Xia

The full name of "Ning Xia" is wrong.

宁夏回族自治州 -> 宁夏回族自治区

Error in `province`

library(regioncode)

regioncode(
  data_input = corruption$province_id,
  convert_to = "name",
  year_from = 2019,
  year_to = 1989,
  province = TRUE
)
#> Joining with `by = join_by(prov_scode)`
#>  [1] NA NA NA NA NA NA NA NA NA NA

Also check for convert_to = "code"

Unrecognized characters in 江西_四川_重庆_西藏 Dataset

In ./data/江西_四川_重庆_西藏.xlsx, some name/sname values contain unrecognized or incorrect characters. For example, in line 46, '1988_name' has value ' 内江市' instead of '内江市‘. Function will return NA because of unrecognized characters.

city level in XinJiang

  1. **城市人口缺失,无法形成citylevlel,补全人口数据
  2. **的city一级应该是XX地区(伊宁地区等),**的市是county一级

Function: Reading codes returning names

Users give a vector of codes and year, the function can return names of the prefecture, codes or names of the prefectures in another given year by choice.

JOSS article

  • Figuring out how to publish in JOSS
  • Writing the paper out
  • Publishing

Shan Xi

The pinyin package did not present Shaanxi correctly.

Not "1-1" output

The example in the vignette shows the wrong results with the new function. The input only has 18947 lines but the output has 21513 lines.

temp <- regioncode(data_input = corruption$prefecture_id,
convert_to = "code", # default set
year_from = 2019,
year_to = 1989)

Multiple output

Sometimes, cross-year conversion produces multiple outputs.

To "area" function does not work properly for province

> regioncode::regioncode(df_wave1$province_q180, year_from = 1999, convert_to = "area", province = TRUE)
Error in `select()`:
! Can't subset columns that don't exist.Column `1999` doesn't exist.
Backtrace:
  1. regioncode::regioncode(...)
 12. dplyr:::select.data.frame(region_table, !!ls_index)
 15. tidyselect::eval_select(expr(c(...)), .data)
 16. tidyselect:::eval_select_impl(...)
 25. tidyselect:::vars_select_eval(...)
     ...
 28. tidyselect:::reduce_sels(node, data_mask, context_mask, init = init)
 29. tidyselect:::walk_data_tree(new, data_mask, context_mask)
 30. tidyselect:::as_indices_sel_impl(...)
 31. tidyselect:::as_indices_impl(x, vars, call = call, strict = strict)
 32. tidyselect:::chr_as_locations(x, vars, call = call)
  • Fixed the codes
  • Release a new version

Simplify the Methods

Simplifying the method to "toCode," "toName," etc. by detecting the input's class (numeric, characters)

(Maybe) A mistake in raw data

There might be a mistake in the region_table. (don't know what "<U+00A0>" stands for)

region_table[408,"2019_name"]
[1] "<U+00A0>成都市"

Packaging

Preparing the package for the CRAN submission and future plans

data missing

didin‘t receive region data of Gansu, Qinghai, Shaanxi, Xinjiang, Hunan, Yunnan, Guizhou, Ningxia.

Package example codes didn't work

if I run the example

library(regioncode)

regioncode::regioncode(data_input = corruption$prefecture_id,
                       year_from = 2019,
                       year_to = 1999)

them R told me

Error in regioncode::regioncode(data_input = corruption$prefecture_id, :
object 'corruption' not found

Error in `zhixiashi`

library(regioncode)

names_municipality <- c("北京", # Beijing, a municipality
                            "海淀区", # A district of Beijing
                            "上海", # Shanghai, a municipality
                            "静安区", # A district of Shanghai
                            "济南市") # A prefecture of Shandong

regioncode(
  data_input = names_municipality,
  year_from = 2019,
  year_to = 2019,
  convert_to = "code",
  zhixiashi = FALSE
)
#> Joining with `by = join_by(`2019_name`)`
#> [1]     NA 110108     NA 310106 370100

# When `zhixiashi` is TRUE, muncipalities are

regioncode(
  data_input = names_municipality,
  year_from = 2019,
  year_to = 2019,
  convert_to = "code",
  zhixiashi = TRUE
)
#> Error in `filter()`:
#> ℹ In argument: `zhixiashi`.
#> Caused by error:
#> ! `..1` must be a logical vector, not a character vector.
#> Backtrace:
#>      ▆
#>   1. ├─regioncode::regioncode(...)
#>   2. │ └─region_data %>% filter(zhixiashi) at regioncode/R/regioncode.R:268:8
#>   3. ├─dplyr::filter(., zhixiashi)
#>   4. ├─dplyr:::filter.data.frame(., zhixiashi)
#>   5. │ └─dplyr:::filter_rows(.data, dots, by)
#>   6. │   └─dplyr:::filter_eval(...)
#>   7. │     ├─base::withCallingHandlers(...)
#>   8. │     └─mask$eval_all_filter(dots, env_filter)
#>   9. │       └─dplyr (local) eval()
#>  10. ├─dplyr:::dplyr_internal_error(...)
#>  11. │ └─rlang::abort(class = c(class, "dplyr:::internal_error"), dplyr_error_data = data)
#>  12. │   └─rlang:::signal_abort(cnd, .file)
#>  13. │     └─base::signalCondition(cnd)
#>  14. └─dplyr (local) `<fn>`(`<dpl:::__>`)
#>  15.   └─rlang::abort(message, class = error_class, parent = parent, call = error_call)

Toy data failed to load

I try to run the example code in help file,

library(regioncode)

regioncode(data_input = corruption$prefecture_id,
           year_from = 2019,
          year_to = 1999)

But it seem to doesn't work. The error message is

Error in regioncode(data_input = corruption$prefecture_id, year_from = 2019, :
object 'corruption' not found

I guess the toy data corruption may not be successfully loaded.

Data collection

Create a spreadsheet for administrative codes of Chinese prefectural regions from 1986 to 2019. The data frame includes two fixed columns:

~prov_name, ~prov_code

For each year, the data ought to include the following columns:

~<year>_sname, ~<year>_name, ~<year>_code

Vignette

See the reference from countrycode, dotwhisker, and interplot

Adding a Chinese version

Publicity

  • Report for college and department websites
  • Wechat push
  • Logo design

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.