R 패키지 메타데이터와 수집 신호를 모아 봅니다.
첫 화면에서 판단해야 할 수집 신호를 먼저 배치합니다.
DESCRIPTION에서 감지한 backend 관련 package입니다.
기본 메타데이터를 작은 카드와 토큰으로 압축합니다.
| Package | Type | Spec |
|---|---|---|
| backports CRAN · 2.3.4 · 2026-05-30 | Imports | backports (>= 1.1.0) |
| utils CRAN · 2.3.4 · 2026-05-30 | Imports | utils |
| data.table CRAN · 2.3.4 · 2026-05-30 | Suggests | data.table (>= 1.9.8) |
| devtools CRAN · 2.3.4 · 2026-05-30 | Suggests | devtools |
| fastmatch CRAN · 2.3.4 · 2026-05-30 | Suggests | fastmatch |
| ggplot2 CRAN · 2.3.4 · 2026-05-30 | Suggests | ggplot2 |
| knitr CRAN · 2.3.4 · 2026-05-30 | Suggests | knitr |
| magrittr CRAN · 2.3.4 · 2026-05-30 | Suggests | magrittr |
| microbenchmark CRAN · 2.3.4 · 2026-05-30 | Suggests | microbenchmark |
| R6 CRAN · 2.3.4 · 2026-05-30 | Suggests | R6 |
| rmarkdown CRAN · 2.3.4 · 2026-05-30 | Suggests | rmarkdown |
| testthat CRAN · 2.3.4 · 2026-05-30 | Suggests | testthat (>= 3.0.4) |
| tibble CRAN · 2.3.4 · 2026-05-30 | Suggests | tibble |
| tinytest CRAN · 2.3.4 · 2026-05-30 | Suggests | tinytest (>= 1.1.0) |
| 검색 결과가 없습니다. | ||
| Package | Type | Spec |
|---|---|---|
| cmaesr 1.0.3 CRAN · 2026-05-30 | Depends | checkmate (>= 1.1) |
| forestplot 3.2.0 CRAN · 2026-05-30 | Depends | checkmate |
| smoof 1.7.0 CRAN · 2026-05-30 | Depends | checkmate (>= 1.1) |
| accessibility 1.5.0 CRAN · 2026-05-30 | Imports | checkmate |
| adproclus 2.0.1 CRAN · 2026-05-30 | Imports | checkmate |
| aeddo 0.1.1 CRAN · 2026-05-30 | Imports | checkmate |
| aedseo 1.1.0 CRAN · 2026-05-30 | Imports | checkmate |
| aldvmm 0.9.0 CRAN · 2026-05-30 | Imports | checkmate |
| amt 0.3.1.0 CRAN · 2026-05-30 | Imports | checkmate |
| ao 1.2.3 CRAN · 2026-05-30 | Imports | checkmate |
| aopdata 1.1.2 CRAN · 2026-05-30 | Imports | checkmate |
| APCtools 1.0.8 CRAN · 2026-05-30 | Imports | checkmate |
| aRD 0.1.0 CRAN · 2026-05-30 | Imports | checkmate |
| aslib 0.1.3 CRAN · 2026-05-30 | Imports | checkmate |
| astgrepr 0.1.1 CRAN · 2026-05-30 | Imports | checkmate |
| autocogs 0.1.5 CRAN · 2026-05-30 | Imports | checkmate |
| autoslider.core 0.3.2 CRAN · 2026-05-30 | Imports | checkmate (>= 2.2.0) |
| autothresholdr 1.4.3 CRAN · 2026-05-30 | Imports | checkmate (>= 1.9.3) |
| babelmixr2 0.1.11 CRAN · 2026-05-30 | Imports | checkmate |
| bartMachine 1.4.2 CRAN · 2026-05-30 | Imports | checkmate |
| baRulho 2.1.6 CRAN · 2026-05-30 | Imports | checkmate |
| baselinenowcast 0.2.0 CRAN · 2026-05-30 | Imports | checkmate |
| BatchExperiments 1.4.4 CRAN · 2026-05-30 | Imports | checkmate (>= 1.8.5) |
| BatchJobs 1.10 CRAN · 2026-05-30 | Imports | checkmate (>= 1.8.0) |
| batchtools 0.9.18 CRAN · 2026-05-30 | Imports | checkmate (>= 1.8.5) |
| bayesDiagnostics 0.1.0 CRAN · 2026-05-30 | Imports | checkmate (>= 2.1.0) |
| BayesFBHborrow 2.0.2 CRAN · 2026-05-30 | Imports | checkmate |
| BayesFM 0.1.7 CRAN · 2026-05-30 | Imports | checkmate (>= 1.8.0) |
| BayesianMCPMod 1.3.2 CRAN · 2026-05-30 | Imports | checkmate |
| bayesSSM 0.7.1 CRAN · 2026-05-30 | Imports | checkmate |
| bbk 0.10.0 CRAN · 2026-05-30 | Imports | checkmate |
| BBmisc 1.13.1 CRAN · 2026-05-30 | Imports | checkmate (>= 1.8.0) |
| bbotk 1.10.0 CRAN · 2026-05-30 | Imports | checkmate (>= 2.0.0) |
| Bchron 4.7.8 CRAN · 2026-05-30 | Imports | checkmate |
| bclogit 1.1 CRAN · 2026-05-30 | Imports | checkmate |
| beaver 1.0.0 CRAN · 2026-05-30 | Imports | checkmate (>= 2.1) |
| bhmbasket 1.1.0 CRAN · 2026-05-30 | Imports | checkmate |
| bidsr 0.1.1 CRAN · 2026-05-30 | Imports | checkmate |
| BioTIMEr 0.3.2 CRAN · 2026-05-30 | Imports | checkmate |
| bitfield 1.0.0 CRAN · 2026-05-30 | Imports | checkmate |
| bonsaiforest 0.1.1 CRAN · 2026-05-30 | Imports | checkmate |
| boostrq 1.0.0 CRAN · 2026-05-30 | Imports | checkmate |
| bootGOF 0.1.1 CRAN · 2026-05-30 | Imports | checkmate (>= 2.0.0) |
| botor 0.4.1 CRAN · 2026-05-30 | Imports | checkmate |
| brandr 0.1.0 CRAN · 2026-05-30 | Imports | checkmate (>= 2.3.2) |
| brclimr 0.2.0 CRAN · 2026-05-30 | Imports | checkmate |
| bssm 2.0.3 CRAN · 2026-05-30 | Imports | checkmate |
| BSW 0.1.2 CRAN · 2026-05-30 | Imports | checkmate |
| carbonr 0.2.7 CRAN · 2026-05-30 | Imports | checkmate |
| caretSDM 1.8.3 CRAN · 2026-05-30 | Imports | checkmate |
| causaldef 0.2.0 CRAN · 2026-05-30 | Imports | checkmate |
| causalDisco 1.1.0 CRAN · 2026-05-30 | Imports | checkmate |
| causalPAF 1.2.5 CRAN · 2026-05-30 | Imports | checkmate |
| causalweight 1.1.4 CRAN · 2026-05-18 | Imports | checkmate |
| CDMConnector 2.5.1 CRAN · 2026-05-30 | Imports | checkmate |
| censobr 0.5.0 CRAN · 2026-05-30 | Imports | checkmate |
| centerline 0.2.5 CRAN · 2026-05-30 | Imports | checkmate |
| cfr 0.2.0 CRAN · 2026-05-30 | Imports | checkmate |
| Characterization 3.0.1 CRAN · 2026-05-30 | Imports | checkmate |
| checkCLI 1.0 CRAN · 2026-05-30 | Imports | checkmate |
| chevron 0.2.12 CRAN · 2026-05-30 | Imports | checkmate (>= 2.1.0) |
| choicedata 0.1.0 CRAN · 2026-05-30 | Imports | checkmate |
| chooseGCM 1.3 CRAN · 2026-05-30 | Imports | checkmate |
| ci 0.0.1 CRAN · 2026-05-30 | Imports | checkmate |
| cito 1.1 CRAN · 2026-05-30 | Imports | checkmate |
| cld 0.0.1 CRAN · 2026-05-30 | Imports | checkmate |
| cleanepi 1.1.2 CRAN · 2026-05-30 | Imports | checkmate |
| cleanr 1.4.0 CRAN · 2026-05-30 | Imports | checkmate |
| clustree 0.5.1 CRAN · 2026-05-30 | Imports | checkmate |
| cnefetools 0.2.5 CRAN · 2026-05-30 | Imports | checkmate |
| coalitions 0.6.27 CRAN · 2026-05-30 | Imports | checkmate |
| codified 0.3.0 CRAN · 2026-05-30 | Imports | checkmate (>= 1.8.4) |
| codyna 0.1.0 CRAN · 2026-05-30 | Imports | checkmate |
| CohortGenerator 1.1.0 CRAN · 2026-05-30 | Imports | checkmate |
| CohortMethod 6.0.2 CRAN · 2026-05-30 | Imports | checkmate |
| cointReg 0.2.0 CRAN · 2026-05-30 | Imports | checkmate (>= 1.6.0) |
| ColOpenData 1.0.0 CRAN · 2026-05-30 | Imports | checkmate |
| comorbidity 1.1.0 CRAN · 2026-05-30 | Imports | checkmate |
| connector 1.0.0 CRAN · 2026-05-30 | Imports | checkmate |
| connector.databricks 0.1.0 CRAN · 2026-05-30 | Imports | checkmate |
| conogive 1.0.0 CRAN · 2026-05-30 | Imports | checkmate |
| contdid 0.1.0 CRAN · 2026-05-30 | Imports | checkmate |
| cosimmr 1.0.12 CRAN · 2026-05-30 | Imports | checkmate |
| counterfactuals 1.0.0 CRAN · 2026-05-30 | Imports | checkmate |
| cre.dcf 0.0.5 CRAN · 2026-05-30 | Imports | checkmate |
| crmPack 2.1.0 CRAN · 2026-05-30 | Imports | checkmate (>= 2.2.0) |
| CrossClustering 4.1.3 CRAN · 2026-05-30 | Imports | checkmate |
| crosstable 0.9.0 CRAN · 2026-05-30 | Imports | checkmate (>= 1.9.0) |
| crumble 0.1.2 CRAN · 2026-05-30 | Imports | checkmate |
| ctoclient 0.1.0 CRAN · 2026-05-30 | Imports | checkmate |
| cucumber 2.1.1 CRAN · 2026-05-30 | Imports | checkmate |
| cvms 2.0.0 CRAN · 2026-05-30 | Imports | checkmate (>= 2.0.0) |
| cyclestreets 1.0.3 CRAN · 2026-05-30 | Imports | checkmate |
| dapper 1.1.0 CRAN · 2026-05-30 | Imports | checkmate |
| DatabaseConnector 7.1.0 CRAN · 2026-05-30 | Imports | checkmate |
| dataverse 0.3.16 CRAN · 2026-05-30 | Imports | checkmate |
| date4ts 0.1.2 CRAN · 2026-05-30 | Imports | checkmate |
| dbSpatial 0.1.1 CRAN · 2026-05-30 | Imports | checkmate |
| DCCA 0.1.1 CRAN · 2026-05-30 | Imports | checkmate |
| detrendr 0.6.15 CRAN · 2026-05-30 | Imports | checkmate (>= 1.9.3) |
| discharge 1.0.0 CRAN · 2026-05-30 | Imports | checkmate |
| DiscreteDatasets 0.2.0 CRAN · 2026-05-30 | Imports | checkmate |
| DiscreteFDR 2.1.1 CRAN · 2026-05-30 | Imports | checkmate |
| DiscreteFWER 1.0.0 CRAN · 2026-05-30 | Imports | checkmate |
| discretes 0.1.0 CRAN · 2026-05-30 | Imports | checkmate |
| DiscreteTests 0.4.1 CRAN · 2026-05-30 | Imports | checkmate |
| diseasystore 0.3.3 CRAN · 2026-05-30 | Imports | checkmate |
| distfromq 1.0.4 CRAN · 2026-05-30 | Imports | checkmate |
| distilleR 1.0.0 CRAN · 2026-05-30 | Imports | checkmate (>= 2.3.1) |
| distionary 0.1.1 CRAN · 2026-05-30 | Imports | checkmate |
| distplyr 0.2.0 CRAN · 2026-05-30 | Imports | checkmate |
| DistributionIV 0.1.3 CRAN · 2026-05-30 | Imports | checkmate |
| document 4.0.1 CRAN · 2026-05-30 | Imports | checkmate |
| DoubleML 1.0.2 CRAN · 2026-05-30 | Imports | checkmate |
| DrugExposureDiagnostics 1.1.7 CRAN · 2026-05-30 | Imports | checkmate (>= 2.0.0) |
| DTSg 2.1.0 CRAN · 2026-05-30 | Imports | checkmate |
| dunlin 0.1.12 CRAN · 2026-05-30 | Imports | checkmate (>= 2.1.0) |
| dynamite 1.6.3 CRAN · 2026-05-30 | Imports | checkmate |
| easybio 1.2.3 CRAN · 2026-05-30 | Imports | checkmate |
| eatRep 0.15.3 CRAN · 2026-05-30 | Imports | checkmate |
| 검색 결과가 없습니다. | ||
| Type | Packages |
|---|---|
| Depends | 3 |
| Imports | 529 |
| Suggests | 18 |
CRAN: checkmate citation info Lang M (2017). “checkmate: Fast Argument Checks for Defensive R Programming.” The R Journal , 9 (1), 437–445. doi:10.32614/RJ-2017-028 . Corresponding BibTeX entry: @Article{checkmate, title = {{checkmate}: Fast Argument Checks for Defensive {R} Programming}, author = {Michel Lang}, journal = {The R Journal}, year = {2017}, doi = {10.32614/RJ-2017-028}, pages = {437--445}, volume = {9}, number = {1}, }NEWS code{white-space: pre-wrap;} span.smallcaps{font-variant: small-caps;} span.underline{text-decoration: underline;} div.column{display: inline-block; vertical-align: top; width: 50%;} div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;} ul.task-list{list-style: none;} Version 2.3.3 Removed deprecated calls to internal R functions. Version 2.3.3 Fixed a minor bug in allMissing() for complex numbers where either the real part or the imaginary part was missing while the other part was not missing (#279). Dropped usage for internal C function isFrame() for recent R versions (278). Improved documentation (#273, #264). Version 2.3.2 Removed calls to deprecated / internal C routines. Fixed compiler warnings regarding sprintf format strings. Fixed an issue regarding sortedness and missing numeric values (#259, thanks to @tdeenes ) Version 2.3.1 Fixed a sprintf format string for long integers. Version 2.3.0 NULL is not longer considered to be atomic in future versions of R (c.f. https://stat.ethz.ch/pipermail/r-devel/2023-September/082892.html ). To avoid breaking reverse dependencies, checkmate will stick to the old behavior until further notice. Fixed a warning in checkAtomic() (#245). Version 2.2.0 Fixed C compiler warnings for windows Added checkPermutation (#230). Better handling of long vectors (#231). Fixed a bounds check for numeric vectors and infinite bounds. Version 2.1.0 New arguments n.chars and max.chars for checkCharacter() and checkString() . Checks for integerish now compare the tolerance with the difference to the nearest integer with > instead of >= to allow specifying a tolerance of exactly 0 (#177). Checks for integerish now check for class Date an POSIXt . Coercion of double to integer in assertInt() and assertIntegerish() now round to the nearest integer instead of always rounding via trunc() . Fixed an error message where the wrong variable name was reported by assert() (#182). Checks on POSIXct dates with storage mode integer should now work instead of raising an exception (#175). *Matrix() and *Array() now allow different storage types than the one specified if all values are missing (#184). Function assert() now supports collecting assertions via AssertCollection (#112). New exported C function qcheck() (#180). Fixed a bug in checkFunction(..., ordered = TRUE) (#204). Removed deprecated S macro DOUBLE_EPS from C source. Version 2.0.0 Expectations now optionally support the package tinytest . tinytest is used as backend if it is attached, otherwise checkmate defaults to testthat . There is now also a vignette on how to setup checkmate for tinytest . Coercion now only affects double vectors. Improved error message for type detection in *List . Removed *Bit , the bit package is orphaned. Fixed documentation. Version 1.9.4 Fixed factors being detected as integerish. Fixed error message for name checks of vectors. Version 1.9.3 New argument extension for checkPathForOutput() (#162). Fixed handling of different NA types in all set functions (#158). expect_vector removed due to a nameclash with package testthat . Version 1.9.2 assert*(..., coerce = TRUE) does not drop names during conversion (#157), thanks to @mb706 . Fixed documentation in checkDataFrame (#159), thanks to @harvey131 . Changed heuristic in vname() to improve lookup of variable names. Version 1.9.1 Fix segfault on Solaris Fix warnings reported by rchk Fix checking private slots in checkR6 (#156) Version 1.9.0 Error messages now provide more information about error locations, e.g., the position of the first missing element in a vector. If the object to check is missing, assert -functions now give a better error message, test -functions are always FALSE and expect -functions always raise an exception. Checks for missingness and sort order optimized for ALTREPs. The calling frame reported in assertions is now identical to the calling frame reported by R’s stop() function (#117). Added checkDouble to explicitly check for non-integer numerics. Added checkRaw to check raw vectors. Added checkFormula to check formula objects. Added checkMultiClass to check for inheritance from a set of candidates Added checkDisjunct to check sets for being disjunct. Added abbreviation "p" to qassert to check for POSIXct objects. Added argument coerce to assertCount / assert_count , assertInt / assert_int and assertIntegerish / assert_integerish which optionally coerces x to integer after an successful assertion. This supersedes the functions asCount , asInt and asInteger (#77). Added arguments max.rows and max.cols to check for maximum number of rows and columns for matrices, data.frames, tibbles and data.tables. Added argument disjunct.from to *Names . Fixed an error message in checkChoice . Fixed *Function to work properly with Primitives. Fixed *List where the check for missingness was broken. Workaround for *DataTable for the detection of the number of rows of null data.tables: https://github.com/Rdatatable/data.table/issues/3149 Version 1.8.5 Added *POSIXct to check POSIXct data-time objects in POSIXct format. The set functions optionally support the package fastmatch now. Argument sorted = TRUE is not passed to ls() anymore to support R versions prior to v3.2.0. Version 1.8.4 New functions to test bit vectors implemented in package bit . New functions to test R6 classes implemented in package R6 . Always load (not attach) the respective namespace if checking for objects of type data.table , tibble , R6 or bit . This ensures that all operations work as expected after the check. *Names with type="unnamed" now works with NULL . New argument must.include for *Names . Fixed possible protection stack imbalance as reported by rchk . Version 1.8.3 New argument sorted (defaults to FALSE ) for *Integer , *Integerish and Numeric to check for ascending order of vector elements. New argument null.ok (defaults to FALSE ) for *Choice and *Class . *Subset now allows to pass empty vectors to choices . Improved error message for *Choice . The set family of functions is now more restrict regarding the class, e.g. they differentiate between factors and characters. *Character and *String now ignores missing values in regular expressions and for string length checks (using argument min.chars ). To disallow missing values, set any.missing or na.ok , respectively. *Date now ignores missing values in for lower/upper bound checks. To disallow missing values, set any.missing to FALSE . Thanks to Will Beasley ( @wibeasley ) for the PR. Package microbenchmark is no longer strictly required to build the vignette. If not installed, some output and figures will be missing though. Version 1.8.2 *Matrix and *Array now additionally allow to check for integerish storage type via argument “mode”. Functions *Count , *Int , *Number , *Integer , *Integerish and *Numeric do not accept logical values any more. checkAtomicVector is now more restrictive and prohibits a dimension symbol. Thus, a matrix is not considered an atomic vector any more. Dropped support for AssertCollections in convert functions ( asInt , asInteger and asCount ). Added checkTibble . Version 1.8.1 Function test_file is longer exported. *Function does not longer lookup functions with match.fun . As a result, passing functions via the string of the function name stopped working. In qassert using f as first char in a rule now specifies factor (before: function). Version 1.8.0 Most functions now support the handling of default arguments encoded as NULL via argument null.ok . Functions *File and *Directory are deprecated due to name clashes and will be removed in a future version. Please use *FileExists or *DirectoryExists instead. New helper function matchArg to provide a simple an easy way for partial argument matching in combination with an AssertCollection. Added alias functions for all check functions ( check_* ) to provide support for the underscore programming style in assert() . Version 1.7.4 Compatibility with the upcoming testthat versiREADME code{white-space: pre-wrap;} span.smallcaps{font-variant: small-caps;} span.underline{text-decoration: underline;} div.column{display: inline-block; vertical-align: top; width: 50%;} div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;} ul.task-list{list-style: none;} pre > code.sourceCode { white-space: pre; position: relative; } pre > code.sourceCode > span { display: inline-block; line-height: 1.25; } pre > code.sourceCode > span:empty { height: 1.2em; } .sourceCode { overflow: visible; } code.sourceCode > span { color: inherit; text-decoration: inherit; } div.sourceCode { margin: 1em 0; } pre.sourceCode { margin: 0; } @media screen { div.sourceCode { overflow: auto; } } @media print { pre > code.sourceCode { white-space: pre-wrap; } pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; } } pre.numberSource code { counter-reset: source-line 0; } pre.numberSource code > span { position: relative; left: -4em; counter-increment: source-line; } pre.numberSource code > span > a:first-child::before { content: counter(source-line); position: relative; left: -1em; text-align: right; vertical-align: baseline; border: none; display: inline-block; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; padding: 0 4px; width: 4em; color: #aaaaaa; } pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; } div.sourceCode { } @media screen { pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; } } code span.al { color: #ff0000; font-weight: bold; } /* Alert */ code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ code span.at { color: #7d9029; } /* Attribute */ code span.bn { color: #40a070; } /* BaseN */ code span.bu { color: #008000; } /* BuiltIn */ code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */ code span.ch { color: #4070a0; } /* Char */ code span.cn { color: #880000; } /* Constant */ code span.co { color: #60a0b0; font-style: italic; } /* Comment */ code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ code span.do { color: #ba2121; font-style: italic; } /* Documentation */ code span.dt { color: #902000; } /* DataType */ code span.dv { color: #40a070; } /* DecVal */ code span.er { color: #ff0000; font-weight: bold; } /* Error */ code span.ex { } /* Extension */ code span.fl { color: #40a070; } /* Float */ code span.fu { color: #06287e; } /* Function */ code span.im { color: #008000; font-weight: bold; } /* Import */ code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */ code span.kw { color: #007020; font-weight: bold; } /* Keyword */ code span.op { color: #666666; } /* Operator */ code span.ot { color: #007020; } /* Other */ code span.pp { color: #bc7a00; } /* Preprocessor */ code span.sc { color: #4070a0; } /* SpecialChar */ code span.ss { color: #bb6688; } /* SpecialString */ code span.st { color: #4070a0; } /* String */ code span.va { color: #19177c; } /* Variable */ code span.vs { color: #4070a0; } /* VerbatimString */ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ checkmate Fast and versatile argument checks for R. Ever used an R function that produced a not-very-helpful error message, just to discover after minutes of debugging that you simply passed a wrong argument? Blaming the laziness of the package author for not doing such standard checks (in a dynamically typed language such as R) is at least partially unfair, as R makes theses types of checks cumbersome and annoying. Well, that’s how it was in the past. Enter checkmate. Virtually every standard type of user error when passing arguments into function can be caught with a simple, readable line which produces an informative error message in case. A substantial part of the package was written in C to minimize any worries about execution time overhead . Furthermore, the package provides over 30 expectations to extend the popular testthat package for unit tests. Installation For the stable release, just install the latest version from CRAN : install.packages ( "checkmate" ) For the development version, use devtools : devtools :: install_github ( "mllg/checkmate" ) Resources R Journal Paper NEWS Documentation/Vignettes Grouped function referenceHelp for package checkmate const macros = { "\\R": "\\textsf{R}", "\\mbox": "\\text", "\\code": "\\texttt"}; function processMathHTML() { var l = document.getElementsByClassName('reqn'); for (let e of l) { katex.render(e.textContent, e, { throwOnError: false, macros }); } return; } Package {checkmate} Contents checkmate-package %??% AssertCollection allMissing anyInfinite anyNaN asInteger assert checkAccess checkArray checkAtomic checkAtomicVector checkCharacter checkChoice checkClass checkComplex checkCount checkDataFrame checkDataTable checkDate checkDirectoryExists checkDisjunct checkDouble checkEnvironment checkFALSE checkFactor checkFileExists checkFlag checkFormula checkFunction checkInt checkInteger checkIntegerish checkList checkLogical checkMatrix checkMultiClass checkNamed checkNames checkNull checkNumber checkNumeric checkOS checkPOSIXct checkPathForOutput checkPermutation checkR6 checkRaw checkScalar checkScalarNA checkSetEqual checkString checkSubset checkTRUE checkTibble checkVector makeAssertion makeExpectation makeTest matchArg qassert qassertr register_test_backend vname wf Type: Package Title: Fast and Versatile Argument Checks Description: Tests and assertions to perform frequent argument checks. A substantial part of the package was written in C to minimize any worries about execution time overhead. Version: 2.3.4 URL: https://mllg.github.io/checkmate/ , https://github.com/mllg/checkmate URLNote: https://github.com/mllg/checkmate BugReports: https://github.com/mllg/checkmate/issues NeedsCompilation: yes ByteCompile: yes Encoding: UTF-8 Depends: R (≥ 3.0.0) Imports: backports (≥ 1.1.0), utils Suggests: R6, fastmatch, data.table (≥ 1.9.8), devtools, ggplot2, knitr, magrittr, microbenchmark, rmarkdown, testthat (≥ 3.0.4), tinytest (≥ 1.1.0), tibble License: BSD_3_clause + file LICENSE VignetteBuilder: knitr RoxygenNote: 7.3.3 Collate: 'AssertCollection.R' 'allMissing.R' 'anyInfinite.R' 'anyMissing.R' 'anyNaN.R' 'asInteger.R' 'assert.R' 'helper.R' 'makeExpectation.R' 'makeTest.R' 'makeAssertion.R' 'checkAccess.R' 'checkArray.R' 'checkAtomic.R' 'checkAtomicVector.R' 'checkCharacter.R' 'checkChoice.R' 'checkClass.R' 'checkComplex.R' 'checkCount.R' 'checkDataFrame.R' 'checkDataTable.R' 'checkDate.R' 'checkDirectoryExists.R' 'checkDisjunct.R' 'checkDouble.R' 'checkEnvironment.R' 'checkFALSE.R' 'checkFactor.R' 'checkFileExists.R' 'checkFlag.R' 'checkFormula.R' 'checkFunction.R' 'checkInt.R' 'checkInteger.R' 'checkIntegerish.R' 'checkList.R' 'checkLogical.R' 'checkMatrix.R' 'checkMultiClass.R' 'checkNamed.R' 'checkNames.R' 'checkNull.R' 'checkNumber.R' 'checkNumeric.R' 'checkOS.R' 'checkPOSIXct.R' 'checkPathForOutput.R' 'checkPermutation.R' 'checkR6.R' 'checkRaw.R' 'checkScalar.R' 'checkScalarNA.R' 'checkSetEqual.R' 'checkString.R' 'checkSubset.R' 'checkTRUE.R' 'checkTibble.R' 'checkVector.R' 'coalesce.R' 'isIntegerish.R' 'matchArg.R' 'qassert.R' 'qassertr.R' 'vname.R' 'wfwl.R' 'zzz.R' Packaged: 2026-02-02 10:59:55 UTC; michel Author: Michel Lang [cre, aut], Bernd Bischl [ctb], Dénes Tóth [ctb] Maintainer: Michel Lang <michellang@gmail.com> Repository: CRAN Date/Publication: 2026-02-03 08:40:02 UTC checkmate: Fast and Versatile Argument Checks Description Tests and assertions to perform frequent argument checks. A substantial part of the package was written in C to minimize any worries about execution time overhead. Check scalars checkFlag checkCount checkNumber checkInt checkString checkScalar checkScalarNA Check vectors checkLogical checkNumeric checkDouble checkInteger checkIntegerish checkCharacter checkComplex checkFactor checkList checkPOSIXct checkVector checkAtomic checkAtomicVector checkRaw Check attributes checkClass checkMultiClass checkNames checkNamed (deprecated) Check compound types checkArray checkDataFrame checkMatrix Check other built-in R types checkDate checkEnvironment checkFunction checkFormula checkNull Check sets checkChoice checkSubset checkSetEqual checkDisjunct checkPermutation File IO checkFileExists checkDirectoryExists checkPathForOutput checkAccess Popular data types of third party packages checkDataTable checkR6 checkTibble Safe coercion to integer asCount asInt asInteger Quick argument checks using a DSL qassert qassertr Misc checkOS (check operating system) assert (combine multiple checks into an assertion) anyMissing allMissing anyNaN wf (which.first and which.last) Author(s) Maintainer : Michel Lang michellang@gmail.com ( ORCID ) Other contributors: Bernd Bischl bernd_bischl@gmx.net [contributor] Dénes Tóth toth.denes@kogentum.hu ( ORCID ) [contributor] See Also Useful links: https://mllg.github.io/checkmate/ https://github.com/mllg/checkmate Report bugs at https://github.com/mllg/checkmate/issues Coalesce operator Description Returns the left hand side if not missing nor NULL , and the right hand side otherwise. Usage lhs %??% rhs Arguments lhs [ any ] Left hand side of the operator. Is returned if not missing or NULL . rhs [ any ] Right hand side of the operator. Is returned if lhs is missing or NULL . Value Either lhs or rhs . Examples print(NULL %??% 1 %??% 2) print(names(iris) %??% letters[seq_len(ncol(iris))]) Collect multiple assertions Description The function makeAssertCollection() returns a simple stack-like closure you can pass to all functions of the assert* -family. All messages get collected and can be reported with reportAssertions() . Alternatively, you can easily write your own report function or customize the the output of the report function to a certain degree. See the example on how to push custom messages or retrieve all stored messages. Usage makeAssertCollection() reportAssertions(collection) Arguments collection [ AssertCollection ] Object of type “AssertCollection” (constructed via makeAssertCollection ). Value makeAssertCollection() returns an object of class “AssertCollection” and reportCollection returns invisibly TRUE if no error is thrown (i.e., no message was collected). Examples x = "a" coll = makeAssertCollection() print(coll$isEmpty()) assertNumeric(x, add = coll) coll$isEmpty() coll$push("Custom error message") coll$getMessages() ## Not run: reportAssertions(coll) ## End(Not run) Check if an object contains missing values Description anyMissing checks for the presence of at least one missing value, allMissing checks for the presence of at least one non-missing value. Supported are atomic types (see is.atomic ), lists and data frames. Missingness is defined as NA or NaN for atomic types and data frame columns, NULL is defined as missing for lists. allMissing applied to a data.frame returns TRUE if at least one column has only non-missing values. If you want to perform the less frequent check that there is at least a single non-missing observation present in the data.frame , use all(sapply(df, allMissing)) instead. Usage allMissing(x) anyMissing(x) Arguments x [ any ] Object to check. Value [ logical(1) ] Returns TRUE if any ( anyMissing ) or all ( allMissing ) elements of x are missing (see details), FALSE otherwise. Examples allMissing(1:2) allMissing(c(1, NA)) allMissing(c(NA, NA)) x = data.frame(a = 1:2, b = NA) # Note how allMissing combines the results for data frames: allMissing(x) all(sapply(x, allMissing)) anyMissing(c(1, 1)) anyMissing(c(1, NA)) anyMissing(list(1, NULL)) x = iris x[, "Species"] = NA anyMissing(x) allMissing(x) Check if an object contains infinite values Description Supported are atomic types (see is.atomic ), lists and data frames. Usage anyInfinite(x) Arguments x [ any ] Object to check. Value [ logical(1) ] Returns TRUE if any element is -Inf or Inf . Examples anyInfinite(1:10) anyInfinite(c(1:10, Inf)) iris[3, 3] = Inf anyInfinite(iris) Check if an object contains NaN values Description Supported are atomic types (see is.atomic ), lists and data frames. Usage anyNaN(x) Arguments x [ any ] Object to check. Value [ logical(1) ] Returns TRUE if any element is NaN . Examples anyNaN(1:10) anyNaN(c(1:10, NaN)) iris[3, 3] = NReturns the left hand side if not missing nor NULL, and the right hand side otherwise.
lhs %??% rhsprint(NULL %??% 1 %??% 2) print(names(iris) %??% letters[seq_len(ncol(iris))])The function makeAssertCollection() returns a simple stack-like closure you can pass to all functions of the assert*-family. All messages get collected and can be reported with reportAssertions(). Alternatively, you can easily write your own report function or customize the the output of the report function to a certain degree. See the example on how to push custom messages or retrieve all stored messages.
makeAssertCollection() reportAssertions(collection)x = "a" coll = makeAssertCollection() print(coll$isEmpty()) assertNumeric(x, add = coll) coll$isEmpty() coll$push("Custom error message") coll$getMessages() reportAssertions(coll)anyMissing checks for the presence of at least one missing value, allMissing checks for the presence of at least one non-missing value. Supported are atomic types (see [base]is.atomic), lists and data frames. Missingness is defined as NA or NaN for atomic types and data frame columns, NULL is defined as missing for lists. allMissing applied to a data.frame returns TRUE if at least one column has only non-missing values. If you want to perform the less frequent check that there is at least a single non-missing observation present in the data.frame, use all(sapply(df, allMissing)) instead.
allMissing(x) anyMissing(x)allMissing(1:2) allMissing(c(1, NA)) allMissing(c(NA, NA)) x = data.frame(a = 1:2, b = NA) # Note how allMissing combines the results for data frames: allMissing(x) all(sapply(x, allMissing)) anyMissing(c(1, 1)) anyMissing(c(1, NA)) anyMissing(list(1, NULL)) x = iris x[, "Species"] = NA anyMissing(x) allMissing(x)Supported are atomic types (see [base]is.atomic), lists and data frames.
anyInfinite(x)anyInfinite(1:10) anyInfinite(c(1:10, Inf)) iris[3, 3] = Inf anyInfinite(iris)Supported are atomic types (see [base]is.atomic), lists and data frames.
anyNaN(x)anyNaN(1:10) anyNaN(c(1:10, NaN)) iris[3, 3] = NaN anyNaN(iris)asInteger is intended to be used for vectors while asInt is a specialization for scalar integers and asCount for scalar non-negative integers. Convertible are (a) atomic vectors with all elements NA and (b) double vectors with all elements being within tol range of an integer. Note that these functions may be deprecated in the future. Instead, it is advised to use assertCount, assertInt or assertIntegerish with argument coerce set to TRUE instead.
asInteger( x, tol = sqrt(.Machine$double.eps), lower = -Inf, upper = Inf, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, .var.name = vname(x) ) asCount( x, na.ok = FALSE, positive = FALSE, tol = sqrt(.Machine$double.eps), .var.name = vname(x) ) asInt( x, na.ok = FALSE, lower = -Inf, upper = Inf, tol = sqrt(.Machine$double.eps), .var.name = vname(x) )asInteger(c(1, 2, 3)) asCount(1) asInt(1)You can call this function with an arbitrary number of of check* functions, i.e. functions provided by this package or your own functions which return TRUE on success and the error message as character(1) otherwise. The resulting assertion is successful, if combine is or (default) and at least one check evaluates to TRUE or combine is and and all checks evaluate to TRUE. Otherwise, assert throws an informative error message.
assert(..., combine = "or", .var.name = NULL, add = NULL)x = 1:10 assert(checkNull(x), checkInteger(x, any.missing = FALSE)) collection <- makeAssertCollection() assert(checkChoice(x, c("a", "b")), checkDataFrame(x), add = collection) collection$getMessages()Check file system access rights
checkAccess(x, access = "") check_access(x, access = "") assertAccess(x, access = "", .var.name = vname(x), add = NULL) assert_access(x, access = "", .var.name = vname(x), add = NULL) testAccess(x, access = "") test_access(x, access = "") expect_access(x, access = "", info = NULL, label = vname(x))# Is R's home directory readable? testAccess(R.home(), "r") # Is R's home directory writeable? testAccess(R.home(), "w")Check if an argument is an array
checkArray( x, mode = NULL, any.missing = TRUE, d = NULL, min.d = NULL, max.d = NULL, null.ok = FALSE ) check_array( x, mode = NULL, any.missing = TRUE, d = NULL, min.d = NULL, max.d = NULL, null.ok = FALSE ) assertArray( x, mode = NULL, any.missing = TRUE, d = NULL, min.d = NULL, max.d = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL ) assert_array( x, mode = NULL, any.missing = TRUE, d = NULL, min.d = NULL, max.d = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL ) testArray( x, mode = NULL, any.missing = TRUE, d = NULL, min.d = NULL, max.d = NULL, null.ok = FALSE ) test_array( x, mode = NULL, any.missing = TRUE, d = NULL, min.d = NULL, max.d = NULL, null.ok = FALSE ) expect_array( x, mode = NULL, any.missing = TRUE, d = NULL, min.d = NULL, max.d = NULL, null.ok = FALSE, info = NULL, label = vname(x) )checkArray(array(1:27, dim = c(3, 3, 3)), d = 3)For the definition of atomic, see [base]is.atomic. Note that `NULL` is recognized as a valid atomic value, as in R versions up to version 4.3.x. For details, see https://stat.ethz.ch/pipermail/r-devel/2023-September/082892.html.
checkAtomic( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL ) check_atomic( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL ) assertAtomic( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, .var.name = vname(x), add = NULL ) assert_atomic( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, .var.name = vname(x), add = NULL ) testAtomic( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL ) test_atomic( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL ) expect_atomic( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, info = NULL, label = vname(x) )testAtomic(letters, min.len = 1L, any.missing = FALSE)An atomic vector is defined slightly different from specifications in [base]is.atomic and [base]is.vector: An atomic vector is either logical, integer, numeric, complex, character or raw and can have any attributes except a dimension attribute (like matrices). I.e., a factor is an atomic vector, but a matrix or NULL are not. In short, this is basically equivalent to is.atomic(x) && !is.null(x) && is.null(dim(x)).
checkAtomicVector( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL ) check_atomic_vector( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL ) assertAtomicVector( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, .var.name = vname(x), add = NULL ) assert_atomic_vector( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, .var.name = vname(x), add = NULL ) testAtomicVector( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL ) test_atomic_vector( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL ) expect_atomic_vector( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, info = NULL, label = vname(x) )testAtomicVector(letters, min.len = 1L, any.missing = FALSE)To check for scalar strings, see checkString.
checkCharacter( x, n.chars = NULL, min.chars = NULL, max.chars = NULL, pattern = NULL, fixed = NULL, ignore.case = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) check_character( x, n.chars = NULL, min.chars = NULL, max.chars = NULL, pattern = NULL, fixed = NULL, ignore.case = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) assertCharacter( x, n.chars = NULL, min.chars = NULL, max.chars = NULL, pattern = NULL, fixed = NULL, ignore.case = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL ) assert_character( x, n.chars = NULL, min.chars = NULL, max.chars = NULL, pattern = NULL, fixed = NULL, ignore.case = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL ) testCharacter( x, n.chars = NULL, min.chars = NULL, max.chars = NULL, pattern = NULL, fixed = NULL, ignore.case = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) test_character( x, n.chars = NULL, min.chars = NULL, max.chars = NULL, pattern = NULL, fixed = NULL, ignore.case = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) expect_character( x, n.chars = NULL, min.chars = NULL, max.chars = NULL, pattern = NULL, fixed = NULL, ignore.case = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE, info = NULL, label = vname(x) )testCharacter(letters, min.len = 1, any.missing = FALSE) testCharacter(letters, min.chars = 2) testCharacter("example", pattern = "xa")Check if an object is an element of a given set
checkChoice(x, choices, null.ok = FALSE, fmatch = FALSE) check_choice(x, choices, null.ok = FALSE, fmatch = FALSE) assertChoice( x, choices, null.ok = FALSE, fmatch = FALSE, .var.name = vname(x), add = NULL ) assert_choice( x, choices, null.ok = FALSE, fmatch = FALSE, .var.name = vname(x), add = NULL ) testChoice(x, choices, null.ok = FALSE, fmatch = FALSE) test_choice(x, choices, null.ok = FALSE, fmatch = FALSE) expect_choice( x, choices, null.ok = FALSE, fmatch = FALSE, info = NULL, label = vname(x) )testChoice("x", letters) # x is not converted before the comparison (except for numerics) testChoice(factor("a"), "a") testChoice(1, "1") testChoice(1, as.integer(1))Check the class membership of an argument
checkClass(x, classes, ordered = FALSE, null.ok = FALSE) check_class(x, classes, ordered = FALSE, null.ok = FALSE) assertClass( x, classes, ordered = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL ) assert_class( x, classes, ordered = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL ) testClass(x, classes, ordered = FALSE, null.ok = FALSE) test_class(x, classes, ordered = FALSE, null.ok = FALSE) expect_class( x, classes, ordered = FALSE, null.ok = FALSE, info = NULL, label = vname(x) )# Create an object with classes "foo" and "bar" x = 1 class(x) = c("foo", "bar") # is x of class "foo"? testClass(x, "foo") # is x of class "foo" and "bar"? testClass(x, c("foo", "bar")) # is x of class "foo" or "bar"? assert( checkClass(x, "foo"), checkClass(x, "bar") ) # is x most specialized as "bar"? testClass(x, "bar", ordered = TRUE)Check if an argument is a vector of type complex
checkComplex( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) check_complex( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) assertComplex( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL ) assert_complex( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL ) testComplex( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) test_complex( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) expect_complex( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE, info = NULL, label = vname(x) )testComplex(1) testComplex(1+1i)A count is defined as non-negative integerish value.
checkCount( x, na.ok = FALSE, positive = FALSE, tol = sqrt(.Machine$double.eps), null.ok = FALSE ) check_count( x, na.ok = FALSE, positive = FALSE, tol = sqrt(.Machine$double.eps), null.ok = FALSE ) assertCount( x, na.ok = FALSE, positive = FALSE, tol = sqrt(.Machine$double.eps), null.ok = FALSE, coerce = FALSE, .var.name = vname(x), add = NULL ) assert_count( x, na.ok = FALSE, positive = FALSE, tol = sqrt(.Machine$double.eps), null.ok = FALSE, coerce = FALSE, .var.name = vname(x), add = NULL ) testCount( x, na.ok = FALSE, positive = FALSE, tol = sqrt(.Machine$double.eps), null.ok = FALSE ) test_count( x, na.ok = FALSE, positive = FALSE, tol = sqrt(.Machine$double.eps), null.ok = FALSE ) expect_count( x, na.ok = FALSE, positive = FALSE, tol = sqrt(.Machine$double.eps), null.ok = FALSE, info = NULL, label = vname(x) )testCount(1) testCount(-1)Check if an argument is a data frame
checkDataFrame( x, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE ) check_data_frame( x, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE ) assertDataFrame( x, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL ) assert_data_frame( x, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL ) testDataFrame( x, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE ) test_data_frame( x, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE ) expect_data_frame( x, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE, info = NULL, label = vname(x) )testDataFrame(iris) testDataFrame(iris, types = c("numeric", "factor"), min.rows = 1, col.names = "named")Check if an argument is a data table
checkDataTable( x, key = NULL, index = NULL, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE ) check_data_table( x, key = NULL, index = NULL, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE ) assertDataTable( x, key = NULL, index = NULL, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL ) assert_data_table( x, key = NULL, index = NULL, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL ) testDataTable( x, key = NULL, index = NULL, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE ) test_data_table( x, key = NULL, index = NULL, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE ) expect_data_table( x, key = NULL, index = NULL, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE, info = NULL, label = vname(x) )library(data.table) dt = as.data.table(iris) setkeyv(dt, "Species") setkeyv(dt, "Sepal.Length", physical = FALSE) testDataTable(dt) testDataTable(dt, key = "Species", index = "Sepal.Length", any.missing = FALSE)Checks that an object is of class [base]Date.
checkDate( x, lower = NULL, upper = NULL, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, null.ok = FALSE ) check_date( x, lower = NULL, upper = NULL, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, null.ok = FALSE ) assertDate( x, lower = NULL, upper = NULL, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL ) assert_date( x, lower = NULL, upper = NULL, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL ) testDate( x, lower = NULL, upper = NULL, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, null.ok = FALSE ) test_date( x, lower = NULL, upper = NULL, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, null.ok = FALSE ) expect_date( x, lower = NULL, upper = NULL, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, null.ok = FALSE, info = NULL, label = vname(x) )Check for existence and access rights of directories
checkDirectoryExists(x, access = "") check_directory_exists(x, access = "") assertDirectoryExists(x, access = "", .var.name = vname(x), add = NULL) assert_directory_exists(x, access = "", .var.name = vname(x), add = NULL) testDirectoryExists(x, access = "") test_directory_exists(x, access = "") expect_directory_exists(x, access = "", info = NULL, label = vname(x)) checkDirectory(x, access = "") assertDirectory(x, access = "", .var.name = vname(x), add = NULL) assert_directory(x, access = "", .var.name = vname(x), add = NULL) testDirectory(x, access = "") test_directory(x, access = "") expect_directory(x, access = "", info = NULL, label = vname(x))# Is R's home directory readable? testDirectory(R.home(), "r") # Is R's home directory readable and writable? testDirectory(R.home(), "rw")Check if an argument is disjunct from a given set
checkDisjunct(x, y, fmatch = FALSE) check_disjunct(x, y, fmatch = FALSE) assertDisjunct(x, y, fmatch = FALSE, .var.name = vname(x), add = NULL) assert_disjunct(x, y, fmatch = FALSE, .var.name = vname(x), add = NULL) testDisjunct(x, y, fmatch = FALSE) test_disjunct(x, y, fmatch = FALSE) expect_disjunct(x, y, fmatch = FALSE, info = NULL, label = vname(x))testDisjunct(1L, letters) testDisjunct(c("a", "z"), letters) # x is not converted before the comparison (except for numerics) testDisjunct(factor("a"), "a") testDisjunct(1, "1") testDisjunct(1, as.integer(1))Check that an argument is a vector of type double
checkDouble( x, lower = -Inf, upper = Inf, finite = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) check_double( x, lower = -Inf, upper = Inf, finite = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) assertDouble( x, lower = -Inf, upper = Inf, finite = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL ) assert_double( x, lower = -Inf, upper = Inf, finite = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL ) testDouble( x, lower = -Inf, upper = Inf, finite = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) test_double( x, lower = -Inf, upper = Inf, finite = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) expect_double( x, lower = -Inf, upper = Inf, finite = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE, info = NULL, label = vname(x) )testDouble(1) testDouble(1L) testDouble(1, min.len = 1, lower = 0)Check if an argument is an environment
checkEnvironment(x, contains = character(0L), null.ok = FALSE) check_environment(x, contains = character(0L), null.ok = FALSE) assertEnvironment( x, contains = character(0L), null.ok = FALSE, .var.name = vname(x), add = NULL ) assert_environment( x, contains = character(0L), null.ok = FALSE, .var.name = vname(x), add = NULL ) testEnvironment(x, contains = character(0L), null.ok = FALSE) test_environment(x, contains = character(0L), null.ok = FALSE) expect_environment( x, contains = character(0L), null.ok = FALSE, info = NULL, label = vname(x) )ee = as.environment(list(a = 1)) testEnvironment(ee) testEnvironment(ee, contains = "a")Simply checks if an argument is FALSE.
checkFALSE(x, na.ok = FALSE) check_false(x, na.ok = FALSE) assertFALSE(x, na.ok = FALSE, .var.name = vname(x), add = NULL) assert_false(x, na.ok = FALSE, .var.name = vname(x), add = NULL) testFALSE(x, na.ok = FALSE) test_false(x, na.ok = FALSE)testFALSE(FALSE) testFALSE(TRUE)Check if an argument is a factor
checkFactor( x, levels = NULL, ordered = NA, empty.levels.ok = TRUE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, n.levels = NULL, min.levels = NULL, max.levels = NULL, unique = FALSE, names = NULL, null.ok = FALSE ) check_factor( x, levels = NULL, ordered = NA, empty.levels.ok = TRUE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, n.levels = NULL, min.levels = NULL, max.levels = NULL, unique = FALSE, names = NULL, null.ok = FALSE ) assertFactor( x, levels = NULL, ordered = NA, empty.levels.ok = TRUE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, n.levels = NULL, min.levels = NULL, max.levels = NULL, unique = FALSE, names = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL ) assert_factor( x, levels = NULL, ordered = NA, empty.levels.ok = TRUE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, n.levels = NULL, min.levels = NULL, max.levels = NULL, unique = FALSE, names = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL ) testFactor( x, levels = NULL, ordered = NA, empty.levels.ok = TRUE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, n.levels = NULL, min.levels = NULL, max.levels = NULL, unique = FALSE, names = NULL, null.ok = FALSE ) test_factor( x, levels = NULL, ordered = NA, empty.levels.ok = TRUE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, n.levels = NULL, min.levels = NULL, max.levels = NULL, unique = FALSE, names = NULL, null.ok = FALSE ) expect_factor( x, levels = NULL, ordered = NA, empty.levels.ok = TRUE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, n.levels = NULL, min.levels = NULL, max.levels = NULL, unique = FALSE, names = NULL, null.ok = FALSE, info = NULL, label = vname(x) )x = factor("a", levels = c("a", "b")) testFactor(x) testFactor(x, empty.levels.ok = FALSE)Check existence and access rights of files
checkFileExists(x, access = "", extension = NULL) check_file_exists(x, access = "", extension = NULL) assertFileExists( x, access = "", extension = NULL, .var.name = vname(x), add = NULL ) assert_file_exists( x, access = "", extension = NULL, .var.name = vname(x), add = NULL ) testFileExists(x, access = "", extension = NULL) test_file_exists(x, access = "", extension = NULL) expect_file_exists( x, access = "", extension = NULL, info = NULL, label = vname(x) ) checkFile(x, access = "", extension = NULL) assertFile(x, access = "", extension = NULL, .var.name = vname(x), add = NULL) assert_file(x, access = "", extension = NULL, .var.name = vname(x), add = NULL) testFile(x, access = "", extension = NULL) expect_file(x, access = "", extension = NULL, info = NULL, label = vname(x))# Check if R's COPYING file is readable testFileExists(file.path(R.home(), "COPYING"), access = "r") # Check if R's COPYING file is readable and writable testFileExists(file.path(R.home(), "COPYING"), access = "rw")A flag is defined as single logical value.
checkFlag(x, na.ok = FALSE, null.ok = FALSE) check_flag(x, na.ok = FALSE, null.ok = FALSE) assertFlag(x, na.ok = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL) assert_flag( x, na.ok = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL ) testFlag(x, na.ok = FALSE, null.ok = FALSE) test_flag(x, na.ok = FALSE, null.ok = FALSE) expect_flag(x, na.ok = FALSE, null.ok = FALSE, info = NULL, label = vname(x))testFlag(TRUE) testFlag(1)Check if an argument is a formula
checkFormula(x, null.ok = FALSE) check_formula(x, null.ok = FALSE) assertFormula(x, null.ok = FALSE, .var.name = vname(x), add = NULL) assert_formula(x, null.ok = FALSE, .var.name = vname(x), add = NULL) testFormula(x, null.ok = FALSE) test_formula(x, null.ok = FALSE) expect_formula(x, null.ok = FALSE, info = NULL, label = vname(x))f = Species ~ Sepal.Length + Sepal.Width checkFormula(f)Check if an argument is a function
checkFunction(x, args = NULL, ordered = FALSE, nargs = NULL, null.ok = FALSE) check_function(x, args = NULL, ordered = FALSE, nargs = NULL, null.ok = FALSE) assertFunction( x, args = NULL, ordered = FALSE, nargs = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL ) assert_function( x, args = NULL, ordered = FALSE, nargs = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL ) testFunction(x, args = NULL, ordered = FALSE, nargs = NULL, null.ok = FALSE) test_function(x, args = NULL, ordered = FALSE, nargs = NULL, null.ok = FALSE) expect_function( x, args = NULL, ordered = FALSE, nargs = NULL, null.ok = FALSE, info = NULL, label = vname(x) )testFunction(mean) testFunction(mean, args = "x")Check if an argument is a single integerish value
checkInt( x, na.ok = FALSE, lower = -Inf, upper = Inf, tol = sqrt(.Machine$double.eps), null.ok = FALSE ) check_int( x, na.ok = FALSE, lower = -Inf, upper = Inf, tol = sqrt(.Machine$double.eps), null.ok = FALSE ) assertInt( x, na.ok = FALSE, lower = -Inf, upper = Inf, tol = sqrt(.Machine$double.eps), null.ok = FALSE, coerce = FALSE, .var.name = vname(x), add = NULL ) assert_int( x, na.ok = FALSE, lower = -Inf, upper = Inf, tol = sqrt(.Machine$double.eps), null.ok = FALSE, coerce = FALSE, .var.name = vname(x), add = NULL ) testInt( x, na.ok = FALSE, lower = -Inf, upper = Inf, tol = sqrt(.Machine$double.eps), null.ok = FALSE ) test_int( x, na.ok = FALSE, lower = -Inf, upper = Inf, tol = sqrt(.Machine$double.eps), null.ok = FALSE ) expect_int( x, na.ok = FALSE, lower = -Inf, upper = Inf, tol = sqrt(.Machine$double.eps), null.ok = FALSE, info = NULL, label = vname(x) )testInt(1) testInt(-1, lower = 0)Check if an argument is vector of type integer
checkInteger( x, lower = -Inf, upper = Inf, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) check_integer( x, lower = -Inf, upper = Inf, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) assertInteger( x, lower = -Inf, upper = Inf, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL ) assert_integer( x, lower = -Inf, upper = Inf, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL ) testInteger( x, lower = -Inf, upper = Inf, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) test_integer( x, lower = -Inf, upper = Inf, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) expect_integer( x, lower = -Inf, upper = Inf, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE, info = NULL, label = vname(x) )testInteger(1L) testInteger(1.) testInteger(1:2, lower = 1, upper = 2, any.missing = FALSE)An integerish value is defined as value safely convertible to integer. This includes integers and numeric values which sufficiently close to an integer w.r.t. a numeric tolerance `tol`.
checkIntegerish( x, tol = sqrt(.Machine$double.eps), lower = -Inf, upper = Inf, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) check_integerish( x, tol = sqrt(.Machine$double.eps), lower = -Inf, upper = Inf, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) assertIntegerish( x, tol = sqrt(.Machine$double.eps), lower = -Inf, upper = Inf, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE, coerce = FALSE, .var.name = vname(x), add = NULL ) assert_integerish( x, tol = sqrt(.Machine$double.eps), lower = -Inf, upper = Inf, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE, coerce = FALSE, .var.name = vname(x), add = NULL ) testIntegerish( x, tol = sqrt(.Machine$double.eps), lower = -Inf, upper = Inf, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) test_integerish( x, tol = sqrt(.Machine$double.eps), lower = -Inf, upper = Inf, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) expect_integerish( x, tol = sqrt(.Machine$double.eps), lower = -Inf, upper = Inf, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE, info = NULL, label = vname(x) )testIntegerish(1L) testIntegerish(1.) testIntegerish(1:2, lower = 1L, upper = 2L, any.missing = FALSE)Check if an argument is a list
checkList( x, types = character(0L), any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, null.ok = FALSE ) check_list( x, types = character(0L), any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, null.ok = FALSE ) assertList( x, types = character(0L), any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL ) assert_list( x, types = character(0L), any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL ) testList( x, types = character(0L), any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, null.ok = FALSE ) test_list( x, types = character(0L), any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, null.ok = FALSE ) expect_list( x, types = character(0L), any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, null.ok = FALSE, info = NULL, label = vname(x) )testList(list()) testList(as.list(iris), types = c("numeric", "factor")) # Missingness testList(list(1, NA), any.missing = FALSE) testList(list(1, NULL), any.missing = FALSE) # Uniqueness differentiates between different NA types: testList(list(NA, NA), unique = TRUE) testList(list(NA, NA_real_), unique = TRUE)Check if an argument is a vector of type logical
checkLogical( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) check_logical( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) assertLogical( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL ) assert_logical( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL ) testLogical( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) test_logical( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) expect_logical( x, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE, info = NULL, label = vname(x) )testLogical(TRUE) testLogical(TRUE, min.len = 1)Check if an argument is a matrix
checkMatrix( x, mode = NULL, any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE ) check_matrix( x, mode = NULL, any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE ) assertMatrix( x, mode = NULL, any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL ) assert_matrix( x, mode = NULL, any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL ) testMatrix( x, mode = NULL, any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE ) test_matrix( x, mode = NULL, any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE ) expect_matrix( x, mode = NULL, any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE, info = NULL, label = vname(x) )x = matrix(1:9, 3) colnames(x) = letters[1:3] testMatrix(x, nrows = 3, min.cols = 1, col.names = "named")Check the class membership of an argument
checkMultiClass(x, classes, null.ok = FALSE) check_multi_class(x, classes, null.ok = FALSE) assertMultiClass(x, classes, null.ok = FALSE, .var.name = vname(x), add = NULL) assert_multi_class( x, classes, null.ok = FALSE, .var.name = vname(x), add = NULL ) testMultiClass(x, classes, null.ok = FALSE) test_multi_class(x, classes, null.ok = FALSE) expect_multi_class(x, classes, null.ok = FALSE, info = NULL, label = vname(x))x = 1 class(x) = "bar" checkMultiClass(x, c("foo", "bar")) checkMultiClass(x, c("foo", "foobar"))Check if an argument is named
checkNamed(x, type = "named") check_named(x, type = "named") assertNamed(x, type = "named", .var.name = vname(x), add = NULL) assert_named(x, type = "named", .var.name = vname(x), add = NULL) testNamed(x, type = "named") test_named(x, type = "named")x = 1:3 testNamed(x, "unnamed") names(x) = letters[1:3] testNamed(x, "unique")Performs various checks on character vectors, usually names.
checkNames( x, type = "named", subset.of = NULL, must.include = NULL, permutation.of = NULL, identical.to = NULL, disjunct.from = NULL, what = "names" ) check_names( x, type = "named", subset.of = NULL, must.include = NULL, permutation.of = NULL, identical.to = NULL, disjunct.from = NULL, what = "names" ) assertNames( x, type = "named", subset.of = NULL, must.include = NULL, permutation.of = NULL, identical.to = NULL, disjunct.from = NULL, what = "names", .var.name = vname(x), add = NULL ) assert_names( x, type = "named", subset.of = NULL, must.include = NULL, permutation.of = NULL, identical.to = NULL, disjunct.from = NULL, what = "names", .var.name = vname(x), add = NULL ) testNames( x, type = "named", subset.of = NULL, must.include = NULL, permutation.of = NULL, identical.to = NULL, disjunct.from = NULL, what = "names" ) test_names( x, type = "named", subset.of = NULL, must.include = NULL, permutation.of = NULL, identical.to = NULL, disjunct.from = NULL, what = "names" ) expect_names( x, type = "named", subset.of = NULL, must.include = NULL, permutation.of = NULL, identical.to = NULL, disjunct.from = NULL, what = "names", info = NULL, label = vname(x) )x = 1:3 testNames(names(x), "unnamed") names(x) = letters[1:3] testNames(names(x), "unique") cn = c("Species", "Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width") assertNames(names(iris), permutation.of = cn)Check if an argument is NULL
checkNull(x) check_null(x) assertNull(x, .var.name = vname(x), add = NULL) assert_null(x, .var.name = vname(x), add = NULL) testNull(x) test_null(x)testNull(NULL) testNull(1)Check if an argument is a single numeric value
checkNumber( x, na.ok = FALSE, lower = -Inf, upper = Inf, finite = FALSE, null.ok = FALSE ) check_number( x, na.ok = FALSE, lower = -Inf, upper = Inf, finite = FALSE, null.ok = FALSE ) assertNumber( x, na.ok = FALSE, lower = -Inf, upper = Inf, finite = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL ) assert_number( x, na.ok = FALSE, lower = -Inf, upper = Inf, finite = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL ) testNumber( x, na.ok = FALSE, lower = -Inf, upper = Inf, finite = FALSE, null.ok = FALSE ) test_number( x, na.ok = FALSE, lower = -Inf, upper = Inf, finite = FALSE, null.ok = FALSE ) expect_number( x, na.ok = FALSE, lower = -Inf, upper = Inf, finite = FALSE, null.ok = FALSE, info = NULL, label = vname(x) )testNumber(1) testNumber(1:2)Vectors of storage type integer and double count as numeric, c.f. [base]is.numeric. To explicitly check for real integer or double vectors, see checkInteger, checkIntegerish or checkDouble.
checkNumeric( x, lower = -Inf, upper = Inf, finite = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) check_numeric( x, lower = -Inf, upper = Inf, finite = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) assertNumeric( x, lower = -Inf, upper = Inf, finite = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL ) assert_numeric( x, lower = -Inf, upper = Inf, finite = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL ) testNumeric( x, lower = -Inf, upper = Inf, finite = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) test_numeric( x, lower = -Inf, upper = Inf, finite = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE ) expect_numeric( x, lower = -Inf, upper = Inf, finite = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, typed.missing = FALSE, null.ok = FALSE, info = NULL, label = vname(x) )testNumeric(1) testNumeric(1, min.len = 1, lower = 0)Check the operating system
checkOS(os) check_os(os) assertOS(os, add = NULL, .var.name = NULL) assert_os(os, add = NULL, .var.name = NULL) testOS(os) test_os(os) expect_os(os, info = NULL, label = NULL)testOS("linux")Checks that an object is of class [base]POSIXct.
checkPOSIXct( x, lower = NULL, upper = NULL, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, null.ok = FALSE ) check_posixct( x, lower = NULL, upper = NULL, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, null.ok = FALSE ) assertPOSIXct( x, lower = NULL, upper = NULL, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL ) assert_posixct( x, lower = NULL, upper = NULL, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL ) testPOSIXct( x, lower = NULL, upper = NULL, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, null.ok = FALSE ) test_posixct( x, lower = NULL, upper = NULL, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, null.ok = FALSE ) expect_posixct( x, lower = NULL, upper = NULL, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, null.ok = FALSE, info = NULL, label = vname(x) )Check if a file path can be used safely to create a file and write to it. This is checked: Does dirname(x) exist? Does no file under path x exist? Is dirname(x) writable? Paths are relative to the current working directory.
checkPathForOutput(x, overwrite = FALSE, extension = NULL) check_path_for_output(x, overwrite = FALSE, extension = NULL) assertPathForOutput( x, overwrite = FALSE, extension = NULL, .var.name = vname(x), add = NULL ) assert_path_for_output( x, overwrite = FALSE, extension = NULL, .var.name = vname(x), add = NULL ) testPathForOutput(x, overwrite = FALSE, extension = NULL) test_path_for_output(x, overwrite = FALSE, extension = NULL) expect_path_for_output( x, overwrite = FALSE, extension = NULL, info = NULL, label = vname(x) )# Can we create a file in the tempdir? testPathForOutput(file.path(tempdir(), "process.log"))In contrast to checkSetEqual, the function tests for a true permutation of the two vectors and also considers duplicated values. Missing values are being treated as actual values by default. Does not work on raw values.
checkPermutation(x, y, na.ok = TRUE) check_permutation(x, y, na.ok = TRUE) assertPermutation(x, y, na.ok = TRUE, .var.name = vname(x), add = NULL) assert_permutation(x, y, na.ok = TRUE, .var.name = vname(x), add = NULL) testPermutation(x, y, na.ok = TRUE) test_permutation(x, y, na.ok = TRUE) expect_permutation(x, y, na.ok = TRUE, info = NULL, label = vname(x))testPermutation(letters[1:2], letters[2:1]) testPermutation(letters[c(1, 1, 2)], letters[1:2]) testPermutation(c(NA, 1, 2), c(1, 2, NA)) testPermutation(c(NA, 1, 2), c(1, 2, NA), na.ok = FALSE)Check if an argument is an R6 class
checkR6( x, classes = NULL, ordered = FALSE, cloneable = NULL, public = NULL, private = NULL, null.ok = FALSE ) check_r6( x, classes = NULL, ordered = FALSE, cloneable = NULL, public = NULL, private = NULL, null.ok = FALSE ) assertR6( x, classes = NULL, ordered = FALSE, cloneable = NULL, public = NULL, private = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL ) assert_r6( x, classes = NULL, ordered = FALSE, cloneable = NULL, public = NULL, private = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL ) testR6( x, classes = NULL, ordered = FALSE, cloneable = NULL, public = NULL, private = NULL, null.ok = FALSE ) test_r6( x, classes = NULL, ordered = FALSE, cloneable = NULL, public = NULL, private = NULL, null.ok = FALSE ) expect_r6( x, classes = NULL, ordered = FALSE, cloneable = NULL, public = NULL, private = NULL, null.ok = FALSE, info = NULL, label = vname(x) )library(R6) generator = R6Class("Bar", public = list(a = 5), private = list(b = 42), active = list(c = function() 99) ) x = generator$new() checkR6(x, "Bar", cloneable = TRUE, public = "a")Check if an argument is a raw vector
checkRaw( x, len = NULL, min.len = NULL, max.len = NULL, names = NULL, null.ok = FALSE ) check_raw( x, len = NULL, min.len = NULL, max.len = NULL, names = NULL, null.ok = FALSE ) assertRaw( x, len = NULL, min.len = NULL, max.len = NULL, names = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL ) assert_raw( x, len = NULL, min.len = NULL, max.len = NULL, names = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL ) testRaw( x, len = NULL, min.len = NULL, max.len = NULL, names = NULL, null.ok = FALSE ) test_raw( x, len = NULL, min.len = NULL, max.len = NULL, names = NULL, null.ok = FALSE ) expect_raw( x, len = NULL, min.len = NULL, max.len = NULL, names = NULL, null.ok = FALSE, info = NULL, label = vname(x) )testRaw(as.raw(2), min.len = 1L)Check if an argument is a single atomic value
checkScalar(x, na.ok = FALSE, null.ok = FALSE) check_scalar(x, na.ok = FALSE, null.ok = FALSE) assertScalar( x, na.ok = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL ) assert_scalar( x, na.ok = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL ) testScalar(x, na.ok = FALSE, null.ok = FALSE) test_scalar(x, na.ok = FALSE, null.ok = FALSE) expect_scalar(x, na.ok = FALSE, null.ok = FALSE, info = NULL, label = vname(x))testScalar(1) testScalar(1:10)Check if an argument is a single missing value
checkScalarNA(x, null.ok = FALSE) check_scalar_na(x, null.ok = FALSE) assertScalarNA(x, null.ok = FALSE, .var.name = vname(x), add = NULL) assert_scalar_na(x, null.ok = FALSE, .var.name = vname(x), add = NULL) testScalarNA(x, null.ok = FALSE) test_scalar_na(x, null.ok = FALSE) expect_scalar_na(x, null.ok = FALSE, info = NULL, label = vname(x))testScalarNA(1) testScalarNA(NA_real_) testScalarNA(rep(NA, 2))Check if an argument is equal to a given set
checkSetEqual(x, y, ordered = FALSE, fmatch = FALSE) check_set_equal(x, y, ordered = FALSE, fmatch = FALSE) assertSetEqual( x, y, ordered = FALSE, fmatch = FALSE, .var.name = vname(x), add = NULL ) assert_set_equal( x, y, ordered = FALSE, fmatch = FALSE, .var.name = vname(x), add = NULL ) testSetEqual(x, y, ordered = FALSE, fmatch = FALSE) test_set_equal(x, y, ordered = FALSE, fmatch = FALSE) expect_set_equal( x, y, ordered = FALSE, fmatch = FALSE, info = NULL, label = vname(x) )testSetEqual(c("a", "b"), c("a", "b")) testSetEqual(1:3, 1:4) # x is not converted before the comparison (except for numerics) testSetEqual(factor("a"), "a") testSetEqual(1, "1") testSetEqual(1, as.integer(1))A string is defined as a scalar character vector. To check for vectors of arbitrary length, see checkCharacter.
checkString( x, na.ok = FALSE, n.chars = NULL, min.chars = NULL, max.chars = NULL, pattern = NULL, fixed = NULL, ignore.case = FALSE, null.ok = FALSE ) check_string( x, na.ok = FALSE, n.chars = NULL, min.chars = NULL, max.chars = NULL, pattern = NULL, fixed = NULL, ignore.case = FALSE, null.ok = FALSE ) assertString( x, na.ok = FALSE, n.chars = NULL, min.chars = NULL, max.chars = NULL, pattern = NULL, fixed = NULL, ignore.case = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL ) assert_string( x, na.ok = FALSE, n.chars = NULL, min.chars = NULL, max.chars = NULL, pattern = NULL, fixed = NULL, ignore.case = FALSE, null.ok = FALSE, .var.name = vname(x), add = NULL ) testString( x, na.ok = FALSE, n.chars = NULL, min.chars = NULL, max.chars = NULL, pattern = NULL, fixed = NULL, ignore.case = FALSE, null.ok = FALSE ) test_string( x, na.ok = FALSE, n.chars = NULL, min.chars = NULL, max.chars = NULL, pattern = NULL, fixed = NULL, ignore.case = FALSE, null.ok = FALSE ) expect_string( x, na.ok = FALSE, n.chars = NULL, min.chars = NULL, max.chars = NULL, pattern = NULL, fixed = NULL, ignore.case = FALSE, null.ok = FALSE, info = NULL, label = vname(x) )testString("a") testString(letters)Check if an argument is a subset of a given set
checkSubset(x, choices, empty.ok = TRUE, fmatch = FALSE) check_subset(x, choices, empty.ok = TRUE, fmatch = FALSE) assertSubset( x, choices, empty.ok = TRUE, fmatch = FALSE, .var.name = vname(x), add = NULL ) assert_subset( x, choices, empty.ok = TRUE, fmatch = FALSE, .var.name = vname(x), add = NULL ) testSubset(x, choices, empty.ok = TRUE, fmatch = FALSE) test_subset(x, choices, empty.ok = TRUE, fmatch = FALSE) expect_subset( x, choices, empty.ok = TRUE, fmatch = FALSE, info = NULL, label = vname(x) )testSubset(c("a", "z"), letters) testSubset("ab", letters) testSubset("Species", names(iris)) # x is not converted before the comparison (except for numerics) testSubset(factor("a"), "a") testSubset(1, "1") testSubset(1, as.integer(1))Simply checks if an argument is TRUE.
checkTRUE(x, na.ok = FALSE) check_true(x, na.ok = FALSE) assertTRUE(x, na.ok = FALSE, .var.name = vname(x), add = NULL) assert_true(x, na.ok = FALSE, .var.name = vname(x), add = NULL) testTRUE(x, na.ok = FALSE) test_true(x, na.ok = FALSE)testTRUE(TRUE) testTRUE(FALSE)Check if an argument is a tibble
checkTibble( x, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE ) check_tibble( x, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE ) assertTibble( x, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL ) assert_tibble( x, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL ) testTibble( x, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE ) test_tibble( x, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE ) expect_tibble( x, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE, info = NULL, label = vname(x) )library(tibble) x = as_tibble(iris) testTibble(x) testTibble(x, nrow = 150, any.missing = FALSE)Check if an argument is a vector
checkVector( x, strict = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, null.ok = FALSE ) check_vector( x, strict = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, null.ok = FALSE ) assertVector( x, strict = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL ) assert_vector( x, strict = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL ) testVector( x, strict = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, null.ok = FALSE ) test_vector( x, strict = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, null.ok = FALSE )testVector(letters, min.len = 1L, any.missing = FALSE)Tests and assertions to perform frequent argument checks. A substantial part of the package was written in C to minimize any worries about execution time overhead.
makeAssertion is the internal function used to evaluate the result of a check and throw an exception if necessary. makeAssertionFunction can be used to automatically create an assertion function based on a check function (see example).
makeAssertion(x, res, var.name, collection) makeAssertionFunction( check.fun, c.fun = NULL, use.namespace = TRUE, coerce = FALSE, env = parent.frame() )# Simple custom check function checkFalse = function(x) if (!identical(x, FALSE)) "Must be FALSE" else TRUE # Create the respective assert function assertFalse = function(x, .var.name = vname(x), add = NULL) res = checkFalse(x) makeAssertion(x, res, .var.name, add) # Alternative: Automatically create such a function assertFalse = makeAssertionFunction(checkFalse) print(assertFalse)makeExpectation is the internal function used to evaluate the result of a check and turn it into an [testthat]expectation. makeExceptionFunction can be used to automatically create an expectation function based on a check function (see example).
makeExpectation(x, res, info, label) makeExpectationFunction( check.fun, c.fun = NULL, use.namespace = FALSE, env = parent.frame() )# Simple custom check function checkFalse = function(x) if (!identical(x, FALSE)) "Must be FALSE" else TRUE # Create the respective expect function expect_false = function(x, info = NULL, label = vname(x)) res = checkFalse(x) makeExpectation(x, res, info = info, label = label) # Alternative: Automatically create such a function expect_false = makeExpectationFunction(checkFalse) print(expect_false)makeTest is the internal function used to evaluate the result of a check and throw an exception if necessary. This function is currently only a stub and just calls [base]isTRUE. makeTestFunction can be used to automatically create an assertion function based on a check function (see example).
makeTest(res) makeTestFunction(check.fun, c.fun = NULL, env = parent.frame())# Simple custom check function checkFalse = function(x) if (!identical(x, FALSE)) "Must be FALSE" else TRUE # Create the respective test function testFalse = function(x) res = checkFalse(x) makeTest(res) # Alternative: Automatically create such a function testFalse = makeTestFunction(checkFalse) print(testFalse)This is an extensions to [base]match.arg with support for AssertCollection. The behavior is very similar to [base]match.arg, except that NULL is not a valid value for x.
matchArg(x, choices, several.ok = FALSE, .var.name = vname(x), add = NULL)matchArg("k", choices = c("kendall", "pearson"))The provided functions parse rules which allow to express some of the most frequent argument checks by typing just a few letters.
qassert(x, rules, .var.name = vname(x)) qtest(x, rules) qexpect(x, rules, info = NULL, label = vname(x))# logical of length 1 qtest(NA, "b1") # logical of length 1, NA not allowed qtest(NA, "B1") # logical of length 0 or 1, NA not allowed qtest(TRUE, "B?") # numeric with length > 0 qtest(runif(10), "n+") # integer with length > 0, NAs not allowed, all integers >= 0 and < Inf qtest(1:3, "I+[0,)") # either an emtpy list or a character vector with <=5 elements qtest(1, c("l0", "s<=5")) # data frame with at least one column and no missing value in any column qtest(iris, "D+")These functions are the tuned counterparts of qtest, qassert and qexpect tailored for recursive checks of list elements or data frame columns.
qassertr(x, rules, .var.name = vname(x)) qtestr(x, rules, depth = 1L) qexpectr(x, rules, info = NULL, label = vname(x))# All list elements are integers with length >= 1? qtestr(as.list(1:10), "i+") # All list elements (i.e. data frame columns) are numeric? qtestr(iris, "n") # All list elements are numeric, w/o NAs? qtestr(list(a = 1:3, b = rnorm(1), c = letters), "N+") # All list elements are numeric OR character qtestr(list(a = 1:3, b = rnorm(1), c = letters), c("N+", "S+"))Allows to explicitly select a backend for the unit tests. Currently supported are "testthat" and "tinytest". The respective package must be installed and are loaded (but not attached). If this function is not explicitly called, defaults to "testthat" unless the "tinytest"'s namespace is loaded.
register_test_backend(name)Tries to heuristically determine the variable name of x in the parent frame with a combination of [base]deparse and [base]substitute. Used for checkmate's error messages.
vname(x)A quick C implementation for which.first (head(which(x), 1)) and which.last (tail(which(x), 1)).
wf(x, use.names = TRUE) wl(x, use.names = TRUE)wf(c(FALSE, TRUE)) wl(c(FALSE, FALSE)) wf(NA)| Repository | Version | Published | First seen | Last seen | Docs |
|---|---|---|---|---|---|
| CRAN | 2.3.3 | 2025-08-18 | 2026-05-07 | 2026-05-07 | |
| CRAN | 2.3.2 | 2024-07-29 | 2026-05-07 | 2026-05-07 | |
| CRAN | 2.3.1 | 2023-12-04 | 2026-05-07 | 2026-05-07 | |
| CRAN | 2.3.0 | 2023-10-25 | 2026-05-07 | 2026-05-07 | |
| CRAN | 2.2.0 | 2023-04-27 | 2026-05-07 | 2026-05-07 | |
| CRAN | 2.1.0 | 2022-04-21 | 2026-05-07 | 2026-05-07 | |
| CRAN | 2.0.0 | 2020-02-06 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.9.4 | 2019-07-04 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.9.3 | 2019-05-03 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.9.1 | 2019-01-15 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.9.0 | 2019-01-09 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.8.5 | 2017-10-24 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.8.4 | 2017-09-26 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.8.3 | 2017-07-03 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.8.2 | 2016-11-02 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.8.1 | 2016-06-28 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.8.0 | 2016-06-06 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.7.4 | 2016-04-08 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.7.3 | 2016-03-10 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.7.2 | 2016-02-25 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.7.1 | 2016-02-02 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.7.0 | 2016-01-23 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.6.3 | 2015-10-23 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.6.2 | 2015-07-26 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.6.1 | 2015-07-17 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.6.0 | 2015-06-19 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.5.3 | 2015-05-13 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.5.2 | 2015-03-20 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.5.1 | 2014-12-14 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.5.0 | 2014-10-19 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.4 | 2014-09-03 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.3 | 2014-08-15 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.2 | 2014-07-21 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.1 | 2014-06-28 | 2026-05-07 | 2026-05-07 | |
| CRAN | 1.0 | 2014-06-17 | 2026-05-07 | 2026-05-07 | |
| CRAN | 2.3.4 | 2026-05-29 | 2026-05-30 |
표시할 OSV 데이터가 없습니다.
표시할 OpenAlex 데이터가 없습니다.