{"id":14067506,"url":"https://github.com/flujoo/erify","last_synced_at":"2025-04-14T20:45:37.050Z","repository":{"id":56934909,"uuid":"353922287","full_name":"flujoo/erify","owner":"flujoo","description":"R Package for Validation of Arguments and Generation of Readable Error Messages","archived":false,"fork":false,"pushed_at":"2024-06-30T12:33:01.000Z","size":447,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-01T06:51:35.590Z","etag":null,"topics":["error-handling","r","r-package","rstats"],"latest_commit_sha":null,"homepage":"https://flujoo.github.io/erify/","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/flujoo.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-02T06:03:17.000Z","updated_at":"2024-06-30T12:33:04.000Z","dependencies_parsed_at":"2024-08-13T07:13:05.339Z","dependency_job_id":"1f488363-dae6-459e-b467-78e51d2ab9de","html_url":"https://github.com/flujoo/erify","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flujoo%2Ferify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flujoo%2Ferify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flujoo%2Ferify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flujoo%2Ferify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flujoo","download_url":"https://codeload.github.com/flujoo/erify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223644774,"owners_count":17178765,"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":["error-handling","r","r-package","rstats"],"created_at":"2024-08-13T07:05:37.986Z","updated_at":"2024-11-08T07:04:12.981Z","avatar_url":"https://github.com/flujoo.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  error = TRUE\n)\n```\n\n# erify \u003cimg src=\"man/figures/logo.png\" align=\"right\" alt=\"logo\" width=\"120\"/\u003e\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\u003c!-- badges: end --\u003e\n\nCheck arguments and generate readable error messages.\n\n\n## Motivation\n\nWhen creating functions for other people to use, you always need to\n\n1. check if the arguments passed by users are valid, and if not,\n2. generate informative and well-formatted error messages in a consistent\nstyle.\n\nerify serves the exact purpose.\n\n\n## Installation\n\nInstall erify from CRAN:\n\n``` r\ninstall.packages(\"erify\")\n```\n\nOr install the development version from Github:\n\n``` r\n# install devtools if not\n# install.packages(\"devtools\")\n\ndevtools::install_github(\"flujoo/erify\")\n```\n\n\n## Example\n\nSuppose you are creating a function which prints a string several times\nto emphasize it:\n\n```{r}\n# print `what` `n` times\nemphasize \u003c- function(what, n) {\n  for (i in 1:n) {\n    cat(what, \"\\n\")\n  }\n}\n\n# example\nemphasize(\"You're beautiful!\", 3)\n```\n\nAnd suppose a novice user accidentally passes a function to argument `what`,\nhe/she will get an error message which is not very readable:\n\n```{r}\nemphasize(c, 3)\n```\n\nYou can improve this by adding erify's `check_type()` into `emphasize()`:\n\n```{r}\nemphasize \u003c- function(what, n) {\n  # check the type of `what`\n  erify::check_type(what, \"character\")\n  \n  # main\n  for (i in 1:n) {\n    cat(what, \"\\n\")\n  }\n}\n\nemphasize(c, 3)\n```\n\nIn the above code, `check_type(what, \"character\")` checks if `what` has type\ncharacter, and if not, generates improved error message.\n\n\n## More\n\nYou can add more functions to check arguments, customize error messages,\nand create your own check functions.\n\nSee `vignette(\"erify\")` for a gentle introduction to erify.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflujoo%2Ferify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflujoo%2Ferify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflujoo%2Ferify/lists"}