{"id":14066260,"url":"https://github.com/jonthegeek/stbl","last_synced_at":"2025-03-21T13:30:55.688Z","repository":{"id":185858507,"uuid":"674220078","full_name":"jonthegeek/stbl","owner":"jonthegeek","description":"Stabilize Function Arguments","archived":false,"fork":false,"pushed_at":"2024-11-07T19:49:16.000Z","size":5028,"stargazers_count":14,"open_issues_count":21,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-18T01:42:38.627Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://jonthegeek.github.io/stbl/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonthegeek.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-03T12:15:57.000Z","updated_at":"2024-11-07T19:47:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"e543d7cf-eb38-4d21-a9b2-e78624451784","html_url":"https://github.com/jonthegeek/stbl","commit_stats":null,"previous_names":["jonthegeek/ykwim"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonthegeek%2Fstbl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonthegeek%2Fstbl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonthegeek%2Fstbl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonthegeek%2Fstbl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonthegeek","download_url":"https://codeload.github.com/jonthegeek/stbl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244806058,"owners_count":20513370,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-13T07:05:00.847Z","updated_at":"2025-03-21T13:30:55.671Z","avatar_url":"https://github.com/jonthegeek.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# stbl\n\n\u003c!-- badges: start --\u003e\n[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)\n[![CRAN status](https://www.r-pkg.org/badges/version/stbl)](https://CRAN.R-project.org/package=stbl)\n[![Codecov test coverage](https://codecov.io/gh/jonthegeek/stbl/branch/main/graph/badge.svg)](https://app.codecov.io/gh/jonthegeek/stbl?branch=main)\n[![R-CMD-check](https://github.com/jonthegeek/stbl/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jonthegeek/stbl/actions/workflows/R-CMD-check.yaml)\n\u003c!-- badges: end --\u003e\n\nR is flexible about classes.\nVariables are not declared with explicit classes, and arguments of the \"wrong\" class don't cause errors until they explicitly fail at some point in the call stack.\nIt would be helpful to keep that flexibility from a user standpoint, but to error informatively and quickly if the inputs will not work for a computation.\nThe purpose of stbl is to allow programmers to specify what they want, and to then see if what the user supplied can work for that purpose.\n\n## Installation\n\n::: {.pkgdown-release}\nInstall the released version of stbl from [CRAN](https://cran.r-project.org/):\n\n``` r\ninstall.packages(\"stbl\")\n```\n:::\n\n::: {.pkgdown-devel}\nInstall the development version of stbl from [GitHub](https://github.com/):\n\n``` r\n# install.packages(\"pak\")\npak::pak(\"jonthegeek/stbl\")\n```\n:::\n\n## Usage\n\nUse within functions to give meaningful error messages for bad argument classes.\n\nFor example, perhaps you would like to protect against the case where data is not properly translated from character on load.\n\n### Without stbl:\n\nWithout the argument-stabilizers provided in stbl, error messages can be cryptic, and errors trigger when you might not want them to.\n\n```{r no-stbl, error = TRUE}\nmy_old_fun \u003c- function(my_arg_name) {\n  my_arg_name + 1\n}\nmy_old_fun(\"1\")\n```\n\n### With stbl:\n\nstbl helps to ensure that arguments are what you expect them to be.\n\n```{r with-stbl-ok}\nmy_fun \u003c- function(my_arg_name) {\n  my_arg_name \u003c- stbl::to_int(my_arg_name)\n  my_arg_name + 1\n}\nmy_fun(\"1\")\n```\n\nFailures are reported with helpful messages.\n\n```{r with-stbl-error1, error = TRUE}\nmy_fun(\"1.1\")\n```\n\nThe errors help locate issues within vectors.\n\n```{r with-stbl-error2, error = TRUE}\nmy_fun(c(\"1\", \"2\", \"3.1\", \"4\", \"5.2\"))\n```\n\n## Code of Conduct\n\nPlease note that the stbl project is released with a [Contributor Code of Conduct](https://jonthegeek.github.io/stbl/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonthegeek%2Fstbl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonthegeek%2Fstbl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonthegeek%2Fstbl/lists"}