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

Provide more informative warning when argument vectors are recycled #53

Open
matt-dray opened this issue Apr 12, 2024 · 0 comments
Open
Labels
enhancement New feature or request Hacktoberfest help wanted Extra attention is needed

Comments

@matt-dray
Copy link
Collaborator

Let the user know about mismatches in input-vector lengths. Related to #28.

Use {cli} and ... approach as per #50 to accept the length of any number of arguments, check them for length and report back to the user. Will likely need to be a tryCatch() to suppress the default R message and replace with our own.

We're doing this to provide a nicer user-interface. The default warning is terse:

> 1:2 + 1:3
[1] 2 4 4
Warning message:
In 1:2 + 1:3 :
  longer object length is not a multiple of shorter object length

And it prints multiple times with multiple violations:

> 1:2 + 1:3 + 1:4
[1] 3 6 7 6
Warning messages:
1: In 1:2 + 1:3 :
  longer object length is not a multiple of shorter object length
2: In 1:2 + 1:3 + 1:4 :
  longer object length is not a multiple of shorter object length

It's probably fine not to warn when one of the arguments is length 1, though. There's no warning for this in base either.

> 1 + 1:2
[1] 2 3
@matt-dray matt-dray added the enhancement New feature or request label Apr 12, 2024
@chrismainey chrismainey added the help wanted Extra attention is needed label Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Hacktoberfest help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants