{"id":22463735,"url":"https://github.com/poissonconsulting/err","last_synced_at":"2025-08-02T05:32:26.953Z","repository":{"id":33212693,"uuid":"145884753","full_name":"poissonconsulting/err","owner":"poissonconsulting","description":"An R package to produce customizable number sensitive error and warning messages","archived":false,"fork":false,"pushed_at":"2022-06-17T21:54:15.000Z","size":336,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-06-23T19:22:23.026Z","etag":null,"topics":["cran","errors","messages","r","warnings"],"latest_commit_sha":null,"homepage":"https://poissonconsulting.github.io/err/","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/poissonconsulting.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"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":null}},"created_at":"2018-08-23T17:13:13.000Z","updated_at":"2023-05-16T17:40:25.000Z","dependencies_parsed_at":"2022-08-21T05:50:48.701Z","dependency_job_id":null,"html_url":"https://github.com/poissonconsulting/err","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poissonconsulting%2Ferr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poissonconsulting%2Ferr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poissonconsulting%2Ferr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poissonconsulting%2Ferr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/poissonconsulting","download_url":"https://codeload.github.com/poissonconsulting/err/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228439452,"owners_count":17920026,"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":["cran","errors","messages","r","warnings"],"created_at":"2024-12-06T09:13:55.848Z","updated_at":"2024-12-06T09:13:56.076Z","avatar_url":"https://github.com/poissonconsulting.png","language":"R","funding_links":[],"categories":[],"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 setup, 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# err \u003cimg src=\"man/figures/logo.png\" align=\"right\" /\u003e\n\n  \u003c!-- badges: start --\u003e\n[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)\n  [![R-CMD-check](https://github.com/poissonconsulting/err/workflows/R-CMD-check/badge.svg)](https://github.com/poissonconsulting/err/actions)\n[![Coverage status](https://codecov.io/gh/poissonconsulting/err/branch/master/graph/badge.svg)](https://codecov.io/github/poissonconsulting/err?branch=master)\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/license/mit/)\n[![CRAN status](https://www.r-pkg.org/badges/version/err)](https://cran.r-project.org/package=err)\n![CRAN Downloads](http://cranlogs.r-pkg.org/badges/err)\n  \u003c!-- badges: end --\u003e\n\n## Introduction\n\n\u003e To err is human - Alexander Pope (1711)\n\n`err` is a light-weight R package to produce customizable number and object sensitive error and warning messages.\n\n## Demonstration\n\n### Object Sensitive\n\nThe `co` functions produce object sensitive strings.\n```{r}\nlibrary(err)\n\nfox \u003c- c(\"The\", \"quick\", \"brown\", \"fox\", \"jumps\", \"over\", \"the\", \"lazy\", \"dog\")\nco(fox)\nco(fox[1])\nco(fox[0])\nco(fox, nlots = 5)\n```\n\n### Customizable\n\nThe object sensitive strings are fully customized.\n```{r}\none \u003c- \"darn! the vector %o of length %n has the following value: %c\"\nnone \u003c- \"phew! vector %o is empty\"\nsome \u003c- \"rats! vector %o has the following %n element%s: %c\"\nlots \u003c- \"really?! the %n elements of vector %o are too numerous to print\"\n\nco(fox[0], one = one, none = none, some = some, lots = lots, nlots = 5)\nco(fox[1], one = one, none = none, some = some, lots = lots, nlots = 5)\nco(fox[1:3], one = one, none = none, some = some, lots = lots, nlots = 5)\nco(fox[1:5], one = one, none = none, some = some, lots = lots, nlots = 5)\n```\n\nThe following `sprintf`-like types can be used in the custom messages:\n\n- `%c`: the object as a comma separated list (produced by a `cc` function)\n- `%n`: the length of the object\n- `%o`: the name of the object\n- `%s`: 's' if n != 1 otherwise ''\n- `%r`: 'are' if n != 1 otherwise 'is'\n\nAnd there are various formatting options\n```{r}\nco(fox[1:6], conjunction = \"or\", bracket = \"|\", oxford = TRUE, ellipsis = 5)\n```\n\n### Data Frames\n\nThere is also a method for data frames.\n\n```{r}\ncat(co(datasets::mtcars, conjunction = \"and\", oxford = TRUE, ellipsis = 5))\n```\n\n### Number Sensitive\n\nThe `cn` function produces number sensitive customizable messages\n\n```{r}\ncn(0)\ncn(1)\ncn(2)\ncn(100, lots = \"there %r %n value%s - this is a lot\")\n```\n\n### Warning and Error Messages\n\nThe `co` and `cn` functions can be combined with the wrappers `msg`, `wrn` and `err` to produce a message, warning and error (without the call as part of the warning/error message).\n\n```{r, error = TRUE}\nmsg(cn(2))\nwrn(cn(2))\nerr(cn(2))\n```\n\n## Installation\n\nTo install the latest release version from [CRAN](https://cran.r-project.org)\n```\ninstall.packages(\"err\")\n```\n\nTo install the latest development version from [GitHub](https://github.com/poissonconsulting/err)\n```\nif(!\"devtools\" %in% installed.packages()[,1]) \n  install.packages(\"devtools\")\ndevtools::install_github(\"poissonconsulting/err\")\n```\n\n## Inspiration\n\n[`concatenate`](https://github.com/jamesdunham/concatenate) by [James Dunham](https://github.com/jamesdunham)\n\n## Contribution\n\nPlease report any [issues](https://github.com/poissonconsulting/err/issues).\n\n[Pull requests](https://github.com/poissonconsulting/err/pulls) are always welcome.\n\nPlease note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). \nBy participating in this project you agree to abide by its terms.\n\n## Code of Conduct\n\nPlease note that the err project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoissonconsulting%2Ferr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpoissonconsulting%2Ferr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoissonconsulting%2Ferr/lists"}