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

Error in ellis-demography #22

Open
andkov opened this issue Dec 3, 2022 · 2 comments
Open

Error in ellis-demography #22

andkov opened this issue Dec 3, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@andkov
Copy link
Contributor

andkov commented Dec 3, 2022

When replicating, the script ./manipulate/ellis-demography.R generates the following error, seemingly from cause by line 132:

Error in `mutate()`:
! Problem while computing `hromada_name = str_replace(hromada_name, "i", "і")`.
Caused by error in `stri_replace_first_regex()`:
! object 'hromada_name' not found
Run `rlang::last_error()` to see where the error occurred.
@andkov andkov added the bug Something isn't working label Dec 3, 2022
@andkov
Copy link
Contributor Author

andkov commented Dec 3, 2022

@velgaks

It looks like the underlying file, /data-private/derived/hromada.csv is wrong on my machine.

> ds_hromada <- readr::read_delim("./data-private/derived/hromada.csv", delim = ';')
Rows: 1470 Columns: 1                                                                                                                 
-- Column specification ---------------------------------------------------------------------------
Delimiter: ";"
chr (1): hromada_code,main_rada_code,rada_codes_final

i Use `spec()` to retrieve the full column specification for this data.
i Specify the column types or set `show_col_types = FALSE` to quiet this message.
> ds_hromada %>% glimpse()
Rows: 1,470
Columns: 1
$ `hromada_code,main_rada_code,rada_codes_final` <chr> "UA80,8000000000,8000000000", "UA741003900~
> ds_hromada <- readr::read_delim("./data-private/derived/hromada.csv", delim = ';') %>% 
+   mutate(
+     key = paste(hromada_name, type, "громада")
+   )
Rows: 1470 Columns: 1  

it does not contain the columns hromada_name and type that are called in the next step:

ds_hromada <- readr::read_delim("./data-private/derived/hromada.csv", delim = ';') %>% 
  mutate(
    key = paste(hromada_name, type, "громада")
  )

The file ./data-private/derived/hromada.csv" is produced by ./manipulation/ellis-ua-admin.R`. I'll be following up.

@andkov
Copy link
Contributor Author

andkov commented Dec 3, 2022

hromada.cvs produced by ./manipulation/ellis-rada-hromada.R
image

hromada.csv produced by ./manipulation/ellis-ua-admin.R
image

Given that line 35 of ./manipulation/ellis-survey.R calls for columns hromada_name and type it must working with the product of ./manipulation/ellis-ua-admin.R and not ./manipulation/ellis-rada-hromada.R

andkov added a commit that referenced this issue Dec 3, 2022
see #22 - this product is superseded by ./manipulation/ellis-ua-admin.R

Co-Authored-By: ValHat <61630702+velgaks@users.noreply.github.com>
Co-Authored-By: Serhii Tytiuk <35730261+Tytser@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants