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

Year state mismatch CLI error message #3

Closed
ran-codes opened this issue Jun 12, 2023 · 2 comments
Closed

Year state mismatch CLI error message #3

ran-codes opened this issue Jun 12, 2023 · 2 comments

Comments

@ran-codes
Copy link

It would be iuseful for the error message to be more targeted by error type. This way users can quickly figure out what they are doing wrong. Lets say we have the following types of errors; see suggested CLI messages

  • type 1: too many years and not enough states.
  • type 2: too many states not enough years.
  • type 3: too many year for a single

type 1: too many years and not enough states.

> years_tmp = 2015:2017
> state_tmp = 'PA'
> df1 = summarise_svi(
+   year = years_tmp,
+   state = state_tmp,
+   geography = 'zcta' )
! The number of years and states requested are not the same.
> Consider using pairs of year and state. For nation level data ('state = NULL'), use single year argument.

A more useful CLI message for a new user:

! You inputed 3 years but only one state. find_svi() requires year and state requests to be 1:1.
> If you mean to find get multiple years of data for {state}. Try rep({state},3) as the state arguement.

type 2: too many states not enough years.

same logic as type 1

A more useful CLI message for a new user:

! You inputed 1 years but only four state. find_svi() requires year and state requests to be 1:1.
> If you mean to find get multiple state of data for one year. Try rep({year},length(state)) as the year arguement.
@heli-xu
Copy link
Owner

heli-xu commented Jun 16, 2023

Thanks for the detailed message and examples! Updated as suggested, also added messages for nation-level request (state = NULL or "US").

@ran-codes
Copy link
Author

Looks great. It seems like!

storeing test code for future reference

## case 1/3
years_tmp = 2015:2017
state_tmp = 'PA'
df1 = find_svi(
    year = years_tmp,
    state = state_tmp,
    geography = 'zcta' )
## case 2
years_tmp = 2015 
state_tmp = rep('PA',5)
df1 = find_svi(
  year = years_tmp,
  state = state_tmp,
  geography = 'zcta' )

@heli-xu heli-xu closed this as completed Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants