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

argument checks for all user facing functions #111

Merged

Conversation

e-kotov
Copy link
Member

@e-kotov e-kotov commented Dec 13, 2024

  • argument checks for all user facing functions
  • (plus a bug fix for an embarrassing error with 0 cpu cores on 1 core machines)

I think this is a final functionality and documentation focussed PR before I reshuffle the functions into separate files for a final cleanup and submit to CRAN. We still have until 23 Dec to submit and their current newbies queue is unusually small (just over 10 packages, see https://nx10.github.io/cransubs/ or https://r-hub.github.io/cransays/articles/dashboard.html ).

@e-kotov e-kotov linked an issue Dec 13, 2024 that may be closed by this pull request
@Robinlovelace
Copy link
Collaborator

Thanks Egor, will take a look later today.

@@ -40,26 +40,44 @@ spod_convert <- function(
data_dir = spod_get_data_dir(),
quiet = FALSE,
max_mem_gb = max(4, spod_available_ram() - 4),
max_n_cpu = parallelly::availableCores() - 1,
max_n_cpu = max(1, parallelly::availableCores() - 1),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

zones <- match.arg(zones)

# Validate inputs
checkmate::assert_choice(type, choices = c("od", "origin-destination", "os", "overnight_stays", "nt", "number_of_trips"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to see all these additional checks.

@@ -481,7 +486,7 @@ entry-spacing="0">

Lovelace, Robin, and Malcolm Morgan. 2024. “Od: Manipulate and Map
Origin-Destination Data,” August.
<https://cran.r-project.org/web/packages/od/od.pdf>.
<https://doi.org/10.32614/CRAN.package.od>.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@e-kotov e-kotov merged commit da7a822 into main Dec 13, 2024
1 check passed
@e-kotov e-kotov deleted the 23-improve-type-safety-with-rlang-or-assertthat-or-checkmate branch December 13, 2024 17:24
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

Successfully merging this pull request may close these issues.

improve type safety with rlang or assertthat or checkmate
2 participants