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

Bug in current_mps() and council_seats() #8

Open
Chris-Larkin opened this issue Apr 14, 2023 · 1 comment
Open

Bug in current_mps() and council_seats() #8

Chris-Larkin opened this issue Apr 14, 2023 · 1 comment
Labels

Comments

@Chris-Larkin
Copy link

Chris-Larkin commented Apr 14, 2023

I just installed parlitools from CRAN and attempted to run the current_mps() function but received an error.

I ran this code:

library(parlitools)
current_mps <- parlitools::current_mps()

And received this error:

Error:
! Assigned data `as.character(df$DateOfBirth)` must be compatible with existing data.
✖ Existing data has 650 rows.
✖ Assigned data has 0 rows.
ℹ Only vectors of size 1 are recycled.
Run `rlang::last_error()` to see where the error occurred.
Warning message:
Unknown or uninitialised column: `DateOfBirth`. 

And this is the related output of rlang::last_trace():

Backtrace:
     ▆
  1. ├─parlitools::current_mps()
  2. │ ├─base::`$<-`(`*tmp*`, "DateOfBirth", value = `<chr>`)
  3. │ └─tibble:::`$<-.tbl_df`(`*tmp*`, "DateOfBirth", value = `<chr>`)
  4. │   └─tibble:::tbl_subassign(...)
  5. │     └─tibble:::vectbl_recycle_rhs_rows(...)
  6. │       ├─base::withCallingHandlers(...)
  7. │       └─vctrs::vec_recycle(value[[j]], nrow)
  8. ├─vctrs:::stop_recycle_incompatible_size(...)
  9. │ └─vctrs:::stop_vctrs(...)
 10. │   └─rlang::abort(message, class = c(class, "vctrs_error"), ..., call = vctrs_error_call(call))
 11. │     └─rlang:::signal_abort(cnd, .file)
 12. │       └─base::signalCondition(cnd)
 13. └─tibble (local) `<fn>`(`<vctrs___>`)
 14.   └─rlang::cnd_signal(...)

I also attempted to call council_seats() and received the following error:

> council_seats <- council_seats(councillors = TRUE)
Error in `council_data[c("id", "ons code", "name", "type")]`:                                                                                               
! Can't subset columns that don't exist.
✖ Column `type` doesn't exist.

And this is the related output of rlang::last_trace():

Backtrace:
     ▆
  1. ├─parlitools::council_seats(councillors = TRUE)
  2. │ ├─council_data[c("id", "ons code", "name", "type")]
  3. │ ├─readr:::`[.spec_tbl_df`(...)
  4. │ ├─base::NextMethod(`[`)
  5. │ └─tibble:::`[.tbl_df`(council_data, c("id", "ons code", "name", "type"))
  6. │   └─tibble:::vectbl_as_col_location(...)
  7. │     ├─tibble:::subclass_col_index_errors(...)
  8. │     │ └─base::withCallingHandlers(...)
  9. │     └─vctrs::vec_as_location(j, n, names, call = call)
 10. └─vctrs (local) `<fn>`()
 11.   └─vctrs:::stop_subscript_oob(...)
 12.     └─vctrs:::stop_subscript(...)
 13.       └─rlang::abort(...)

Possibly helpful for debugging, this is my sessionInfo():

> sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Ventura 13.2.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

Random number generation:
 RNG:     Mersenne-Twister 
 Normal:  Inversion 
 Sample:  Rounding 
 
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] parlitools_0.4.1 kableExtra_1.3.4 forcats_0.5.2    stringr_1.5.0    dplyr_1.0.10     purrr_0.3.5      readr_2.1.3      tidyr_1.2.1      tibble_3.1.8    
[10] ggplot2_3.4.0    tidyverse_1.3.2 

I would submit a PR but I don't know how to debug this! Sorry. Just flagging as it seems like this is a problem with the package

@Chris-Larkin Chris-Larkin changed the title Bug in current_mps() Bug in current_mps() and council_seats() Apr 14, 2023
@evanodell evanodell added the bug label Apr 16, 2023
@evanodell
Copy link
Owner

The issue is that is relying on an older API, I'll try to update it to the better API later this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants