{"id":14067632,"url":"https://github.com/poissonconsulting/checkr","last_synced_at":"2025-08-02T05:32:18.555Z","repository":{"id":46118557,"uuid":"111828980","full_name":"poissonconsulting/checkr","owner":"poissonconsulting","description":"An R package of assertive functions to check the properties of common R objects.","archived":false,"fork":false,"pushed_at":"2024-11-01T15:56:24.000Z","size":2464,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-12-04T08:36:13.846Z","etag":null,"topics":["assertion","checkr","rstats"],"latest_commit_sha":null,"homepage":"https://poissonconsulting.github.io/checkr/","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":"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":"2017-11-23T16:09:49.000Z","updated_at":"2024-11-12T16:42:47.000Z","dependencies_parsed_at":"2024-02-19T19:16:01.661Z","dependency_job_id":"950e696f-8ac5-4491-81a2-41a532977c22","html_url":"https://github.com/poissonconsulting/checkr","commit_stats":{"total_commits":233,"total_committers":7,"mean_commits":"33.285714285714285","dds":0.1673819742489271,"last_synced_commit":"0f984c3410420e32af30f1170bbad92d93fe1583"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poissonconsulting%2Fcheckr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poissonconsulting%2Fcheckr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poissonconsulting%2Fcheckr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poissonconsulting%2Fcheckr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/poissonconsulting","download_url":"https://codeload.github.com/poissonconsulting/checkr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228439455,"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":["assertion","checkr","rstats"],"created_at":"2024-08-13T07:05:41.984Z","updated_at":"2024-12-06T09:13:47.121Z","avatar_url":"https://github.com/poissonconsulting.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 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\u003c!-- badges: start --\u003e\n[![Lifecycle: superseded](https://img.shields.io/badge/lifecycle-superseded-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html#superseded)\n[![R-CMD-check](https://github.com/poissonconsulting/checkr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/poissonconsulting/checkr/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/poissonconsulting/checkr/graph/badge.svg)](https://app.codecov.io/gh/poissonconsulting/checkr)\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/license/mit/)\n[![JOSS](http://joss.theoj.org/papers/10.21105/joss.00624/status.svg)](https://doi.org/10.21105/joss.00624)\n\u003c!-- badges: end --\u003e\n\n# checkr\n\n`checkr` has been superseded by the [`chk`](https://github.com/poissonconsulting/chk) package.\n\n`checkr` is a light-weight R package of expressive, assertive, pipe-friendly functions to check the properties of common R objects.\n\nIn the case of failure the functions, which are designed to be used in scripts and packages,\nissue informative error messages.\n\nFor an overview of the functions see the `checkr-naming` vignette and for a comparison with similar packages see the `assertive-programming` vignette.\n\n## Demonstration\n\nThe following code demonstrates the `check_data()` function\n```{r, error = TRUE}\nlibrary(checkr)\n\n# the starwars data frame in the dplyr package fails many of these checks\ncheck_data(dplyr::starwars, values = list(\n  height = c(66L, 264L),\n  name = \"\",\n  mass = c(20,1358, NA),\n  hair_color = c(\"blond\", \"brown\", \"black\", NA),\n  gender = c(\"male\", \"female\", \"hermaphrodite\", \"none\", NA)), \n    order = TRUE, nrow = c(81, 84), key = \"hair_color\", error = FALSE)\n```\n\n## Syntax\n\n`checkr` uses objects to check \nthe values of other objects using an elegant and expressive syntax.\n\n#### Class\n\nTo check the class simply pass an object of the desired class.\n```{r, error = TRUE}\ny \u003c- c(2,1,0,1,NA)\ncheck_vector(y, values = numeric(0))\ncheck_vector(y, values = integer(0))\n```\n\n#### Missing Values\n\nTo check that a vector does not include missing values pass a single non-missing value (of the correct class).\n```{r, error = TRUE}\ncheck_vector(y, 1)\n```\n\nTo allow it to include missing values include a missing value.\n```{r}\ncheck_vector(y, c(1, NA))\n```\n\nAnd to check that it only includes missing values only pass a missing value (of the correct class)\n```{r, error = TRUE}\ncheck_vector(y, NA_real_)\n```\n\n#### Range\n\nTo check the range of a vector pass two non-missing values (as well as the missing value if required).\n```{r, error = TRUE}\ncheck_vector(y, c(0, 2, NA))\ncheck_vector(y, c(-1, -10, NA))\n```\n\n#### Specific Values\n\nTo check the vector only includes specific values pass three or more non-missing values or \nset `only  = TRUE`.\n```{r, error = TRUE}\ncheck_vector(y, c(0, 1, 2, NA))\ncheck_vector(y, c(1, 1, 2, NA))\ncheck_vector(y, c(1, 2, NA), only = TRUE)\n```\n\n## Naming Objects\n\nBy default, the name of an object is determined from the function call.\n```{r, error=TRUE}\ncheck_vector(list(x = 1))\n```\n\nThis simplifies things but results in less informative error messages when used in a pipe.\n```{r, error = TRUE}\nlibrary(magrittr)\ny %\u003e% check_list()\n```\n\nThe argument `x_name` can be used to override the name.\n```{r, error = TRUE}\ny %\u003e% check_list(x_name = \"y\")\n```\n\n## Scalars\n\nThe four wrapper functions \n`check_lgl()`, `check_int()`, `check_dbl()` and `check_str()` check whether an object \nis an attribute-less non-missing scalar logical (flag), integer, double (number) or character (string).\nThey are really useful for checking the types of arguments in functions\n\n```{r, error = TRUE}\nfun \u003c- function(x) { check_lgl(x)}\nfun(x = NA)\nfun(x = TRUE)\nfun(x = 1)\n```\n\nAdditional scalar wrappers are `check_date()` and `check_dttm()` for scalar Date and POSIXct objects.\nAlternatively you can roll your own using the more general `check_scalar()` function.\n\n## Installation\n\n\nTo install the latest development version from [r-universe](https://poissonconsulting.r-universe.dev/checkr).\n```r\ninstall.packages(\"checkr\", repos = c(\"https://poissonconsulting.r-universe.dev\", \"https://cloud.r-project.org\"))\n```\n\nTo install the latest development version from [GitHub](https://github.com/poissonconsulting/checkr)\n```r\n# install.packages(\"pak\", repos = sprintf(\"https://r-lib.github.io/p/pak/stable/%s/%s/%s\", .Platform$pkgType, R.Version()$os, R.Version()$arch))\npak::pak(\"poissonconsulting/checkr\")\n```\n\n## Citation\n\n```{r, comment=\"\", echo=FALSE}\ncitation(package = \"checkr\")\n```\n\n## Contribution\n\nPlease report any [issues](https://github.com/poissonconsulting/checkr/issues).\n\n[Pull requests](https://github.com/poissonconsulting/checkr/pulls) are always welcome.\n\n## Code of Conduct\n\nPlease note that the checkr project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). \nBy contributing to this project, you agree to abide by its terms\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoissonconsulting%2Fcheckr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpoissonconsulting%2Fcheckr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoissonconsulting%2Fcheckr/lists"}