checkmate

R 패키지 메타데이터와 수집 신호를 모아 봅니다.

Packages / CRAN / checkmate

checkmate

v2.3.4
checkmate
Repository CRANLicense BSD_3_clause + file LICENSELifecycle activeNeeds compilation yes
DOI
10.32614/CRAN.package.checkmate
Reverse imports
20,655
Reverse depends
117

Core Signals

첫 화면에서 판단해야 할 수집 신호를 먼저 배치합니다.

2
Reverse imports
20,655
Reverse depends
117

Supported Backends

DESCRIPTION에서 감지한 backend 관련 package입니다.

1
D
data.table
Suggests

Quick Facts

기본 메타데이터를 작은 카드와 토큰으로 압축합니다.

profile
Repository
CRAN
Version
2.3.4
License
BSD_3_clause + file LICENSE
Lifecycle
active
Needs compilation
yes
Reverse depends
117
Reverse imports
20,655
Last observed
2026-05-30
CRAN
cran.r-project.org/package=checkmate

수집 소스별 패키지 정보

1개 소스
CRAN
2.3.4
2026-05-30
License
BSD_3_clause + file LICENSE
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
Needs compilation
yes
Reverse depends
117
Reverse imports
20,655
Lifecycle
active
Last observed
2026-05-30 10:45:11

이 패키지가 의존하는 패키지

5개 표시전체 14개
PackageTypeSpec
backports
CRAN · 2.3.4 · 2026-05-30
Importsbackports (>= 1.1.0)
utils
CRAN · 2.3.4 · 2026-05-30
Importsutils
data.table
CRAN · 2.3.4 · 2026-05-30
Suggestsdata.table (>= 1.9.8)
devtools
CRAN · 2.3.4 · 2026-05-30
Suggestsdevtools
fastmatch
CRAN · 2.3.4 · 2026-05-30
Suggestsfastmatch
1 / 3

이 패키지를 쓰는 패키지

5개 표시전체 120개
PackageTypeSpec
cmaesr
1.0.3
CRAN · 2026-05-30
Dependscheckmate (>= 1.1)
forestplot
3.2.0
CRAN · 2026-05-30
Dependscheckmate
smoof
1.7.0
CRAN · 2026-05-30
Dependscheckmate (>= 1.1)
accessibility
1.5.0
CRAN · 2026-05-30
Importscheckmate
adproclus
2.0.1
CRAN · 2026-05-30
Importscheckmate
1 / 24

Reverse dependency summary

3 types
TypePackages
Depends3
Imports529
Suggests18

패키지 페이지

Reverse depends
10
Reverse imports
1,140
Reverse suggests
38
All links
638
Repository
CRAN
Version
2.3.4
Collected
2026-05-22 00:10:49
Package page
https://cran.r-project.org/web/packages/checkmate/index.html
DOI
10.32614/CRAN.package.checkmate
Citation
https://cran.r-project.org/web/packages/checkmate/citation.html
CRAN checks
https://cran.r-project.org/web/checks/check_results_checkmate.html
README
https://cran.r-project.org/web/packages/checkmate/readme/README.html
NEWS
https://cran.r-project.org/web/packages/checkmate/news/news.html
Reference HTML
https://cran.r-project.org/web/packages/checkmate/refman/checkmate.html
Reference PDF
https://cran.r-project.org/web/packages/checkmate/checkmate.pdf
Source package
https://cran.r-project.org/src/contrib/checkmate_2.3.4.tar.gz
Archive
https://CRAN.R-project.org/src/contrib/Archive/checkmate
Page fields
Author
Michel Lang [cre, aut], Bernd Bischl [ctb], Dénes Tóth [ctb]
BugReports
https://github.com/mllg/checkmate/issues
CRAN Checks
checkmate results
Citation
checkmate citation info
DOI
10.32614/CRAN.package.checkmate
License
BSD_3_clause + file LICENSE
Maintainer
Michel Lang <michellang at gmail.com>
Materials
README , NEWS
NeedsCompilation
yes
Old Sources
checkmate archive
Package Source
checkmate_2.3.4.tar.gz
Published
2026-02-03
Reference Manual
checkmate.html , checkmate.pdf
Reverse Depends
cmaesr , forestplot , genomicInstability , smoof , SNPhood
Reverse Imports
accessibility , ADImpute , adproclus , aeddo , aedseo , aldvmm , amt , anglemania , ao , aopdata , APCtools , aRD , aslib , astgrepr , autocogs , autoslider.core , autothresholdr , babelmixr2 , bartMachine , baRulho , baselinenowcast , BatchExperiments , BatchJobs , batchtools , bayesDiagnostics , BayesFBHborrow , BayesFM , BayesianMCPMod , bayesSSM , bbk , BBmisc , bbotk , Bchron , bclogit , beaver , bhmbasket , bidsr , BioTIMEr , bitfield , bonsaiforest , boostrq , bootGOF , botor , brandr , brclimr , bssm , BSW , CalibraCurve , carbonr , caretSDM , causaldef , causalDisco , causalPAF , CDMConnector , censobr , centerline , cfr , Characterization , checkCLI , chevron , chimeraviz , choicedata , chooseGCM , ci , cito , cld , cleanepi , cleanr , clustree , cnefetools , coalitions , codified , codyna , CohortGenerator , CohortMethod , cointReg , ColOpenData , comorbidity , CompensAID , connector , connector.databricks , conogive , contdid , CoreGx , cosimmr , counterfactuals , cre.dcf , crmPack , CrossClustering , crosstable , crumble , ctoclient , cucumber , cvms , cyclestreets , cypress , dapper , dar , DatabaseConnector , dataverse , date4ts , DCCA , DEFormats , detrendr , diffuStats , discharge , DiscreteDatasets , DiscreteFDR , DiscreteFWER , discretes , DiscreteTests , diseasystore , distfromq , distilleR , distionary , distplyr , DistributionIV , document , DoubleML , DrugExposureDiagnostics , DTSg , dunlin , dynamite , easybio , eatRep , eatTools , ecostate , ecr , EFAfactors , EFAtools , EFSATools , EGM , emodnet.wfs , enderecobr , epichains , epicmodel , epidatr , EpiNow2 , epiparameter , epiregulon , epiregulon.extra , eplusr , eppoFindeR , exampletestr , excerptr , fail , famish , farff , fastLogisticRegressionWrap , fastreg , fastVoteR , FCO , FDX , FeatureExtraction , ffscrapr , fHMM , filesstrings , finalsize , flacco , flipdownr , fmeffects , formatdown , formatters , framework , funStatTest , future.batchtools , gDRcore , gDRimport , gDRstyle , gDRtestData , gDRutils , geboes.score , geobr , geocodebr , ggbrain , ggparty , ggplot2.utils , ggPMX , ggtibble , glmSparseNet , glyparse , glyrepr , Gmisc , godley , gofreg , GRaNIE , grapherator , grattan , GreedyExperimentalDesign , gridstackeR , groupdata2 , gtfs2emis , gtfs2gps , gtfstools , guess , HaDeX2 , hcruR , hdf5r.Extra , hdflex , hdm , hermes , hetu , HicAggR , hidradenitis , highs , holiglm , HospitalNetwork , htmlTable , hubUtils , hydroState , HyMETT , IBMPopSim , ICEbox , icmstate , icpack , ie2misc , igvShiny , ijtiff , imaginator , iml , immunarch , immundata , inDAGO , injurytools , inlcolor , inlpubs , innsight , ino , install.load , ipeaplot , itsdm , ivo.table , IxPopDyMod , JohnsonKinaseData , journalR , junco , katdetectr , kgen , KMunicate , LABTNSCPSS , ladder , lazysql , ldaPrototype , leafdown , learnr , limorhyde2 , linelist , llama , lmtp , localICE , logolink , longmixr , loo , lotri , mallet , maraca , marginaleffects , markmyassignment , matchedcc , maths.genealogy , matrixprofiler , MBNMAdose , MBNMAtime , mcboost , mcMST , mcparallelDo , mcradds , mctq , md4r , melt , metabinR , metaRange , metR , midfieldr , miesmuschel , mifa , mini007 , miniPCH , minter , mlr , mlr3 , mlr3batchmark , mlr3benchmark , mlr3cluster , mlr3db , mlr3fairness , mlr3fda , mlr3filters , mlr3fselect , mlr3hyperband , mlr3inferr , mlr3learners , mlr3mbo , mlr3measures , mlr3misc , mlr3oml , mlr3pipelines , mlr3resampling , mlr3spatial , mlr3spatiotempcv , mlr3summary , mlr3superlearner , mlr3torch , mlr3tuning , mlr3tuningspaces , mlr3viz , mlrCPO , mlrintermbo , mlrMBO , mmrm , modelsummary , monolix2rx , MOSClip , MplusAutomation , mregions2 , MSstats , MSstatsConvert , MSstatsLiP , MSstatsPTM , MSstatsTMT , muiMaterial , muttest , mvMAPIT , nandb , nat.utils , nestcolor , NetCoupler , NetworkInference , ngsReports , nlmixr2est , nlmixr2extra , nlmixr2lib , nonmem2rx , npi , nseq , oaii , OBIC , occumb , OdysseusCharacterizationModule , oeli , OhdsiShinyAppBuilder , ohun , OmnipathR , omophub , OncoBayes2 , openFDA , OpenML , opentripplanner , optimizeR , ordbetareg , osdc , otpr , packager , packcircles , pammtools , panstarrs , paradox , parallelMap , ParamHelpers , PaRe , parsermd , PatientGenerator , pcpr , pdfminer , PharmacoGx , phers , photosynthesis , pixiedust , PKbioanalysis , pkggraph , pkgstats , PKNCA , pleioh2g , pmwg , pmxNODE , PNADCperiods , portvine , posterior , priorityelasticnet , prioritylasso , priorsense , ProteoDisco , proverbs , psborrow2 , pushoverr , pvda , pxweb , QTLExperiment , quest , quid , r5r , radous , random.cdisc.data , rasciidoc , rATTAINS , RBesT , RBPcurve , RChASM , rcrisp , RDML , rdomains , reactable.extras , reactRouter , readepi , rearrr , redcapAPI , REDCapR , REDCapSync , REDCapTidieR , RestRserve , ResultModelManager , retel , REXoplanets , rflsgen , Rigma , risk.assessr , rJavaEnv , rjd3toolkit , rjstat , rlistings , RMediation , RobinCar2 , RobinCID , robnptests , ROI , ROI.plugin.qpoases , rollinglda , romic , rosmium , rotulador , RPhosFate , RprobitB , rrandvec , rsimsum , rsprite2 , rsurveycto , rtables , rtables.officer , rtestim , rush , rwarrior , rxode2 , rxode2ll , sacRebleu , safeframe , SAMprior , sanityTracker , sasr , savvyr , SCDB , scMultiome , scorepeak , scoringutils , scTensor , sdcLog , SeedMaker , seekr , segregation , SelfControlledCaseSeries , semantic.dashboard , semEffect , seqHMM , Seqtometry , serofoi , sevenbridges2 , shelter , shiny.blueprint , shiny.telemetry , shinydisconnect , shinymrp , shinytest2 , simfinapi , simIDM , simmr , simPIC , simulist , singIST , sjSDM , slideimp , smcfcs , sobol , socialmixr , softbib , sorvi , SpaDES.tools , spanishoddata , sparrow , sparsevar , spatialDE , SPEI , spINAR , splatter , SqlRender , sspm , SSVS , stabm , stanza , stopmotion , str2str , strata , stratallo , strex , summarytools , supabaseR , superspreading , survdistr , survinger , suwo , sweidnumbr , tabshiftr , TBox , teal , teal.code , teal.data , teal.modules.clinical , teal.modules.general , teal.picks , teal.reporter , teal.slice , teal.transform , teal.widgets , tealeaves , tern , tern.gee , tern.mmrm , test.assessr , TestGenerator , tf , tidier , tidyhte , tidyMC , tidynorm , tidyrates , tidyrules , tidysq , timeOmics , tinyVAST , tna , topiclabels , trackopt , TractorTsbox , transportr , TreatmentPatterns , triact , TrialEmulation , TSEAL , tsmp , tspmeta , TTR.PGM , tuber , tubern , typetracer , uci , usefun , uteals , vaccineff , virustotal , vntrs , vvauditor , vvconverter , webmap , WhatsR , xpectr , xplainfi , xportr , xpose.xtras , xtdml , zendown , zenstats , zFPKM
Reverse Suggests
base64url , bsitar , dbMatrix , deident , epiCo , fitbitr , fritools , fritools2 , fuseMLR , gimms , graphite , htaBIM , icecream , maicplus , Orcs , pulsar , replacer , treePlotArea , zephyr
URL
https://mllg.github.io/checkmate/ , https://github.com/mllg/checkmate
Version
2.3.4
Vignettes
checkmate ( source , R code ) Setup tinytest ( source , R code )
Windows Binaries
r-devel: checkmate_2.3.4.zip , r-release: checkmate_2.3.4.zip , r-oldrel: checkmate_2.3.4.zip
MacOS Binaries
r-release (arm64): checkmate_2.3.4.tgz , r-oldrel (arm64): checkmate_2.3.4.tgz , r-release (x86_64): checkmate_2.3.4.tgz , r-oldrel (x86_64): checkmate_2.3.4.tgz
Version
2.3.4
Published
2026-02-03
DOI
10.32614/CRAN.package.checkmate
Author
Michel Lang [cre, aut], Bernd Bischl [ctb], Dénes Tóth [ctb]
Maintainer
Michel Lang <michellang at gmail.com>
BugReports
https://github.com/mllg/checkmate/issues
License
BSD_3_clause + file LICENSE
URL
https://mllg.github.io/checkmate/ , https://github.com/mllg/checkmate
NeedsCompilation
yes
Citation
checkmate citation info
Materials
README , NEWS
CRAN Checks
checkmate results
Reference Manual
checkmate.html , checkmate.pdf
Vignettes
checkmate ( source , R code ) Setup tinytest ( source , R code )
Package Source
checkmate_2.3.4.tar.gz
Windows Binaries
r-devel: checkmate_2.3.4.zip , r-release: checkmate_2.3.4.zip , r-oldrel: checkmate_2.3.4.zip
MacOS Binaries
r-release (arm64): checkmate_2.3.4.tgz , r-oldrel (arm64): checkmate_2.3.4.tgz , r-release (x86_64): checkmate_2.3.4.tgz , r-oldrel (x86_64): checkmate_2.3.4.tgz
Old Sources
checkmate archive
Reverse Depends
cmaesr , forestplot , genomicInstability , smoof , SNPhood
Reverse Imports
accessibility , ADImpute , adproclus , aeddo , aedseo , aldvmm , amt , anglemania , ao , aopdata , APCtools , aRD , aslib , astgrepr , autocogs , autoslider.core , autothresholdr , babelmixr2 , bartMachine , baRulho , baselinenowcast , BatchExperiments , BatchJobs , batchtools , bayesDiagnostics , BayesFBHborrow , BayesFM , BayesianMCPMod , bayesSSM , bbk , BBmisc , bbotk , Bchron , bclogit , beaver , bhmbasket , bidsr , BioTIMEr , bitfield , bonsaiforest , boostrq , bootGOF , botor , brandr , brclimr , bssm , BSW , CalibraCurve , carbonr , caretSDM , causaldef , causalDisco , causalPAF , CDMConnector , censobr , centerline , cfr , Characterization , checkCLI , chevron , chimeraviz , choicedata , chooseGCM , ci , cito , cld , cleanepi , cleanr , clustree , cnefetools , coalitions , codified , codyna , CohortGenerator , CohortMethod , cointReg , ColOpenData , comorbidity , CompensAID , connector , connector.databricks , conogive , contdid , CoreGx , cosimmr , counterfactuals , cre.dcf , crmPack , CrossClustering , crosstable , crumble , ctoclient , cucumber , cvms , cyclestreets , cypress , dapper , dar , DatabaseConnector , dataverse , date4ts , DCCA , DEFormats , detrendr , diffuStats , discharge , DiscreteDatasets , DiscreteFDR , DiscreteFWER , discretes , DiscreteTests , diseasystore , distfromq , distilleR , distionary , distplyr , DistributionIV , document , DoubleML , DrugExposureDiagnostics , DTSg , dunlin , dynamite , easybio , eatRep , eatTools , ecostate , ecr , EFAfactors , EFAtools , EFSATools , EGM , emodnet.wfs , enderecobr , epichains , epicmodel , epidatr , EpiNow2 , epiparameter , epiregulon , epiregulon.extra , eplusr , eppoFindeR , exampletestr , excerptr , fail , famish , farff , fastLogisticRegressionWrap , fastreg , fastVoteR , FCO , FDX , FeatureExtraction , ffscrapr , fHMM , filesstrings , finalsize , flacco , flipdownr , fmeffects , formatdown , formatters , framework , funStatTest , future.batchtools , gDRcore , gDRimport , gDRstyle , gDRte
Reverse Suggests
base64url , bsitar , dbMatrix , deident , epiCo , fitbitr , fritools , fritools2 , fuseMLR , gimms , graphite , htaBIM , icecream , maicplus , Orcs , pulsar , replacer , treePlotArea , zephyr
Page sections 4
Documentation
Heading
Documentation
Links
[{"label":"checkmate.html","section":"","type":"","url":"https://cran.r-project.org/web/packages/checkmate/refman/checkmate.html"},{"label":"checkmate.pdf","section":"","type":"","url":"https://cran.r-project.org/web/packages/checkmate/checkmate.pdf"},{"label":"checkmate","section":"","type":"","url":"https://cran.r-project.org/web/packages/checkmate/vignettes/checkmate.html"},{"label":"source","section":"","type":"","url":"https://cran.r-project.org/web/packages/checkmate/vignettes/checkmate.Rmd"},{"label":"R code","section":"","type":"","url":"https://cran.r-project.org/web/packages/checkmate/vignettes/checkmate.R"},{"label":"Setup tinytest","section":"","type":"","url":"https://cran.r-project.org/web/packages/checkmate/vignettes/tinytest.html"},{"label":"source","section":"","type":"","url":"https://cran.r-project.org/web/packages/checkmate/vignettes/tinytest.Rmd"},{"label":"R code","section":"","type":"","url":"https://cran.r-project.org/web/packages/checkmate/vignettes/tinytest.R"}]
Text
Reference manual: checkmate.html , checkmate.pdf Vignettes: checkmate ( source , R code ) Setup tinytest ( source , R code )
Downloads
Heading
Downloads
Links
[{"label":"checkmate_2.3.4.tar.gz","section":"","type":"","url":"https://cran.r-project.org/src/contrib/checkmate_2.3.4.tar.gz"},{"label":"checkmate_2.3.4.zip","section":"","type":"","url":"https://cran.r-project.org/bin/windows/contrib/4.7/checkmate_2.3.4.zip"},{"label":"checkmate_2.3.4.zip","section":"","type":"","url":"https://cran.r-project.org/bin/windows/contrib/4.6/checkmate_2.3.4.zip"},{"label":"checkmate_2.3.4.zip","section":"","type":"","url":"https://cran.r-project.org/bin/windows/contrib/4.5/checkmate_2.3.4.zip"},{"label":"checkmate_2.3.4.tgz","section":"","type":"","url":"https://cran.r-project.org/bin/macosx/sonoma-arm64/contrib/4.6/checkmate_2.3.4.tgz"},{"label":"checkmate_2.3.4.tgz","section":"","type":"","url":"https://cran.r-project.org/bin/macosx/big-sur-arm64/contrib/4.5/checkmate_2.3.4.tgz"},{"label":"checkmate_2.3.4.tgz","section":"","type":"","url":"https://cran.r-project.org/bin/macosx/big-sur-x86_64/contrib/4.6/checkmate_2.3.4.tgz"},{"label":"checkmate_2.3.4.tgz","section":"","type":"","url":"https://cran.r-project.org/bin/macosx/big-sur-x86_64/contrib/4.5/checkmate_2.3.4.tgz"},{"label":"checkmate archive","section":"","type":"","url":"https://CRAN.R-project.org/src/contrib/Archive/checkmate"}]
Text
Package source: checkmate_2.3.4.tar.gz Windows binaries: r-devel: checkmate_2.3.4.zip , r-release: checkmate_2.3.4.zip , r-oldrel: checkmate_2.3.4.zip macOS binaries: r-release (arm64): checkmate_2.3.4.tgz , r-oldrel (arm64): checkmate_2.3.4.tgz , r-release (x86_64): checkmate_2.3.4.tgz , r-oldrel (x86_64): checkmate_2.3.4.tgz Old sources: checkmate archive
Reverse dependencies
Heading
Reverse dependencies
Links
[{"label":"cmaesr","section":"","type":"","url":"https://cran.r-project.org/web/packages/cmaesr/index.html"},{"label":"forestplot","section":"","type":"","url":"https://cran.r-project.org/web/packages/forestplot/index.html"},{"label":"genomicInstability","section":"","type":"","url":"https://www.bioconductor.org/packages/release/bioc/html/genomicInstability.html"},{"label":"smoof","section":"","type":"","url":"https://cran.r-project.org/web/packages/smoof/index.html"},{"label":"SNPhood","section":"","type":"","url":"https://www.bioconductor.org/packages/release/bioc/html/SNPhood.html"},{"label":"accessibility","section":"","type":"","url":"https://cran.r-project.org/web/packages/accessibility/index.html"},{"label":"ADImpute","section":"","type":"","url":"https://www.bioconductor.org/packages/release/bioc/html/ADImpute.html"},{"label":"adproclus","section":"","type":"","url":"https://cran.r-project.org/web/packages/adproclus/index.html"},{"label":"aeddo","section":"","type":"","url":"https://cran.r-project.org/web/packages/aeddo/index.html"},{"label":"aedseo","section":"","type":"","url":"https://cran.r-project.org/web/packages/aedseo/index.html"},{"label":"aldvmm","section":"","type":"","url":"https://cran.r-project.org/web/packages/aldvmm/index.html"},{"label":"amt","section":"","type":"","url":"https://cran.r-project.org/web/packages/amt/index.html"},{"label":"anglemania","section":"","type":"","url":"https://www.bioconductor.org/packages/release/bioc/html/anglemania.html"},{"label":"ao","section":"","type":"","url":"https://cran.r-project.org/web/packages/ao/index.html"},{"label":"aopdata","section":"","type":"","url":"https://cran.r-project.org/web/packages/aopdata/index.html"},{"label":"APCtools","section":"","type":"","url":"https://cran.r-project.org/web/packages/APCtools/index.html"},{"label":"aRD","section":"","type":"","url":"https://cran.r-project.org/web/packages/aRD/index.html"},{"label":"aslib","section":"","type":"","url":"https://cran.r-project.org/web/packages/aslib/index.html"},{"label":"astgrepr","section":"","type":"","url":"https://cran.r-project.org/web/packages/astgrepr/index.html"},{"label":"autocogs","section":"","type":"","url":"https://cran.r-project.org/web/packages/autocogs/index.html"}]
Text
Reverse depends: cmaesr , forestplot , genomicInstability , smoof , SNPhood Reverse imports: accessibility , ADImpute , adproclus , aeddo , aedseo , aldvmm , amt , anglemania , ao , aopdata , APCtools , aRD , aslib , astgrepr , autocogs , autoslider.core , autothresholdr , babelmixr2 , bartMachine , baRulho , baselinenowcast , BatchExperiments , BatchJobs , batchtools , bayesDiagnostics , BayesFBHborrow , BayesFM , BayesianMCPMod , bayesSSM , bbk , BBmisc , bbotk , Bchron , bclogit , beaver , bhmbasket , bidsr , BioTIMEr , bitfield , bonsaiforest , boostrq , bootGOF , botor , brandr , brclimr , bssm , BSW , CalibraCurve , carbonr , caretSDM , causaldef , causalDisco , causalPAF , CDMConnector , censobr , centerline , cfr , Characterization , checkCLI , chevron , chimeraviz , choicedata , chooseGCM , ci , cito , cld , cleanepi , cleanr , clustree , cnefetools , coalitions , codified , codyna , CohortGenerator , CohortMethod , cointReg , ColOpenData , comorbidity , CompensAID , connector , connector.databricks , conogive , contdid , CoreGx , cosimmr , counterfactuals , cre.dcf , crmPack , CrossClustering , crosstable , crumble , ctoclient , cucumber , cvms , cyclestreets , cypress , dapper , dar , DatabaseConnector , dataverse , date4ts , DCCA , DEFormats , detrendr , diffuStats , discharge , DiscreteDatasets , DiscreteFDR , DiscreteFWER , discretes , DiscreteTests , diseasystore , distfromq , distilleR , distionary , distplyr , DistributionIV , document , DoubleML , DrugExposureDiagnostics , DTSg , dunlin , dynamite , easybio , eatRep , eatTools , ecostate , ecr , EFAfactors , EFAtools , EFSATools , EGM , emodnet.wfs , enderecobr , epichains , epicmodel , epidatr , EpiNow2 , epiparameter , epiregulon , epiregulon.extra , eplusr , eppoFindeR , exampletestr , excerptr , fail , famish , farff , fastLogisticRegressionWrap , fastreg , fastVoteR , FCO , FDX , FeatureExtraction , ffscrapr , fHMM , filesstrings , finalsize , flacco , flipdownr , fmeffects , formatdown , form
Linking
Heading
Linking
Links
[{"label":"https://CRAN.R-project.org/package=checkmate","section":"","type":"","url":"https://CRAN.R-project.org/package=checkmate"}]
Text
Please use the canonical form https://CRAN.R-project.org/package=checkmate to link to this page.
Materials 2
Documentation 8
Vignettes 6
Downloads 9
All page links 120

패키지 문서 원문

5 artifacts
citation
Citation
CRAN · 2.3.4 · Citation · text/html · 954 · 2026-05-07
Title
CRAN: checkmate citation info
Label
Citation
Text content
Text content
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}, }
field
NEWS
CRAN · 2.3.4 · Materials · text/html · 19,656 · 2026-05-07
Title
NEWS
Label
NEWS
Text content
Text content
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 versi
field
README
CRAN · 2.3.4 · Materials · text/html · 6,692 · 2026-05-07
Title
README
Label
README
Text content
Text content
README 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 reference
reference_manual_html
Reference manual HTML
CRAN · 2.3.4 · Documentation · text/html · 344,873 · 2026-05-07
Title
Help for package checkmate
Label
Reference manual HTML
Text content
Text content
Help 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] = N
section
checkmate.pdf
CRAN · 2.3.4 · Documentation · application/pdf · 414,675 · 2026-05-07
Title
checkmate.pdf
Label
checkmate.pdf

Reference for checkmate (2.3.4)

65개 topic
%??%
Coalesce operator
CRAN · 2.3.4 · checkmate/man/coalesce.Rd · 2026-05-07

Returns the left hand side if not missing nor NULL, and the right hand side otherwise.

Aliases
%??%
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))])
AssertCollection
Collect multiple assertions
CRAN · 2.3.4 · checkmate/man/AssertCollection.Rd · 2026-05-07

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.

Aliases
AssertCollectionmakeAssertCollectionreportAssertions
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() reportAssertions(coll)
allMissing
Check if an object contains missing values
CRAN · 2.3.4 · checkmate/man/anyMissing.Rd · 2026-05-07

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.

Aliases
allMissinganyMissing
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)
anyInfinite
Check if an object contains infinite values
CRAN · 2.3.4 · checkmate/man/anyInfinite.Rd · 2026-05-07

Supported are atomic types (see [base]is.atomic), lists and data frames.

Aliases
anyInfinite
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)
anyNaN
Check if an object contains NaN values
CRAN · 2.3.4 · checkmate/man/anyNaN.Rd · 2026-05-07

Supported are atomic types (see [base]is.atomic), lists and data frames.

Aliases
anyNaN
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] = NaN anyNaN(iris)
asInteger
Convert an argument to an integer
CRAN · 2.3.4 · checkmate/man/asInteger.Rd · 2026-05-07

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.

Aliases
asIntegerasCountasInt
Usage
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) )
Arguments
x
[any] Object to convert.
tol
[double(1)] Numerical tolerance used to check whether a double or complex can be converted. Default is sqrt(.Machine$double.eps).
lower
[numeric(1)] Lower value all elements of x must be greater than or equal to.
upper
[numeric(1)] Upper value all elements of x must be lower than or equal to.
any.missing
[logical(1)] Are vectors with missing values allowed? Default is TRUE.
all.missing
[logical(1)] Are vectors with no non-missing values allowed? Default is TRUE. Note that empty vectors do not have non-missing values.
len
[integer(1)] Exact expected length of x.
min.len
[integer(1)] Minimal length of x.
max.len
[integer(1)] Maximal length of x.
unique
[logical(1)] Must all values be unique? Default is FALSE.
sorted
[logical(1)] Elements must be sorted in ascending order. Missing values are ignored.
names
[character(1)] Check for names. See checkNamed for possible values. Default is any which performs no check at all. Note that you can use checkSubset to check for a specific set of names.
.var.name
[character(1)] Name of the checked object to print in error messages. Defaults to the heuristic implemented in vname.
na.ok
[logical(1)] Are missing values allowed? Default is FALSE.
positive
[logical(1)] Must x be positive (>= 1)? Default is FALSE.
Details
This function does not distinguish between NA, NA_integer_, NA_real_, NA_complex_ NA_character_ and NaN.
Value
Converted x.
Examples
asInteger(c(1, 2, 3)) asCount(1) asInt(1)
assert
Combine multiple checks into one assertion
CRAN · 2.3.4 · checkmate/man/assert.Rd · 2026-05-07

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.

Aliases
assert
Usage
assert(..., combine = "or", .var.name = NULL, add = NULL)
Arguments
...
[any] List of calls to check functions.
combine
[character(1)] or or and to combine the check functions with an OR or AND, respectively.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
Value
Throws an error (or pushes the error message to an AssertCollection if add is not NULL) if the checks fail and invisibly returns TRUE otherwise.
Examples
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()
checkAccess
Check file system access rights
CRAN · 2.3.4 · checkmate/man/checkAccess.Rd · 2026-05-07

Check file system access rights

Aliases
checkAccesscheck_accessassertAccessassert_accesstestAccesstest_accessexpect_access
Concepts
filesystem
Usage
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))
Arguments
x
[any] Object to check.
access
[character(1)] Single string containing possible characters r, w and x to force a check for read, write or execute access rights, respectively. Write and executable rights are not checked on Windows.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertAccess/assert_access return x invisibly, whereas checkAccess/check_access and testAccess/test_access return TRUE. If the check is not successful, assertAccess/assert_access throws an error message, testAccess/test_access returns FALSE, and checkAccess/check_access return a string with the error message. The function expect_access always returns an [testthat]expectation.
Examples
# Is R's home directory readable? testAccess(R.home(), "r") # Is R's home directory writeable? testAccess(R.home(), "w")
See also
Other filesystem: checkDirectoryExists(), checkFileExists(), checkPathForOutput()
checkArray
Check if an argument is an array
CRAN · 2.3.4 · checkmate/man/checkArray.Rd · 2026-05-07

Check if an argument is an array

Aliases
checkArraycheck_arrayassertArrayassert_arraytestArraytest_arrayexpect_array
Concepts
basetypescompound
Usage
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) )
Arguments
x
[any] Object to check.
mode
[character(1)] Storage mode of the array. Arrays can hold vectors, i.e. logical, integer, integerish, double, numeric, complex, character and list. You can also specify atomic here to explicitly prohibit lists. Default is NULL (no check). If all values of x are missing, this check is skipped.
any.missing
[logical(1)] Are missing values allowed? Default is TRUE.
d
[integer(1)] Exact number of dimensions of array x. Default is NULL (no check).
min.d
[integer(1)] Minimum number of dimensions of array x. Default is NULL (no check).
max.d
[integer(1)] Maximum number of dimensions of array x. Default is NULL (no check).
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertArray/assert_array return x invisibly, whereas checkArray/check_array and testArray/test_array return TRUE. If the check is not successful, assertArray/assert_array throws an error message, testArray/test_array returns FALSE, and checkArray/check_array return a string with the error message. The function expect_array always returns an [testthat]expectation.
Examples
checkArray(array(1:27, dim = c(3, 3, 3)), d = 3)
See also
Other basetypes: checkAtomic(), checkAtomicVector(), checkCharacter(), checkComplex(), checkDataFrame(), checkDate(), checkDouble(), checkEnvironment(), checkFactor(), checkFormula(), checkFunction(), checkInteger(), checkIntegerish(), checkList(), checkLogical(), checkMatrix(), checkNull(), checkNumeric(), checkPOSIXct(), checkRaw(), checkVector() Other compound: checkDataFrame(), checkDataTable(), checkMatrix(), checkTibble()
checkAtomic
Check that an argument is an atomic vector
CRAN · 2.3.4 · checkmate/man/checkAtomic.Rd · 2026-05-07

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.

Aliases
checkAtomiccheck_atomicassertAtomicassert_atomictestAtomictest_atomicexpect_atomic
Concepts
atomicvectorbasetypes
Usage
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) )
Arguments
x
[any] Object to check.
any.missing
[logical(1)] Are vectors with missing values allowed? Default is TRUE.
all.missing
[logical(1)] Are vectors with no non-missing values allowed? Default is TRUE. Note that empty vectors do not have non-missing values.
len
[integer(1)] Exact expected length of x.
min.len
[integer(1)] Minimal length of x.
max.len
[integer(1)] Maximal length of x.
unique
[logical(1)] Must all values be unique? Default is FALSE.
names
[character(1)] Check for names. See checkNamed for possible values. Default is any which performs no check at all. Note that you can use checkSubset to check for a specific set of names.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertAtomic/assert_atomic return x invisibly, whereas checkAtomic/check_atomic and testAtomic/test_atomic return TRUE. If the check is not successful, assertAtomic/assert_atomic throws an error message, testAtomic/test_atomic returns FALSE, and checkAtomic/check_atomic return a string with the error message. The function expect_atomic always returns an [testthat]expectation.
Examples
testAtomic(letters, min.len = 1L, any.missing = FALSE)
See also
Other basetypes: checkArray(), checkAtomicVector(), checkCharacter(), checkComplex(), checkDataFrame(), checkDate(), checkDouble(), checkEnvironment(), checkFactor(), checkFormula(), checkFunction(), checkInteger(), checkIntegerish(), checkList(), checkLogical(), checkMatrix(), checkNull(), checkNumeric(), checkPOSIXct(), checkRaw(), checkVector() Other atomicvector: checkAtomicVector(), checkVector()
checkAtomicVector
Check that an argument is an atomic vector
CRAN · 2.3.4 · checkmate/man/checkAtomicVector.Rd · 2026-05-07

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)).

Aliases
checkAtomicVectorcheck_atomic_vectorassertAtomicVectorassert_atomic_vectortestAtomicVectortest_atomic_vectorexpect_atomic_vector
Concepts
atomicvectorbasetypes
Usage
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) )
Arguments
x
[any] Object to check.
any.missing
[logical(1)] Are vectors with missing values allowed? Default is TRUE.
all.missing
[logical(1)] Are vectors with only missing values allowed? Default is TRUE.
len
[integer(1)] Exact expected length of x.
min.len
[integer(1)] Minimal length of x.
max.len
[integer(1)] Maximal length of x.
unique
[logical(1)] Must all values be unique? Default is FALSE.
names
[character(1)] Check for names. See checkNamed for possible values. Default is any which performs no check at all.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertAtomicVector/assert_atomic_vector return x invisibly, whereas checkAtomicVector/check_atomic_vector and testAtomicVector/test_atomic_vector return TRUE. If the check is not successful, assertAtomicVector/assert_atomic_vector throws an error message, testAtomicVector/test_atomic_vector returns FALSE, and checkAtomicVector/check_atomic_vector return a string with the error message. The function expect_atomic_vector always returns an [testthat]expectation.
Examples
testAtomicVector(letters, min.len = 1L, any.missing = FALSE)
See also
Other basetypes: checkArray(), checkAtomic(), checkCharacter(), checkComplex(), checkDataFrame(), checkDate(), checkDouble(), checkEnvironment(), checkFactor(), checkFormula(), checkFunction(), checkInteger(), checkIntegerish(), checkList(), checkLogical(), checkMatrix(), checkNull(), checkNumeric(), checkPOSIXct(), checkRaw(), checkVector() Other atomicvector: checkAtomic(), checkVector()
checkCharacter
Check if an argument is a vector of type character
CRAN · 2.3.4 · checkmate/man/checkCharacter.Rd · 2026-05-07

To check for scalar strings, see checkString.

Aliases
checkCharactercheck_characterassertCharacterassert_charactertestCharactertest_characterexpect_character
Concepts
basetypes
Usage
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) )
Arguments
x
[any] Object to check.
n.chars
[integer(1)] Exact number of characters for each element of x.
min.chars
[integer(1)] Minimum number of characters for each element of x.
max.chars
[integer(1)] Maximum number of characters for each element of x.
pattern
[character(1)] Regular expression as used in [base]grepl. All non-missing elements of x must comply to this pattern.
fixed
[character(1)] Substring to detect in x. Will be used as pattern in [base]grepl with option fixed set to TRUE. All non-missing elements of x must contain this substring.
ignore.case
[logical(1)] See [base]grepl. Default is FALSE.
any.missing
[logical(1)] Are vectors with missing values allowed? Default is TRUE.
all.missing
[logical(1)] Are vectors with no non-missing values allowed? Default is TRUE. Note that empty vectors do not have non-missing values.
len
[integer(1)] Exact expected length of x.
min.len
[integer(1)] Minimal length of x.
max.len
[integer(1)] Maximal length of x.
unique
[logical(1)] Must all values be unique? Default is FALSE.
sorted
[logical(1)] Elements must be sorted in ascending order. Missing values are ignored.
names
[character(1)] Check for names. See checkNamed for possible values. Default is any which performs no check at all. Note that you can use checkSubset to check for a specific set of names.
typed.missing
[logical(1)] If set to FALSE (default), all types of missing values (NA, NA_integer_, NA_real_, NA_character_ or NA_character_) as well as empty vectors are allowed while type-checking atomic input. Set to TRUE to enable strict type checking.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Details
This function does not distinguish between NA, NA_integer_, NA_real_, NA_complex_ NA_character_ and NaN.
Value
Depending on the function prefix: If the check is successful, the functions assertCharacter/assert_character return x invisibly, whereas checkCharacter/check_character and testCharacter/test_character return TRUE. If the check is not successful, assertCharacter/assert_character throws an error message, testCharacter/test_character returns FALSE, and checkCharacter/check_character return a string with the error message. The function expect_character always returns an [testthat]expectation.
Examples
testCharacter(letters, min.len = 1, any.missing = FALSE) testCharacter(letters, min.chars = 2) testCharacter("example", pattern = "xa")
See also
Other basetypes: checkArray(), checkAtomic(), checkAtomicVector(), checkComplex(), checkDataFrame(), checkDate(), checkDouble(), checkEnvironment(), checkFactor(), checkFormula(), checkFunction(), checkInteger(), checkIntegerish(), checkList(), checkLogical(), checkMatrix(), checkNull(), checkNumeric(), checkPOSIXct(), checkRaw(), checkVector()
checkChoice
Check if an object is an element of a given set
CRAN · 2.3.4 · checkmate/man/checkChoice.Rd · 2026-05-07

Check if an object is an element of a given set

Aliases
checkChoicecheck_choiceassertChoiceassert_choicetestChoicetest_choiceexpect_choice
Concepts
set
Usage
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) )
Arguments
x
[any] Object to check.
choices
[atomic] Set of possible values.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
fmatch
[logical(1)] Use the set operations implemented in [fastmatch]fmatch in package fastmatch. If fastmatch is not installed, this silently falls back to [base]match. [fastmatch]fmatch modifies y by reference: A hash table is added as attribute which is used in subsequent calls.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertChoice/assert_choice return x invisibly, whereas checkChoice/check_choice and testChoice/test_choice return TRUE. If the check is not successful, assertChoice/assert_choice throws an error message, testChoice/test_choice returns FALSE, and checkChoice/check_choice return a string with the error message. The function expect_choice always returns an [testthat]expectation.
Examples
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))
See also
Other set: checkDisjunct(), checkPermutation(), checkSetEqual(), checkSubset()
Note
The object x must be of the same type as the set w.r.t. [base]typeof. Integers and doubles are both treated as numeric.
checkClass
Check the class membership of an argument
CRAN · 2.3.4 · checkmate/man/checkClass.Rd · 2026-05-07

Check the class membership of an argument

Aliases
checkClasscheck_classassertClassassert_classtestClasstest_classexpect_class
Concepts
attributesclasses
Usage
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) )
Arguments
x
[any] Object to check.
classes
[character] Class names to check for inheritance with [base]inherits. x must inherit from all specified classes.
ordered
[logical(1)] Expect x to be specialized in provided order. Default is FALSE.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertClass/assert_class return x invisibly, whereas checkClass/check_class and testClass/test_class return TRUE. If the check is not successful, assertClass/assert_class throws an error message, testClass/test_class returns FALSE, and checkClass/check_class return a string with the error message. The function expect_class always returns an [testthat]expectation.
Examples
# 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)
See also
Other attributes: checkMultiClass(), checkNamed(), checkNames() Other classes: checkMultiClass(), checkR6()
checkComplex
Check if an argument is a vector of type complex
CRAN · 2.3.4 · checkmate/man/checkComplex.Rd · 2026-05-07

Check if an argument is a vector of type complex

Aliases
checkComplexcheck_complexassertComplexassert_complextestComplextest_complexexpect_complex
Concepts
basetypes
Usage
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) )
Arguments
x
[any] Object to check.
any.missing
[logical(1)] Are vectors with missing values allowed? Default is TRUE.
all.missing
[logical(1)] Are vectors with no non-missing values allowed? Default is TRUE. Note that empty vectors do not have non-missing values.
len
[integer(1)] Exact expected length of x.
min.len
[integer(1)] Minimal length of x.
max.len
[integer(1)] Maximal length of x.
unique
[logical(1)] Must all values be unique? Default is FALSE.
names
[character(1)] Check for names. See checkNamed for possible values. Default is any which performs no check at all. Note that you can use checkSubset to check for a specific set of names.
typed.missing
[logical(1)] If set to FALSE (default), all types of missing values (NA, NA_integer_, NA_real_, NA_character_ or NA_character_) as well as empty vectors are allowed while type-checking atomic input. Set to TRUE to enable strict type checking.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Details
This function does not distinguish between NA, NA_integer_, NA_real_, NA_complex_ NA_character_ and NaN.
Value
Depending on the function prefix: If the check is successful, the functions assertComplex/assert_complex return x invisibly, whereas checkComplex/check_complex and testComplex/test_complex return TRUE. If the check is not successful, assertComplex/assert_complex throws an error message, testComplex/test_complex returns FALSE, and checkComplex/check_complex return a string with the error message. The function expect_complex always returns an [testthat]expectation.
Examples
testComplex(1) testComplex(1+1i)
See also
Other basetypes: checkArray(), checkAtomic(), checkAtomicVector(), checkCharacter(), checkDataFrame(), checkDate(), checkDouble(), checkEnvironment(), checkFactor(), checkFormula(), checkFunction(), checkInteger(), checkIntegerish(), checkList(), checkLogical(), checkMatrix(), checkNull(), checkNumeric(), checkPOSIXct(), checkRaw(), checkVector()
checkCount
Check if an argument is a count
CRAN · 2.3.4 · checkmate/man/checkCount.Rd · 2026-05-07

A count is defined as non-negative integerish value.

Aliases
checkCountcheck_countassertCountassert_counttestCounttest_countexpect_count
Concepts
scalars
Usage
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) )
Arguments
x
[any] Object to check.
na.ok
[logical(1)] Are missing values allowed? Default is FALSE.
positive
[logical(1)] Must x be positive (>= 1)? Default is FALSE, allowing 0.
tol
[double(1)] Numerical tolerance used to check whether a double or complex can be converted. Default is sqrt(.Machine$double.eps).
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
coerce
[logical(1)] If TRUE, the input x is returned as integer after an successful assertion.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Details
This function does not distinguish between NA, NA_integer_, NA_real_, NA_complex_ NA_character_ and NaN.
Value
Depending on the function prefix: If the check is successful, the functions assertCount/assert_count return x invisibly, whereas checkCount/check_count and testCount/test_count return TRUE. If the check is not successful, assertCount/assert_count throws an error message, testCount/test_count returns FALSE, and checkCount/check_count return a string with the error message. The function expect_count always returns an [testthat]expectation.
Examples
testCount(1) testCount(-1)
See also
Other scalars: checkFlag(), checkInt(), checkNumber(), checkScalar(), checkScalarNA(), checkString()
Note
To perform an assertion and then convert to integer, use asCount. assertCount will not convert numerics to integer.
checkDataFrame
Check if an argument is a data frame
CRAN · 2.3.4 · checkmate/man/checkDataFrame.Rd · 2026-05-07

Check if an argument is a data frame

Aliases
checkDataFramecheck_data_frameassertDataFrameassert_data_frametestDataFrametest_data_frameexpect_data_frame
Concepts
basetypescompound
Usage
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) )
Arguments
x
[any] Object to check.
types
[character] Character vector of class names. Each list element must inherit from at least one of the provided types. The types logical, integer, integerish, double, numeric, complex, character, factor, atomic, vector atomicvector, array, matrix, list, function, environment and null are supported. For other types [base]inherits is used as a fallback to check x's inheritance. Defaults to character(0) (no check).
any.missing
[logical(1)] Are missing values allowed? Default is TRUE.
all.missing
[logical(1)] Are columns with only missing values allowed? Default is TRUE.
min.rows
[integer(1)] Minimum number of rows.
max.rows
[integer(1)] Maximum number of rows.
min.cols
[integer(1)] Minimum number of columns.
max.cols
[integer(1)] Maximum number of columns.
nrows
[integer(1)] Exact number of rows.
ncols
[integer(1)] Exact number of columns.
row.names
[character(1)] Check for row names. Default is NULL (no check). See checkNamed for possible values. Note that you can use checkSubset to check for a specific set of names.
col.names
[character(1)] Check for column names. Default is NULL (no check). See checkNamed for possible values. Note that you can use checkSubset to test for a specific set of names.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertDataFrame/assert_data_frame return x invisibly, whereas checkDataFrame/check_data_frame and testDataFrame/test_data_frame return TRUE. If the check is not successful, assertDataFrame/assert_data_frame throws an error message, testDataFrame/test_data_frame returns FALSE, and checkDataFrame/check_data_frame return a string with the error message. The function expect_data_frame always returns an [testthat]expectation.
Examples
testDataFrame(iris) testDataFrame(iris, types = c("numeric", "factor"), min.rows = 1, col.names = "named")
See also
Other compound: checkArray(), checkDataTable(), checkMatrix(), checkTibble() Other basetypes: checkArray(), checkAtomic(), checkAtomicVector(), checkCharacter(), checkComplex(), checkDate(), checkDouble(), checkEnvironment(), checkFactor(), checkFormula(), checkFunction(), checkInteger(), checkIntegerish(), checkList(), checkLogical(), checkMatrix(), checkNull(), checkNumeric(), checkPOSIXct(), checkRaw(), checkVector()
checkDataTable
Check if an argument is a data table
CRAN · 2.3.4 · checkmate/man/checkDataTable.Rd · 2026-05-07

Check if an argument is a data table

Aliases
checkDataTablecheck_data_tableassertDataTableassert_data_tabletestDataTabletest_data_tableexpect_data_table
Concepts
compound
Usage
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) )
Arguments
x
[any] Object to check.
key
[character] Expected primary key(s) of the data table.
index
[character] Expected secondary key(s) of the data table.
types
[character] Character vector of class names. Each list element must inherit from at least one of the provided types. The types logical, integer, integerish, double, numeric, complex, character, factor, atomic, vector atomicvector, array, matrix, list, function, environment and null are supported. For other types [base]inherits is used as a fallback to check x's inheritance. Defaults to character(0) (no check).
any.missing
[logical(1)] Are missing values allowed? Default is TRUE.
all.missing
[logical(1)] Are matrices with only missing values allowed? Default is TRUE.
min.rows
[integer(1)] Minimum number of rows.
max.rows
[integer(1)] Maximum number of rows.
min.cols
[integer(1)] Minimum number of columns.
max.cols
[integer(1)] Maximum number of columns.
nrows
[integer(1)] Exact number of rows.
ncols
[integer(1)] Exact number of columns.
row.names
[character(1)] Check for row names. Default is NULL (no check). See checkNamed for possible values. Note that you can use checkSubset to check for a specific set of names.
col.names
[character(1)] Check for column names. Default is NULL (no check). See checkNamed for possible values. Note that you can use checkSubset to test for a specific set of names.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertDataTable/assert_data_table return x invisibly, whereas checkDataTable/check_data_table and testDataTable/test_data_table return TRUE. If the check is not successful, assertDataTable/assert_data_table throws an error message, testDataTable/test_data_table returns FALSE, and checkDataTable/check_data_table return a string with the error message. The function expect_data_table always returns an [testthat]expectation.
Examples
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)
See also
Other compound: checkArray(), checkDataFrame(), checkMatrix(), checkTibble()
checkDate
Check that an argument is a Date
CRAN · 2.3.4 · checkmate/man/checkDate.Rd · 2026-05-07

Checks that an object is of class [base]Date.

Aliases
checkDatecheck_dateassertDateassert_datetestDatetest_dateexpect_date
Concepts
basetypes
Usage
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) )
Arguments
x
[any] Object to check.
lower
[[base]Date] All non-missing dates in x must be >= this date. Comparison is done via [base]Ops.Date.
upper
[[base]Date] All non-missing dates in x must be before <= this date. Comparison is done via [base]Ops.Date.
any.missing
[logical(1)] Are vectors with missing values allowed? Default is TRUE.
all.missing
[logical(1)] Are vectors with no non-missing values allowed? Default is TRUE. Note that empty vectors do not have non-missing values.
len
[integer(1)] Exact expected length of x.
min.len
[integer(1)] Minimal length of x.
max.len
[integer(1)] Maximal length of x.
unique
[logical(1)] Must all values be unique? Default is FALSE.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertAtomic/assert_atomic return x invisibly, whereas checkAtomic/check_atomic and testAtomic/test_atomic return TRUE. If the check is not successful, assertAtomic/assert_atomic throws an error message, testAtomic/test_atomic returns FALSE, and checkAtomic/check_atomic return a string with the error message. The function expect_atomic always returns an [testthat]expectation.
See also
Other basetypes: checkArray(), checkAtomic(), checkAtomicVector(), checkCharacter(), checkComplex(), checkDataFrame(), checkDouble(), checkEnvironment(), checkFactor(), checkFormula(), checkFunction(), checkInteger(), checkIntegerish(), checkList(), checkLogical(), checkMatrix(), checkNull(), checkNumeric(), checkPOSIXct(), checkRaw(), checkVector()
checkDirectoryExists
Check for existence and access rights of directories
CRAN · 2.3.4 · checkmate/man/checkDirectoryExists.Rd · 2026-05-07

Check for existence and access rights of directories

Aliases
checkDirectoryExistscheck_directory_existsassertDirectoryExistsassert_directory_existstestDirectoryExiststest_directory_existsexpect_directory_existscheckDirectoryassertDirectoryassert_directorytestDirectorytest_directoryexpect_directory
Concepts
filesystem
Usage
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))
Arguments
x
[any] Object to check.
access
[character(1)] Single string containing possible characters r, w and x to force a check for read, write or execute access rights, respectively. Write and executable rights are not checked on Windows.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertDirectoryExists/assert_directory_exists return x invisibly, whereas checkDirectoryExists/check_directory_exists and testDirectoryExists/test_directory_exists return TRUE. If the check is not successful, assertDirectoryExists/assert_directory_exists throws an error message, testDirectoryExists/test_directory_exists returns FALSE, and checkDirectoryExists/check_directory_exists return a string with the error message. The function expect_directory_exists always returns an [testthat]expectation.
Examples
# Is R's home directory readable? testDirectory(R.home(), "r") # Is R's home directory readable and writable? testDirectory(R.home(), "rw")
See also
Other filesystem: checkAccess(), checkFileExists(), checkPathForOutput()
Note
The functions without the suffix exists are deprecated and will be removed from the package in a future version due to name clashes.
checkDisjunct
Check if an argument is disjunct from a given set
CRAN · 2.3.4 · checkmate/man/checkDisjunct.Rd · 2026-05-07

Check if an argument is disjunct from a given set

Aliases
checkDisjunctcheck_disjunctassertDisjunctassert_disjuncttestDisjuncttest_disjunctexpect_disjunct
Concepts
set
Usage
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))
Arguments
x
[any] Object to check.
y
[atomic] Other Set.
fmatch
[logical(1)] Use the set operations implemented in [fastmatch]fmatch in package fastmatch. If fastmatch is not installed, this silently falls back to [base]match. [fastmatch]fmatch modifies y by reference: A hash table is added as attribute which is used in subsequent calls.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertDisjunct/assert_disjunct return x invisibly, whereas checkDisjunct/check_disjunct and testDisjunct/test_disjunct return TRUE. If the check is not successful, assertDisjunct/assert_disjunct throws an error message, testDisjunct/test_disjunct returns FALSE, and checkDisjunct/check_disjunct return a string with the error message. The function expect_disjunct always returns an [testthat]expectation.
Examples
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))
See also
Other set: checkChoice(), checkPermutation(), checkSetEqual(), checkSubset()
Note
The object x must be of the same type as the set w.r.t. [base]typeof. Integers and doubles are both treated as numeric.
checkDouble
Check that an argument is a vector of type double
CRAN · 2.3.4 · checkmate/man/checkDouble.Rd · 2026-05-07

Check that an argument is a vector of type double

Aliases
checkDoublecheck_doubleassertDoubleassert_doubletestDoubletest_doubleexpect_double
Concepts
basetypes
Usage
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) )
Arguments
x
[any] Object to check.
lower
[numeric(1)] Lower value all elements of x must be greater than or equal to.
upper
[numeric(1)] Upper value all elements of x must be lower than or equal to.
finite
[logical(1)] Check for only finite values? Default is FALSE.
any.missing
[logical(1)] Are vectors with missing values allowed? Default is TRUE.
all.missing
[logical(1)] Are vectors with no non-missing values allowed? Default is TRUE. Note that empty vectors do not have non-missing values.
len
[integer(1)] Exact expected length of x.
min.len
[integer(1)] Minimal length of x.
max.len
[integer(1)] Maximal length of x.
unique
[logical(1)] Must all values be unique? Default is FALSE.
sorted
[logical(1)] Elements must be sorted in ascending order. Missing values are ignored.
names
[character(1)] Check for names. See checkNamed for possible values. Default is any which performs no check at all. Note that you can use checkSubset to check for a specific set of names.
typed.missing
[logical(1)] If set to FALSE (default), all types of missing values (NA, NA_integer_, NA_real_, NA_character_ or NA_character_) as well as empty vectors are allowed while type-checking atomic input. Set to TRUE to enable strict type checking.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Details
This function does not distinguish between NA, NA_integer_, NA_real_, NA_complex_ NA_character_ and NaN.
Value
Depending on the function prefix: If the check is successful, the functions assertDouble/assert_double return x invisibly, whereas checkDouble/check_double and testDouble/test_double return TRUE. If the check is not successful, assertDouble/assert_double throws an error message, testDouble/test_double returns FALSE, and checkDouble/check_double return a string with the error message. The function expect_double always returns an [testthat]expectation.
Examples
testDouble(1) testDouble(1L) testDouble(1, min.len = 1, lower = 0)
See also
Other basetypes: checkArray(), checkAtomic(), checkAtomicVector(), checkCharacter(), checkComplex(), checkDataFrame(), checkDate(), checkEnvironment(), checkFactor(), checkFormula(), checkFunction(), checkInteger(), checkIntegerish(), checkList(), checkLogical(), checkMatrix(), checkNull(), checkNumeric(), checkPOSIXct(), checkRaw(), checkVector()
checkEnvironment
Check if an argument is an environment
CRAN · 2.3.4 · checkmate/man/checkEnvironment.Rd · 2026-05-07

Check if an argument is an environment

Aliases
checkEnvironmentcheck_environmentassertEnvironmentassert_environmenttestEnvironmenttest_environmentexpect_environment
Concepts
basetypes
Usage
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) )
Arguments
x
[any] Object to check.
contains
[character] Vector of object names expected in the environment. Defaults to character(0).
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertEnvironment/assert_environment return x invisibly, whereas checkEnvironment/check_environment and testEnvironment/test_environment return TRUE. If the check is not successful, assertEnvironment/assert_environment throws an error message, testEnvironment/test_environment returns FALSE, and checkEnvironment/check_environment return a string with the error message. The function expect_environment always returns an [testthat]expectation.
Examples
ee = as.environment(list(a = 1)) testEnvironment(ee) testEnvironment(ee, contains = "a")
See also
Other basetypes: checkArray(), checkAtomic(), checkAtomicVector(), checkCharacter(), checkComplex(), checkDataFrame(), checkDate(), checkDouble(), checkFactor(), checkFormula(), checkFunction(), checkInteger(), checkIntegerish(), checkList(), checkLogical(), checkMatrix(), checkNull(), checkNumeric(), checkPOSIXct(), checkRaw(), checkVector()
checkFALSE
Check if an argument is FALSE
CRAN · 2.3.4 · checkmate/man/checkFALSE.Rd · 2026-05-07

Simply checks if an argument is FALSE.

Aliases
checkFALSEcheck_falseassertFALSEassert_falsetestFALSEtest_false
Usage
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)
Arguments
x
[any] Object to check.
na.ok
[logical(1)] Are missing values allowed? Default is FALSE.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
Value
Depending on the function prefix: If the check is successful, the functions assertFALSE./assert_false. return x invisibly, whereas checkFALSE./check_false. and testFALSE./test_false. return TRUE. If the check is not successful, assertFALSE./assert_false. throws an error message, testFALSE./test_false. returns FALSE, and checkFALSE./check_false. return a string with the error message. The function expect_false. always returns an [testthat]expectation.
Examples
testFALSE(FALSE) testFALSE(TRUE)
checkFactor
Check if an argument is a factor
CRAN · 2.3.4 · checkmate/man/checkFactor.Rd · 2026-05-07

Check if an argument is a factor

Aliases
checkFactorcheck_factorassertFactorassert_factortestFactortest_factorexpect_factor
Concepts
basetypes
Usage
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) )
Arguments
x
[any] Object to check.
levels
[character] Vector of allowed factor levels.
ordered
[logical(1)] Check for an ordered factor? If FALSE or TRUE, checks explicitly for an unordered or ordered factor, respectively. Default is NA which does not perform any additional check.
empty.levels.ok
[logical(1)] Are empty levels allowed? Default is TRUE.
any.missing
[logical(1)] Are vectors with missing values allowed? Default is TRUE.
all.missing
[logical(1)] Are vectors with no non-missing values allowed? Default is TRUE. Note that empty vectors do not have non-missing values.
len
[integer(1)] Exact expected length of x.
min.len
[integer(1)] Minimal length of x.
max.len
[integer(1)] Maximal length of x.
n.levels
[integer(1)] Exact number of factor levels. Default is NULL (no check).
min.levels
[integer(1)] Minimum number of factor levels. Default is NULL (no check).
max.levels
[integer(1)] Maximum number of factor levels. Default is NULL (no check).
unique
[logical(1)] Must all values be unique? Default is FALSE.
names
[character(1)] Check for names. See checkNamed for possible values. Default is any which performs no check at all. Note that you can use checkSubset to check for a specific set of names.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertFactor/assert_factor return x invisibly, whereas checkFactor/check_factor and testFactor/test_factor return TRUE. If the check is not successful, assertFactor/assert_factor throws an error message, testFactor/test_factor returns FALSE, and checkFactor/check_factor return a string with the error message. The function expect_factor always returns an [testthat]expectation.
Examples
x = factor("a", levels = c("a", "b")) testFactor(x) testFactor(x, empty.levels.ok = FALSE)
See also
Other basetypes: checkArray(), checkAtomic(), checkAtomicVector(), checkCharacter(), checkComplex(), checkDataFrame(), checkDate(), checkDouble(), checkEnvironment(), checkFormula(), checkFunction(), checkInteger(), checkIntegerish(), checkList(), checkLogical(), checkMatrix(), checkNull(), checkNumeric(), checkPOSIXct(), checkRaw(), checkVector()
checkFileExists
Check existence and access rights of files
CRAN · 2.3.4 · checkmate/man/checkFileExists.Rd · 2026-05-07

Check existence and access rights of files

Aliases
checkFileExistscheck_file_existsassertFileExistsassert_file_existstestFileExiststest_file_existsexpect_file_existscheckFileassertFileassert_filetestFileexpect_file
Concepts
filesystem
Usage
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))
Arguments
x
[any] Object to check.
access
[character(1)] Single string containing possible characters r, w and x to force a check for read, write or execute access rights, respectively. Write and executable rights are not checked on Windows.
extension
[character] Vector of allowed file extensions, matched case insensitive.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertFileExists/assert_file_exists return x invisibly, whereas checkFileExists/check_file_exists and testFileExists/test_file_exists return TRUE. If the check is not successful, assertFileExists/assert_file_exists throws an error message, testFileExists/test_file_exists returns FALSE, and checkFileExists/check_file_exists return a string with the error message. The function expect_file_exists always returns an [testthat]expectation.
Examples
# 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")
See also
Other filesystem: checkAccess(), checkDirectoryExists(), checkPathForOutput()
Note
The functions without the suffix exists are deprecated and will be removed from the package in a future version due to name clashes. test_file has been unexported already.
checkFlag
Check if an argument is a flag
CRAN · 2.3.4 · checkmate/man/checkFlag.Rd · 2026-05-07

A flag is defined as single logical value.

Aliases
checkFlagcheck_flagassertFlagassert_flagtestFlagtest_flagexpect_flag
Concepts
scalars
Usage
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))
Arguments
x
[any] Object to check.
na.ok
[logical(1)] Are missing values allowed? Default is FALSE.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Details
This function does not distinguish between NA, NA_integer_, NA_real_, NA_complex_ NA_character_ and NaN.
Value
Depending on the function prefix: If the check is successful, the functions assertFlag/assert_flag return x invisibly, whereas checkFlag/check_flag and testFlag/test_flag return TRUE. If the check is not successful, assertFlag/assert_flag throws an error message, testFlag/test_flag returns FALSE, and checkFlag/check_flag return a string with the error message. The function expect_flag always returns an [testthat]expectation.
Examples
testFlag(TRUE) testFlag(1)
See also
Other scalars: checkCount(), checkInt(), checkNumber(), checkScalar(), checkScalarNA(), checkString()
checkFormula
Check if an argument is a formula
CRAN · 2.3.4 · checkmate/man/checkFormula.Rd · 2026-05-07

Check if an argument is a formula

Aliases
checkFormulacheck_formulaassertFormulaassert_formulatestFormulatest_formulaexpect_formula
Concepts
basetypes
Usage
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))
Arguments
x
[any] Object to check.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertFormula/assert_formula return x invisibly, whereas checkFormula/check_formula and testFormula/test_formula return TRUE. If the check is not successful, assertFormula/assert_formula throws an error message, testFormula/test_formula returns FALSE, and checkFormula/check_formula return a string with the error message. The function expect_formula always returns an [testthat]expectation.
Examples
f = Species ~ Sepal.Length + Sepal.Width checkFormula(f)
See also
Other basetypes: checkArray(), checkAtomic(), checkAtomicVector(), checkCharacter(), checkComplex(), checkDataFrame(), checkDate(), checkDouble(), checkEnvironment(), checkFactor(), checkFunction(), checkInteger(), checkIntegerish(), checkList(), checkLogical(), checkMatrix(), checkNull(), checkNumeric(), checkPOSIXct(), checkRaw(), checkVector()
checkFunction
Check if an argument is a function
CRAN · 2.3.4 · checkmate/man/checkFunction.Rd · 2026-05-07

Check if an argument is a function

Aliases
checkFunctioncheck_functionassertFunctionassert_functiontestFunctiontest_functionexpect_function
Concepts
basetypes
Usage
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) )
Arguments
x
[any] Object to check.
args
[character] Expected formal arguments. Checks that a function has no arguments if set to character(0). Default is NULL (no check).
ordered
[logical(1)] Flag whether the arguments provided in args must be the first length(args) arguments of the function in the specified order. Default is FALSE.
nargs
[integer(1)] Required number of arguments, without .... Default is NULL (no check).
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertFunction/assert_function return x invisibly, whereas checkFunction/check_function and testFunction/test_function return TRUE. If the check is not successful, assertFunction/assert_function throws an error message, testFunction/test_function returns FALSE, and checkFunction/check_function return a string with the error message. The function expect_function always returns an [testthat]expectation.
Examples
testFunction(mean) testFunction(mean, args = "x")
See also
Other basetypes: checkArray(), checkAtomic(), checkAtomicVector(), checkCharacter(), checkComplex(), checkDataFrame(), checkDate(), checkDouble(), checkEnvironment(), checkFactor(), checkFormula(), checkInteger(), checkIntegerish(), checkList(), checkLogical(), checkMatrix(), checkNull(), checkNumeric(), checkPOSIXct(), checkRaw(), checkVector()
checkInt
Check if an argument is a single integerish value
CRAN · 2.3.4 · checkmate/man/checkInt.Rd · 2026-05-07

Check if an argument is a single integerish value

Aliases
checkIntcheck_intassertIntassert_inttestInttest_intexpect_int
Concepts
scalars
Usage
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) )
Arguments
x
[any] Object to check.
na.ok
[logical(1)] Are missing values allowed? Default is FALSE.
lower
[numeric(1)] Lower value all elements of x must be greater than or equal to.
upper
[numeric(1)] Upper value all elements of x must be lower than or equal to.
tol
[double(1)] Numerical tolerance used to check whether a double or complex can be converted. Default is sqrt(.Machine$double.eps).
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
coerce
[logical(1)] If TRUE, the input x is returned as integer after an successful assertion.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Details
This function does not distinguish between NA, NA_integer_, NA_real_, NA_complex_ NA_character_ and NaN.
Value
Depending on the function prefix: If the check is successful, the functions assertInt/assert_int return x invisibly, whereas checkInt/check_int and testInt/test_int return TRUE. If the check is not successful, assertInt/assert_int throws an error message, testInt/test_int returns FALSE, and checkInt/check_int return a string with the error message. The function expect_int always returns an [testthat]expectation.
Examples
testInt(1) testInt(-1, lower = 0)
See also
Other scalars: checkCount(), checkFlag(), checkNumber(), checkScalar(), checkScalarNA(), checkString()
Note
To perform an assertion and then convert to integer, use asInt. assertInt will not convert numerics to integer.
checkInteger
Check if an argument is vector of type integer
CRAN · 2.3.4 · checkmate/man/checkInteger.Rd · 2026-05-07

Check if an argument is vector of type integer

Aliases
checkIntegercheck_integerassertIntegerassert_integertestIntegertest_integerexpect_integer
Concepts
basetypes
Usage
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) )
Arguments
x
[any] Object to check.
lower
[numeric(1)] Lower value all elements of x must be greater than or equal to.
upper
[numeric(1)] Upper value all elements of x must be lower than or equal to.
any.missing
[logical(1)] Are vectors with missing values allowed? Default is TRUE.
all.missing
[logical(1)] Are vectors with no non-missing values allowed? Default is TRUE. Note that empty vectors do not have non-missing values.
len
[integer(1)] Exact expected length of x.
min.len
[integer(1)] Minimal length of x.
max.len
[integer(1)] Maximal length of x.
unique
[logical(1)] Must all values be unique? Default is FALSE.
sorted
[logical(1)] Elements must be sorted in ascending order. Missing values are ignored.
names
[character(1)] Check for names. See checkNamed for possible values. Default is any which performs no check at all. Note that you can use checkSubset to check for a specific set of names.
typed.missing
[logical(1)] If set to FALSE (default), all types of missing values (NA, NA_integer_, NA_real_, NA_character_ or NA_character_) as well as empty vectors are allowed while type-checking atomic input. Set to TRUE to enable strict type checking.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Details
This function does not distinguish between NA, NA_integer_, NA_real_, NA_complex_ NA_character_ and NaN.
Value
Depending on the function prefix: If the check is successful, the functions assertInteger/assert_integer return x invisibly, whereas checkInteger/check_integer and testInteger/test_integer return TRUE. If the check is not successful, assertInteger/assert_integer throws an error message, testInteger/test_integer returns FALSE, and checkInteger/check_integer return a string with the error message. The function expect_integer always returns an [testthat]expectation.
Examples
testInteger(1L) testInteger(1.) testInteger(1:2, lower = 1, upper = 2, any.missing = FALSE)
See also
asInteger Other basetypes: checkArray(), checkAtomic(), checkAtomicVector(), checkCharacter(), checkComplex(), checkDataFrame(), checkDate(), checkDouble(), checkEnvironment(), checkFactor(), checkFormula(), checkFunction(), checkIntegerish(), checkList(), checkLogical(), checkMatrix(), checkNull(), checkNumeric(), checkPOSIXct(), checkRaw(), checkVector()
checkIntegerish
Check if an object is an integerish vector
CRAN · 2.3.4 · checkmate/man/checkIntegerish.Rd · 2026-05-07

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`.

Aliases
checkIntegerishcheck_integerishassertIntegerishassert_integerishtestIntegerishtest_integerishexpect_integerish
Concepts
basetypes
Usage
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) )
Arguments
x
[any] Object to check.
tol
[double(1)] Numerical tolerance used to check whether a double or complex can be converted. Default is sqrt(.Machine$double.eps).
lower
[numeric(1)] Lower value all elements of x must be greater than or equal to.
upper
[numeric(1)] Upper value all elements of x must be lower than or equal to.
any.missing
[logical(1)] Are vectors with missing values allowed? Default is TRUE.
all.missing
[logical(1)] Are vectors with no non-missing values allowed? Default is TRUE. Note that empty vectors do not have non-missing values.
len
[integer(1)] Exact expected length of x.
min.len
[integer(1)] Minimal length of x.
max.len
[integer(1)] Maximal length of x.
unique
[logical(1)] Must all values be unique? Default is FALSE.
sorted
[logical(1)] Elements must be sorted in ascending order. Missing values are ignored.
names
[character(1)] Check for names. See checkNamed for possible values. Default is any which performs no check at all. Note that you can use checkSubset to check for a specific set of names.
typed.missing
[logical(1)] If set to FALSE (default), all types of missing values (NA, NA_integer_, NA_real_, NA_character_ or NA_character_) as well as empty vectors are allowed while type-checking atomic input. Set to TRUE to enable strict type checking.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
coerce
[logical(1)] If TRUE, the input x is returned as integer after an successful assertion.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Details
This function does not distinguish between NA, NA_integer_, NA_real_, NA_complex_ NA_character_ and NaN.
Value
Depending on the function prefix: If the check is successful, the functions assertIntegerish/assert_integerish return x invisibly, whereas checkIntegerish/check_integerish and testIntegerish/test_integerish return TRUE. If the check is not successful, assertIntegerish/assert_integerish throws an error message, testIntegerish/test_integerish returns FALSE, and checkIntegerish/check_integerish return a string with the error message. The function expect_integerish always returns an [testthat]expectation.
Examples
testIntegerish(1L) testIntegerish(1.) testIntegerish(1:2, lower = 1L, upper = 2L, any.missing = FALSE)
See also
Other basetypes: checkArray(), checkAtomic(), checkAtomicVector(), checkCharacter(), checkComplex(), checkDataFrame(), checkDate(), checkDouble(), checkEnvironment(), checkFactor(), checkFormula(), checkFunction(), checkInteger(), checkList(), checkLogical(), checkMatrix(), checkNull(), checkNumeric(), checkPOSIXct(), checkRaw(), checkVector()
Note
To convert from integerish to integer, use asInteger.
checkList
Check if an argument is a list
CRAN · 2.3.4 · checkmate/man/checkList.Rd · 2026-05-07

Check if an argument is a list

Aliases
checkListcheck_listassertListassert_listtestListtest_listexpect_list
Concepts
basetypes
Usage
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) )
Arguments
x
[any] Object to check.
types
[character] Character vector of class names. Each list element must inherit from at least one of the provided types. The types logical, integer, integerish, double, numeric, complex, character, factor, atomic, vector atomicvector, array, matrix, list, function, environment and null are supported. For other types [base]inherits is used as a fallback to check x's inheritance. Defaults to character(0) (no check).
any.missing
[logical(1)] Are vectors with missing values allowed? Default is TRUE.
all.missing
[logical(1)] Are vectors with no non-missing values allowed? Default is TRUE. Note that empty vectors do not have non-missing values.
len
[integer(1)] Exact expected length of x.
min.len
[integer(1)] Minimal length of x.
max.len
[integer(1)] Maximal length of x.
unique
[logical(1)] Must all values be unique? Default is FALSE.
names
[character(1)] Check for names. See checkNamed for possible values. Default is any which performs no check at all. Note that you can use checkSubset to check for a specific set of names.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertList/assert_list return x invisibly, whereas checkList/check_list and testList/test_list return TRUE. If the check is not successful, assertList/assert_list throws an error message, testList/test_list returns FALSE, and checkList/check_list return a string with the error message. The function expect_list always returns an [testthat]expectation.
Examples
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)
See also
Other basetypes: checkArray(), checkAtomic(), checkAtomicVector(), checkCharacter(), checkComplex(), checkDataFrame(), checkDate(), checkDouble(), checkEnvironment(), checkFactor(), checkFormula(), checkFunction(), checkInteger(), checkIntegerish(), checkLogical(), checkMatrix(), checkNull(), checkNumeric(), checkPOSIXct(), checkRaw(), checkVector()
Note
Contrary to R's [base]is.list, objects of type [base]data.frame and [base]pairlist are not recognized as list. Missingness is defined here as elements of the list being NULL, analogously to anyMissing. The test for uniqueness does differentiate between the different NA types which are built-in in R. This is required to be consistent with [base]unique while checking scalar missing values. Also see the example.
checkLogical
Check if an argument is a vector of type logical
CRAN · 2.3.4 · checkmate/man/checkLogical.Rd · 2026-05-07

Check if an argument is a vector of type logical

Aliases
checkLogicalcheck_logicalassertLogicalassert_logicaltestLogicaltest_logicalexpect_logical
Concepts
basetypes
Usage
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) )
Arguments
x
[any] Object to check.
any.missing
[logical(1)] Are vectors with missing values allowed? Default is TRUE.
all.missing
[logical(1)] Are vectors with no non-missing values allowed? Default is TRUE. Note that empty vectors do not have non-missing values.
len
[integer(1)] Exact expected length of x.
min.len
[integer(1)] Minimal length of x.
max.len
[integer(1)] Maximal length of x.
unique
[logical(1)] Must all values be unique? Default is FALSE.
names
[character(1)] Check for names. See checkNamed for possible values. Default is any which performs no check at all. Note that you can use checkSubset to check for a specific set of names.
typed.missing
[logical(1)] If set to FALSE (default), all types of missing values (NA, NA_integer_, NA_real_, NA_character_ or NA_character_) as well as empty vectors are allowed while type-checking atomic input. Set to TRUE to enable strict type checking.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Details
This function does not distinguish between NA, NA_integer_, NA_real_, NA_complex_ NA_character_ and NaN.
Value
Depending on the function prefix: If the check is successful, the functions assertLogical/assert_logical return x invisibly, whereas checkLogical/check_logical and testLogical/test_logical return TRUE. If the check is not successful, assertLogical/assert_logical throws an error message, testLogical/test_logical returns FALSE, and checkLogical/check_logical return a string with the error message. The function expect_logical always returns an [testthat]expectation.
Examples
testLogical(TRUE) testLogical(TRUE, min.len = 1)
See also
Other basetypes: checkArray(), checkAtomic(), checkAtomicVector(), checkCharacter(), checkComplex(), checkDataFrame(), checkDate(), checkDouble(), checkEnvironment(), checkFactor(), checkFormula(), checkFunction(), checkInteger(), checkIntegerish(), checkList(), checkMatrix(), checkNull(), checkNumeric(), checkPOSIXct(), checkRaw(), checkVector()
checkMatrix
Check if an argument is a matrix
CRAN · 2.3.4 · checkmate/man/checkMatrix.Rd · 2026-05-07

Check if an argument is a matrix

Aliases
checkMatrixcheck_matrixassertMatrixassert_matrixtestMatrixtest_matrixexpect_matrix
Concepts
basetypescompound
Usage
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) )
Arguments
x
[any] Object to check.
mode
[character(1)] Storage mode of the array. Arrays can hold vectors, i.e. logical, integer, integerish, double, numeric, complex, character and list. You can also specify atomic here to explicitly prohibit lists. Default is NULL (no check). If all values of x are missing, this check is skipped.
any.missing
[logical(1)] Are missing values allowed? Default is TRUE.
all.missing
[logical(1)] Are matrices with only missing values allowed? Default is TRUE.
min.rows
[integer(1)] Minimum number of rows.
max.rows
[integer(1)] Maximum number of rows.
min.cols
[integer(1)] Minimum number of columns.
max.cols
[integer(1)] Maximum number of columns.
nrows
[integer(1)] Exact number of rows.
ncols
[integer(1)] Exact number of columns.
row.names
[character(1)] Check for row names. Default is NULL (no check). See checkNamed for possible values. Note that you can use checkSubset to check for a specific set of names.
col.names
[character(1)] Check for column names. Default is NULL (no check). See checkNamed for possible values. Note that you can use checkSubset to test for a specific set of names.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertMatrix/assert_matrix return x invisibly, whereas checkMatrix/check_matrix and testMatrix/test_matrix return TRUE. If the check is not successful, assertMatrix/assert_matrix throws an error message, testMatrix/test_matrix returns FALSE, and checkMatrix/check_matrix return a string with the error message. The function expect_matrix always returns an [testthat]expectation.
Examples
x = matrix(1:9, 3) colnames(x) = letters[1:3] testMatrix(x, nrows = 3, min.cols = 1, col.names = "named")
See also
Other basetypes: checkArray(), checkAtomic(), checkAtomicVector(), checkCharacter(), checkComplex(), checkDataFrame(), checkDate(), checkDouble(), checkEnvironment(), checkFactor(), checkFormula(), checkFunction(), checkInteger(), checkIntegerish(), checkList(), checkLogical(), checkNull(), checkNumeric(), checkPOSIXct(), checkRaw(), checkVector() Other compound: checkArray(), checkDataFrame(), checkDataTable(), checkTibble()
checkMultiClass
Check the class membership of an argument
CRAN · 2.3.4 · checkmate/man/checkMultiClass.Rd · 2026-05-07

Check the class membership of an argument

Aliases
checkMultiClasscheck_multi_classassertMultiClassassert_multi_classtestMultiClasstest_multi_classexpect_multi_class
Concepts
attributesclasses
Usage
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))
Arguments
x
[any] Object to check.
classes
[character] Class names to check for inheritance with [base]inherits. x must inherit from any of the specified classes.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertMultiClass/assert_multi_class return x invisibly, whereas checkMultiClass/check_multi_class and testMultiClass/test_multi_class return TRUE. If the check is not successful, assertMultiClass/assert_multi_class throws an error message, testMultiClass/test_multi_class returns FALSE, and checkMultiClass/check_multi_class return a string with the error message. The function expect_multi_class always returns an [testthat]expectation.
Examples
x = 1 class(x) = "bar" checkMultiClass(x, c("foo", "bar")) checkMultiClass(x, c("foo", "foobar"))
See also
Other attributes: checkClass(), checkNamed(), checkNames() Other classes: checkClass(), checkR6()
checkNamed
Check if an argument is named
CRAN · 2.3.4 · checkmate/man/checkNamed.Rd · 2026-05-07

Check if an argument is named

Aliases
checkNamedcheck_namedassertNamedassert_namedtestNamedtest_named
Concepts
attributes
Usage
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")
Arguments
x
[any] Object to check.
type
[character(1)] Select the check(s) to perform. unnamed checks x to be unnamed. named (default) checks x to be named which excludes names to be NA or empty (""). unique additionally tests for non-duplicated names. strict checks for unique names which comply to R's variable name restrictions. Note that for zero-length x every name check evaluates to TRUE.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
Value
Depending on the function prefix: If the check is successful, the functions assertNamed/assert_named return x invisibly, whereas checkNamed/check_named and testNamed/test_named return TRUE. If the check is not successful, assertNamed/assert_named throws an error message, testNamed/test_named returns FALSE, and checkNamed/check_named return a string with the error message. The function expect_named always returns an [testthat]expectation.
Examples
x = 1:3 testNamed(x, "unnamed") names(x) = letters[1:3] testNamed(x, "unique")
See also
Other attributes: checkClass(), checkMultiClass(), checkNames()
Note
These function are deprecated and will be removed in a future version. Please use checkNames instead.
checkNames
Check names to comply to specific rules
CRAN · 2.3.4 · checkmate/man/checkNames.Rd · 2026-05-07

Performs various checks on character vectors, usually names.

Aliases
checkNamescheck_namesassertNamesassert_namestestNamestest_namesexpect_names
Concepts
attributes
Usage
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) )
Arguments
x
[character || NULL] Names to check using rules defined via type.
type
[character(1)] Type of formal check(s) to perform on the names. unnamed:Checks x to be NULL. named:Checks x for regular names which excludes names to be NA or empty (""). unique:Performs checks like with named and additionally tests for non-duplicated names. strict:Performs checks like with unique and additionally fails for names with UTF-8 characters and names which do not comply to R's variable name restrictions. As regular expression, this is ^[.]*[a-zA-Z]+[a-zA-Z0-9._]*$. ids:Same as strict, but does not enforce uniqueness. Note that for zero-length x, all these name checks evaluate to TRUE.
subset.of
[character] Names provided in x must be subset of the set subset.of.
must.include
[character] Names provided in x must be a superset of the set must.include.
permutation.of
[character] Names provided in x must be a permutation of the set permutation.of. Duplicated names in permutation.of are stripped out and duplicated names in x thus lead to a failed check. Use this argument instead of identical.to if the order of the names is not relevant.
identical.to
[character] Names provided in x must be identical to the vector identical.to. Use this argument instead of permutation.of if the order of the names is relevant.
disjunct.from
[character] Names provided in x must may not be present in the vector disjunct.from.
what
[character(1)] Type of name vector to check, e.g. names (default), colnames or rownames.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertNames/assert_names return x invisibly, whereas checkNames/check_names and testNames/test_names return TRUE. If the check is not successful, assertNames/assert_names throws an error message, testNames/test_names returns FALSE, and checkNames/check_names return a string with the error message. The function expect_names always returns an [testthat]expectation.
Examples
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)
See also
Other attributes: checkClass(), checkMultiClass(), checkNamed()
checkNull
Check if an argument is NULL
CRAN · 2.3.4 · checkmate/man/checkNull.Rd · 2026-05-07

Check if an argument is NULL

Aliases
checkNullcheck_nullassertNullassert_nulltestNulltest_null
Concepts
basetypes
Usage
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)
Arguments
x
[any] Object to check.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
Value
Depending on the function prefix: If the check is successful, the functions assertNull/assert_null return x invisibly, whereas checkNull/check_null and testNull/test_null return TRUE. If the check is not successful, assertNull/assert_null throws an error message, testNull/test_null returns FALSE, and checkNull/check_null return a string with the error message. The function expect_null always returns an [testthat]expectation.
Examples
testNull(NULL) testNull(1)
See also
Other basetypes: checkArray(), checkAtomic(), checkAtomicVector(), checkCharacter(), checkComplex(), checkDataFrame(), checkDate(), checkDouble(), checkEnvironment(), checkFactor(), checkFormula(), checkFunction(), checkInteger(), checkIntegerish(), checkList(), checkLogical(), checkMatrix(), checkNumeric(), checkPOSIXct(), checkRaw(), checkVector()
checkNumber
Check if an argument is a single numeric value
CRAN · 2.3.4 · checkmate/man/checkNumber.Rd · 2026-05-07

Check if an argument is a single numeric value

Aliases
checkNumbercheck_numberassertNumberassert_numbertestNumbertest_numberexpect_number
Concepts
scalars
Usage
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) )
Arguments
x
[any] Object to check.
na.ok
[logical(1)] Are missing values allowed? Default is FALSE.
lower
[numeric(1)] Lower value all elements of x must be greater than or equal to.
upper
[numeric(1)] Upper value all elements of x must be lower than or equal to.
finite
[logical(1)] Check for only finite values? Default is FALSE.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Details
This function does not distinguish between NA, NA_integer_, NA_real_, NA_complex_ NA_character_ and NaN.
Value
Depending on the function prefix: If the check is successful, the functions assertNumber/assert_number return x invisibly, whereas checkNumber/check_number and testNumber/test_number return TRUE. If the check is not successful, assertNumber/assert_number throws an error message, testNumber/test_number returns FALSE, and checkNumber/check_number return a string with the error message. The function expect_number always returns an [testthat]expectation.
Examples
testNumber(1) testNumber(1:2)
See also
Other scalars: checkCount(), checkFlag(), checkInt(), checkScalar(), checkScalarNA(), checkString()
checkNumeric
Check that an argument is a vector of type numeric
CRAN · 2.3.4 · checkmate/man/checkNumeric.Rd · 2026-05-07

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.

Aliases
checkNumericcheck_numericassertNumericassert_numerictestNumerictest_numericexpect_numeric
Concepts
basetypes
Usage
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) )
Arguments
x
[any] Object to check.
lower
[numeric(1)] Lower value all elements of x must be greater than or equal to.
upper
[numeric(1)] Upper value all elements of x must be lower than or equal to.
finite
[logical(1)] Check for only finite values? Default is FALSE.
any.missing
[logical(1)] Are vectors with missing values allowed? Default is TRUE.
all.missing
[logical(1)] Are vectors with no non-missing values allowed? Default is TRUE. Note that empty vectors do not have non-missing values.
len
[integer(1)] Exact expected length of x.
min.len
[integer(1)] Minimal length of x.
max.len
[integer(1)] Maximal length of x.
unique
[logical(1)] Must all values be unique? Default is FALSE.
sorted
[logical(1)] Elements must be sorted in ascending order. Missing values are ignored.
names
[character(1)] Check for names. See checkNamed for possible values. Default is any which performs no check at all. Note that you can use checkSubset to check for a specific set of names.
typed.missing
[logical(1)] If set to FALSE (default), all types of missing values (NA, NA_integer_, NA_real_, NA_character_ or NA_character_) as well as empty vectors are allowed while type-checking atomic input. Set to TRUE to enable strict type checking.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Details
This function does not distinguish between NA, NA_integer_, NA_real_, NA_complex_ NA_character_ and NaN.
Value
Depending on the function prefix: If the check is successful, the functions assertNumeric/assert_numeric return x invisibly, whereas checkNumeric/check_numeric and testNumeric/test_numeric return TRUE. If the check is not successful, assertNumeric/assert_numeric throws an error message, testNumeric/test_numeric returns FALSE, and checkNumeric/check_numeric return a string with the error message. The function expect_numeric always returns an [testthat]expectation.
Examples
testNumeric(1) testNumeric(1, min.len = 1, lower = 0)
See also
Other basetypes: checkArray(), checkAtomic(), checkAtomicVector(), checkCharacter(), checkComplex(), checkDataFrame(), checkDate(), checkDouble(), checkEnvironment(), checkFactor(), checkFormula(), checkFunction(), checkInteger(), checkIntegerish(), checkList(), checkLogical(), checkMatrix(), checkNull(), checkPOSIXct(), checkRaw(), checkVector()
checkOS
Check the operating system
CRAN · 2.3.4 · checkmate/man/checkOS.Rd · 2026-05-07

Check the operating system

Aliases
checkOScheck_osassertOSassert_ostestOStest_osexpect_os
Usage
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)
Arguments
os
[character] Check the operating system to be in a set with possible elements windows, mac, linux and solaris.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertOS/assert_os return x invisibly, whereas checkOS/check_os and testOS/test_os return TRUE. If the check is not successful, assertOS/assert_os throws an error message, testOS/test_os returns FALSE, and checkOS/check_os return a string with the error message. The function expect_os always returns an [testthat]expectation.
Examples
testOS("linux")
checkPOSIXct
Check that an argument is a date/time object in POSIXct format
CRAN · 2.3.4 · checkmate/man/checkPOSIXct.Rd · 2026-05-07

Checks that an object is of class [base]POSIXct.

Aliases
checkPOSIXctcheck_posixctassertPOSIXctassert_posixcttestPOSIXcttest_posixctexpect_posixct
Concepts
basetypes
Usage
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) )
Arguments
x
[any] Object to check.
lower
[[base]Date] All non-missing dates in x must be >= this POSIXct time. Must be provided in the same timezone as x.
upper
[[base]Date] All non-missing dates in x must be <= this POSIXct time. Must be provided in the same timezone as x.
any.missing
[logical(1)] Are vectors with missing values allowed? Default is TRUE.
all.missing
[logical(1)] Are vectors with no non-missing values allowed? Default is TRUE. Note that empty vectors do not have non-missing values.
len
[integer(1)] Exact expected length of x.
min.len
[integer(1)] Minimal length of x.
max.len
[integer(1)] Maximal length of x.
unique
[logical(1)] Must all values be unique? Default is FALSE.
sorted
[logical(1)] Elements must be sorted in ascending order. Missing values are ignored.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertAtomic/assert_atomic return x invisibly, whereas checkAtomic/check_atomic and testAtomic/test_atomic return TRUE. If the check is not successful, assertAtomic/assert_atomic throws an error message, testAtomic/test_atomic returns FALSE, and checkAtomic/check_atomic return a string with the error message. The function expect_atomic always returns an [testthat]expectation.
See also
Other basetypes: checkArray(), checkAtomic(), checkAtomicVector(), checkCharacter(), checkComplex(), checkDataFrame(), checkDate(), checkDouble(), checkEnvironment(), checkFactor(), checkFormula(), checkFunction(), checkInteger(), checkIntegerish(), checkList(), checkLogical(), checkMatrix(), checkNull(), checkNumeric(), checkRaw(), checkVector()
checkPathForOutput
Check if a path is suited for creating an output file
CRAN · 2.3.4 · checkmate/man/checkPathForOutput.Rd · 2026-05-07

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.

Aliases
checkPathForOutputcheck_path_for_outputassertPathForOutputassert_path_for_outputtestPathForOutputtest_path_for_outputexpect_path_for_output
Concepts
filesystem
Usage
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) )
Arguments
x
[any] Object to check.
overwrite
[logical(1)] If TRUE, an existing file in place is allowed if it it is both readable and writable. Default is FALSE.
extension
[character(1)] Extension of the file, e.g. txt or tar.gz.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertPathForOutput/assert_path_for_output return x invisibly, whereas checkPathForOutput/check_path_for_output and testPathForOutput/test_path_for_output return TRUE. If the check is not successful, assertPathForOutput/assert_path_for_output throws an error message, testPathForOutput/test_path_for_output returns FALSE, and checkPathForOutput/check_path_for_output return a string with the error message. The function expect_path_for_output always returns an [testthat]expectation.
Examples
# Can we create a file in the tempdir? testPathForOutput(file.path(tempdir(), "process.log"))
See also
Other filesystem: checkAccess(), checkDirectoryExists(), checkFileExists()
checkPermutation
Check if the arguments are permutations of each other.
CRAN · 2.3.4 · checkmate/man/checkPermutation.Rd · 2026-05-07

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.

Aliases
checkPermutationcheck_permutationassertPermutationassert_permutationtestPermutationtest_permutationexpect_permutation
Concepts
set
Usage
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))
Arguments
x
[any] Object to check.
y
[atomic] Vector to compare with. Atomic vector of type other than raw.
na.ok
[logical(1)] Are missing values allowed? Default is TRUE.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertPermutation/assert_permutation return x invisibly, whereas checkPermutation/check_permutation and testPermutation/test_permutation return TRUE. If the check is not successful, assertPermutation/assert_permutation throws an error message, testPermutation/test_permutation returns FALSE, and checkPermutation/check_permutation return a string with the error message. The function expect_permutation always returns an [testthat]expectation.
Examples
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)
See also
Other set: checkChoice(), checkDisjunct(), checkSetEqual(), checkSubset()
Note
The object x must be of the same type as the set w.r.t. [base]typeof. Integers and doubles are both treated as numeric.
checkR6
Check if an argument is an R6 class
CRAN · 2.3.4 · checkmate/man/checkR6.Rd · 2026-05-07

Check if an argument is an R6 class

Aliases
checkR6check_r6assertR6assert_r6testR6test_r6expect_r6
Concepts
classes
Usage
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) )
Arguments
x
[any] Object to check.
classes
[character] Class names to check for inheritance with [base]inherits. x must inherit from all specified classes.
ordered
[logical(1)] Expect x to be specialized in provided order. Default is FALSE.
cloneable
[logical(1)] If TRUE, check that x has a clone method. If FALSE, ensure that x is not cloneable.
public
[character] Names of expected public slots. This includes active bindings.
private
[character] Names of expected private slots.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertClass/assert_class return x invisibly, whereas checkClass/check_class and testClass/test_class return TRUE. If the check is not successful, assertClass/assert_class throws an error message, testClass/test_class returns FALSE, and checkClass/check_class return a string with the error message. The function expect_class always returns an [testthat]expectation.
Examples
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")
See also
Other classes: checkClass(), checkMultiClass()
checkRaw
Check if an argument is a raw vector
CRAN · 2.3.4 · checkmate/man/checkRaw.Rd · 2026-05-07

Check if an argument is a raw vector

Aliases
checkRawcheck_rawassertRawassert_rawtestRawtest_rawexpect_raw
Concepts
basetypes
Usage
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) )
Arguments
x
[any] Object to check.
len
[integer(1)] Exact expected length of x.
min.len
[integer(1)] Minimal length of x.
max.len
[integer(1)] Maximal length of x.
names
[character(1)] Check for names. See checkNamed for possible values. Default is any which performs no check at all. Note that you can use checkSubset to check for a specific set of names.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertRaw/assert_raw return x invisibly, whereas checkRaw/check_raw and testRaw/test_raw return TRUE. If the check is not successful, assertRaw/assert_raw throws an error message, testRaw/test_raw returns FALSE, and checkRaw/check_raw return a string with the error message. The function expect_raw always returns an [testthat]expectation.
Examples
testRaw(as.raw(2), min.len = 1L)
See also
Other basetypes: checkArray(), checkAtomic(), checkAtomicVector(), checkCharacter(), checkComplex(), checkDataFrame(), checkDate(), checkDouble(), checkEnvironment(), checkFactor(), checkFormula(), checkFunction(), checkInteger(), checkIntegerish(), checkList(), checkLogical(), checkMatrix(), checkNull(), checkNumeric(), checkPOSIXct(), checkVector()
checkScalar
Check if an argument is a single atomic value
CRAN · 2.3.4 · checkmate/man/checkScalar.Rd · 2026-05-07

Check if an argument is a single atomic value

Aliases
checkScalarcheck_scalarassertScalarassert_scalartestScalartest_scalarexpect_scalar
Concepts
scalars
Usage
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))
Arguments
x
[any] Object to check.
na.ok
[logical(1)] Are missing values allowed? Default is FALSE.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Details
This function does not distinguish between NA, NA_integer_, NA_real_, NA_complex_ NA_character_ and NaN.
Value
Depending on the function prefix: If the check is successful, the functions assertScalar/assert_scalar return x invisibly, whereas checkScalar/check_scalar and testScalar/test_scalar return TRUE. If the check is not successful, assertScalar/assert_scalar throws an error message, testScalar/test_scalar returns FALSE, and checkScalar/check_scalar return a string with the error message. The function expect_scalar always returns an [testthat]expectation.
Examples
testScalar(1) testScalar(1:10)
See also
Other scalars: checkCount(), checkFlag(), checkInt(), checkNumber(), checkScalarNA(), checkString()
checkScalarNA
Check if an argument is a single missing value
CRAN · 2.3.4 · checkmate/man/checkScalarNA.Rd · 2026-05-07

Check if an argument is a single missing value

Aliases
checkScalarNAcheck_scalar_naassertScalarNAassert_scalar_natestScalarNAtest_scalar_naexpect_scalar_na
Concepts
scalars
Usage
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))
Arguments
x
[any] Object to check.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertScalarNA/assert_scalar_na return x invisibly, whereas checkScalarNA/check_scalar_na and testScalarNA/test_scalar_na return TRUE. If the check is not successful, assertScalarNA/assert_scalar_na throws an error message, testScalarNA/test_scalar_na returns FALSE, and checkScalarNA/check_scalar_na return a string with the error message. The function expect_scalar_na always returns an [testthat]expectation.
Examples
testScalarNA(1) testScalarNA(NA_real_) testScalarNA(rep(NA, 2))
See also
Other scalars: checkCount(), checkFlag(), checkInt(), checkNumber(), checkScalar(), checkString()
checkSetEqual
Check if an argument is equal to a given set
CRAN · 2.3.4 · checkmate/man/checkSetEqual.Rd · 2026-05-07

Check if an argument is equal to a given set

Aliases
checkSetEqualcheck_set_equalassertSetEqualassert_set_equaltestSetEqualtest_set_equalexpect_set_equal
Concepts
set
Usage
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) )
Arguments
x
[any] Object to check.
y
[atomic] Set to compare with.
ordered
[logical(1)] Check x to have the same length and order as y, i.e. check using == while handling NAs nicely. Default is FALSE.
fmatch
[logical(1)] Use the set operations implemented in [fastmatch]fmatch in package fastmatch. If fastmatch is not installed, this silently falls back to [base]match. [fastmatch]fmatch modifies y by reference: A hash table is added as attribute which is used in subsequent calls.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertSubset/assert_subset return x invisibly, whereas checkSubset/check_subset and testSubset/test_subset return TRUE. If the check is not successful, assertSubset/assert_subset throws an error message, testSubset/test_subset returns FALSE, and checkSubset/check_subset return a string with the error message. The function expect_subset always returns an [testthat]expectation.
Examples
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))
See also
Other set: checkChoice(), checkDisjunct(), checkPermutation(), checkSubset()
Note
The object x must be of the same type as the set w.r.t. [base]typeof. Integers and doubles are both treated as numeric.
checkString
Check if an argument is a string
CRAN · 2.3.4 · checkmate/man/checkString.Rd · 2026-05-07

A string is defined as a scalar character vector. To check for vectors of arbitrary length, see checkCharacter.

Aliases
checkStringcheck_stringassertStringassert_stringtestStringtest_stringexpect_string
Concepts
scalars
Usage
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) )
Arguments
x
[any] Object to check.
na.ok
[logical(1)] Are missing values allowed? Default is FALSE.
n.chars
[integer(1)] Exact number of characters for each element of x.
min.chars
[integer(1)] Minimum number of characters for each element of x.
max.chars
[integer(1)] Maximum number of characters for each element of x.
pattern
[character(1)] Regular expression as used in [base]grepl. All non-missing elements of x must comply to this pattern.
fixed
[character(1)] Substring to detect in x. Will be used as pattern in [base]grepl with option fixed set to TRUE. All non-missing elements of x must contain this substring.
ignore.case
[logical(1)] See [base]grepl. Default is FALSE.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Details
This function does not distinguish between NA, NA_integer_, NA_real_, NA_complex_ NA_character_ and NaN.
Value
Depending on the function prefix: If the check is successful, the functions assertString/assert_string return x invisibly, whereas checkString/check_string and testString/test_string return TRUE. If the check is not successful, assertString/assert_string throws an error message, testString/test_string returns FALSE, and checkString/check_string return a string with the error message. The function expect_string always returns an [testthat]expectation.
Examples
testString("a") testString(letters)
See also
Other scalars: checkCount(), checkFlag(), checkInt(), checkNumber(), checkScalar(), checkScalarNA()
checkSubset
Check if an argument is a subset of a given set
CRAN · 2.3.4 · checkmate/man/checkSubset.Rd · 2026-05-07

Check if an argument is a subset of a given set

Aliases
checkSubsetcheck_subsetassertSubsetassert_subsettestSubsettest_subsetexpect_subset
Concepts
set
Usage
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) )
Arguments
x
[any] Object to check.
choices
[atomic] Set of possible values. May be empty.
empty.ok
[logical(1)] Treat zero-length x as subset of any set choices (this includes NULL)? Default is TRUE.
fmatch
[logical(1)] Use the set operations implemented in [fastmatch]fmatch in package fastmatch. If fastmatch is not installed, this silently falls back to [base]match. [fastmatch]fmatch modifies y by reference: A hash table is added as attribute which is used in subsequent calls.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertSubset/assert_subset return x invisibly, whereas checkSubset/check_subset and testSubset/test_subset return TRUE. If the check is not successful, assertSubset/assert_subset throws an error message, testSubset/test_subset returns FALSE, and checkSubset/check_subset return a string with the error message. The function expect_subset always returns an [testthat]expectation.
Examples
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))
See also
Other set: checkChoice(), checkDisjunct(), checkPermutation(), checkSetEqual()
Note
The object x must be of the same type as the set w.r.t. [base]typeof. Integers and doubles are both treated as numeric.
checkTRUE
Check if an argument is TRUE
CRAN · 2.3.4 · checkmate/man/checkTRUE.Rd · 2026-05-07

Simply checks if an argument is TRUE.

Aliases
checkTRUEcheck_trueassertTRUEassert_truetestTRUEtest_true
Usage
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)
Arguments
x
[any] Object to check.
na.ok
[logical(1)] Are missing values allowed? Default is FALSE.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
Value
Depending on the function prefix: If the check is successful, the functions assertTRUE./assert_true. return x invisibly, whereas checkTRUE./check_true. and testTRUE./test_true. return TRUE. If the check is not successful, assertTRUE./assert_true. throws an error message, testTRUE./test_true. returns FALSE, and checkTRUE./check_true. return a string with the error message. The function expect_true. always returns an [testthat]expectation.
Examples
testTRUE(TRUE) testTRUE(FALSE)
checkTibble
Check if an argument is a tibble
CRAN · 2.3.4 · checkmate/man/checkTibble.Rd · 2026-05-07

Check if an argument is a tibble

Aliases
checkTibblecheck_tibbleassertTibbleassert_tibbletestTibbletest_tibbleexpect_tibble
Concepts
compound
Usage
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) )
Arguments
x
[any] Object to check.
types
[character] Character vector of class names. Each list element must inherit from at least one of the provided types. The types logical, integer, integerish, double, numeric, complex, character, factor, atomic, vector atomicvector, array, matrix, list, function, environment and null are supported. For other types [base]inherits is used as a fallback to check x's inheritance. Defaults to character(0) (no check).
any.missing
[logical(1)] Are missing values allowed? Default is TRUE.
all.missing
[logical(1)] Are matrices with only missing values allowed? Default is TRUE.
min.rows
[integer(1)] Minimum number of rows.
max.rows
[integer(1)] Maximum number of rows.
min.cols
[integer(1)] Minimum number of columns.
max.cols
[integer(1)] Maximum number of columns.
nrows
[integer(1)] Exact number of rows.
ncols
[integer(1)] Exact number of columns.
row.names
[character(1)] Check for row names. Default is NULL (no check). See checkNamed for possible values. Note that you can use checkSubset to check for a specific set of names.
col.names
[character(1)] Check for column names. Default is NULL (no check). See checkNamed for possible values. Note that you can use checkSubset to test for a specific set of names.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
Depending on the function prefix: If the check is successful, the functions assertTibble/assert_tibble return x invisibly, whereas checkTibble/check_tibble and testTibble/test_tibble return TRUE. If the check is not successful, assertTibble/assert_tibble throws an error message, testTibble/test_tibble returns FALSE, and checkTibble/check_tibble return a string with the error message. The function expect_tibble always returns an [testthat]expectation.
Examples
library(tibble) x = as_tibble(iris) testTibble(x) testTibble(x, nrow = 150, any.missing = FALSE)
See also
Other compound: checkArray(), checkDataFrame(), checkDataTable(), checkMatrix()
checkVector
Check if an argument is a vector
CRAN · 2.3.4 · checkmate/man/checkVector.Rd · 2026-05-07

Check if an argument is a vector

Aliases
checkVectorcheck_vectorassertVectorassert_vectortestVectortest_vector
Concepts
atomicvectorbasetypes
Usage
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 )
Arguments
x
[any] Object to check.
strict
[logical(1)] May the vector have additional attributes? If TRUE, mimics the behavior of [base]is.vector. Default is FALSE which allows e.g. factors or data.frames to be recognized as vectors.
any.missing
[logical(1)] Are vectors with missing values allowed? Default is TRUE.
all.missing
[logical(1)] Are vectors with no non-missing values allowed? Default is TRUE. Note that empty vectors do not have non-missing values.
len
[integer(1)] Exact expected length of x.
min.len
[integer(1)] Minimal length of x.
max.len
[integer(1)] Maximal length of x.
unique
[logical(1)] Must all values be unique? Default is FALSE.
names
[character(1)] Check for names. See checkNamed for possible values. Default is any which performs no check at all. Note that you can use checkSubset to check for a specific set of names.
null.ok
[logical(1)] If set to TRUE, x may also be NULL. In this case only a type check of x is performed, all additional checks are disabled.
.var.name
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertion messages. See AssertCollection.
Value
Depending on the function prefix: If the check is successful, the functions assertVector/assert_vector return x invisibly, whereas checkVector/check_vector and testVector/test_vector return TRUE. If the check is not successful, assertVector/assert_vector throws an error message, testVector/test_vector returns FALSE, and checkVector/check_vector return a string with the error message. The function expect_vector always returns an [testthat]expectation.
Examples
testVector(letters, min.len = 1L, any.missing = FALSE)
See also
Other basetypes: checkArray(), checkAtomic(), checkAtomicVector(), checkCharacter(), checkComplex(), checkDataFrame(), checkDate(), checkDouble(), checkEnvironment(), checkFactor(), checkFormula(), checkFunction(), checkInteger(), checkIntegerish(), checkList(), checkLogical(), checkMatrix(), checkNull(), checkNumeric(), checkPOSIXct(), checkRaw() Other atomicvector: checkAtomic(), checkAtomicVector()
checkmate-package
checkmate: Fast and Versatile Argument Checks
CRAN · 2.3.4 · package · checkmate/man/checkmate-package.Rd · 2026-05-07

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.

Aliases
checkmatecheckmate-package
See also
Useful links: https://mllg.github.io/checkmate/ https://github.com/mllg/checkmate Report bugs at https://github.com/mllg/checkmate/issues
Custom sections
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
Maintainer: Michel Lang michellang@gmail.com (https://orcid.org/0000-0001-9754-0393ORCID) Other contributors: Bernd Bischl bernd_bischl@gmx.net [contributor] Dénes Tóth toth.denes@kogentum.hu (https://orcid.org/0000-0003-4262-3217ORCID) [contributor]
makeAssertion
Turn a Check into an Assertion
CRAN · 2.3.4 · checkmate/man/makeAssertion.Rd · 2026-05-07

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).

Aliases
makeAssertionmakeAssertionFunction
Concepts
CustomConstructors
Usage
makeAssertion(x, res, var.name, collection) makeAssertionFunction( check.fun, c.fun = NULL, use.namespace = TRUE, coerce = FALSE, env = parent.frame() )
Arguments
x
[any] Object to check.
res
[TRUE | character(1)] The result of a check function: TRUE for successful checks, and an error message as string otherwise.
var.name
[character(1)] The custom name for x as passed to any assert* function. Defaults to a heuristic name lookup.
collection
[AssertCollection] If an AssertCollection is provided, the error message is stored in it. If NULL, an exception is raised if res is not TRUE.
check.fun
[function] Function which checks the input. Must return TRUE on success and a string with the error message otherwise.
c.fun
[character(1)] If not NULL, instead of calling the function check.fun, use .Call to call a C function c.fun with the identical set of parameters. The C function must be registered as a native symbol, see [base].Call. Useful if check.fun is just a simple wrapper.
use.namespace
[logical(1)] Call functions of checkmate using its namespace explicitly. Can be set to FALSE so save some microseconds, but the checkmate package needs to be imported. Default is TRUE.
coerce
[logical(1)] If TRUE, injects some lines of code to convert numeric values to integer after an successful assertion. Currently used in assertCount, assertInt and assertIntegerish.
env
[environment] The environment of the created function. Default is the [base]parent.frame.
Value
makeAssertion invisibly returns the checked object if the check was successful, and an exception is raised (or its message stored in the collection) otherwise. makeAssertionFunction returns a function.
Examples
# 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)
See also
Other CustomConstructors: makeExpectation(), makeTest()
makeExpectation
Turn a Check into an Expectation
CRAN · 2.3.4 · checkmate/man/makeExpectation.Rd · 2026-05-07

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).

Aliases
makeExpectationmakeExpectationFunction
Concepts
CustomConstructors
Usage
makeExpectation(x, res, info, label) makeExpectationFunction( check.fun, c.fun = NULL, use.namespace = FALSE, env = parent.frame() )
Arguments
x
[any] Object to check.
res
[TRUE | character(1)] The result of a check function: TRUE for successful checks, and an error message as string otherwise.
info
[character(1)] See [testthat]expect_that
label
[character(1)] See [testthat]expect_that
check.fun
[function] Function which checks the input. Must return TRUE on success and a string with the error message otherwise.
c.fun
[character(1)] If not NULL, instead of calling the function check.fun, use .Call to call a C function c.fun with the identical set of parameters. The C function must be registered as a native symbol, see [base].Call. Useful if check.fun is just a simple wrapper.
use.namespace
[logical(1)] Call functions of checkmate using its namespace explicitly. Can be set to FALSE so save some microseconds, but the checkmate package needs to be imported. Default is TRUE.
env
[environment] The environment of the created function. Default is the [base]parent.frame.
Value
makeExpectation invisibly returns the checked object. makeExpectationFunction returns a function.
Examples
# 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)
See also
Other CustomConstructors: makeAssertion(), makeTest()
makeTest
Turn a Check into a Test
CRAN · 2.3.4 · checkmate/man/makeTest.Rd · 2026-05-07

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).

Aliases
makeTestmakeTestFunction
Concepts
CustomConstructors
Usage
makeTest(res) makeTestFunction(check.fun, c.fun = NULL, env = parent.frame())
Arguments
res
[TRUE | character(1)] The result of a check function: TRUE for successful checks, and an error message as string otherwise.
check.fun
[function] Function which checks the input. Must return TRUE on success and a string with the error message otherwise.
c.fun
[character(1)] If not NULL, instead of calling the function check.fun, use .Call to call a C function c.fun with the identical set of parameters. The C function must be registered as a native symbol, see [base].Call. Useful if check.fun is just a simple wrapper.
env
[environment] The environment of the created function. Default is the [base]parent.frame.
Value
makeTest returns TRUE if the check is successful and FALSE otherwise. makeTestFunction returns a function.
Examples
# 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)
See also
Other CustomConstructors: makeAssertion(), makeExpectation()
matchArg
Partial Argument Matching
CRAN · 2.3.4 · checkmate/man/matchArg.Rd · 2026-05-07

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.

Aliases
matchArg
Usage
matchArg(x, choices, several.ok = FALSE, .var.name = vname(x), add = NULL)
Arguments
x
[character] User provided argument to match.
choices
[character] Candidates to match x with.
several.ok
[logical(1)] If TRUE, multiple matches are allowed, cf. [base]match.arg.
.var.name
[character(1)] Name of the checked object to print in error messages. Defaults to the heuristic implemented in vname.
add
[AssertCollection] Collection to store assertions. See AssertCollection.
Value
Subset of choices.
Examples
matchArg("k", choices = c("kendall", "pearson"))
qassert
Quick argument checks on (builtin) R types
CRAN · 2.3.4 · checkmate/man/qassert.Rd · 2026-05-07

The provided functions parse rules which allow to express some of the most frequent argument checks by typing just a few letters.

Aliases
qassertqtestqexpect
Usage
qassert(x, rules, .var.name = vname(x)) qtest(x, rules) qexpect(x, rules, info = NULL, label = vname(x))
Arguments
x
[any] Object the check.
rules
[character] Set of rules. See details.
.var.name
[character(1)] Name of the checked object to print in error messages. Defaults to the heuristic implemented in vname.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Details
The rule is specified in up to three parts. Class and missingness check. The first letter is an abbreviation for the class. If it is provided uppercase, missing values are prohibited. Supported abbreviations: rl [bB] Bool / logical. [iI] Integer. [xX] Integerish (numeric convertible to integer, see checkIntegerish). [rR] Real / double. [cC] Complex. [nN] Numeric (integer or double). [sS] String / character. [fF] Factor [aA] Atomic. [vV] Atomic vector (see checkAtomicVector). [lL] List. Missingness is defined as NULL element. [mM] Matrix. [dD] Data.frame. Missingness is checked recursively on columns. [pP] POSIXct date. [e] Environment. [0] NULL. [*] placeholder to allow any type. Note that the check for missingness does not distinguish between NaN and NA. Infinite values are not treated as missing, but can be caught using boundary checks (part 3). Length definition. This can be one of rl [*] any length, [?] length of zero or one, [+] length of at least one, or [0-9]+ exact length specified as integer. Preceding the exact length with one of the comparison operators =/==, <, <=, >= or > is also supported. Range check as two numbers separated by a comma, enclosed by square brackets (endpoint included) or parentheses (endpoint excluded). For example, [0, 3) results in all(x >= 0 & x < 3). The lower and upper bound may be omitted which is the equivalent of a negative or positive infinite bound, respectively. By definition [0,] contains Inf, while [0,) does not. The same holds for the left (lower) boundary and -Inf. E.g., the rule N1() checks for a single finite numeric which is not NA, while N1[) allows -Inf.
Value
qassert throws an R exception if object x does not comply to at least one of the rules and returns the tested object invisibly otherwise. qtest behaves the same way but returns FALSE if none of the rules comply. qexpect is intended to be inside the unit test framework [testthat]testthat and returns an [testthat]expectation.
Examples
# 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+")
See also
qtestr and qassertr for efficient checks of list elements and data frame columns.
Note
The functions are inspired by the blog post of Bogumił Kamiński: http://rsnippets.blogspot.de/2013/06/testing-function-agruments-in-gnu-r.html. The implementation is mostly written in C to minimize the overhead.
qassertr
Quick recursive arguments checks on lists and data frames
CRAN · 2.3.4 · checkmate/man/qassertr.Rd · 2026-05-07

These functions are the tuned counterparts of qtest, qassert and qexpect tailored for recursive checks of list elements or data frame columns.

Aliases
qassertrqtestrqexpectr
Usage
qassertr(x, rules, .var.name = vname(x)) qtestr(x, rules, depth = 1L) qexpectr(x, rules, info = NULL, label = vname(x))
Arguments
x
[list or data.frame] List or data frame to check for compliance with at least one of rules. See details of qtest for rule explanation.
rules
[character] Set of rules. See qtest
.var.name
[character(1)] Name of the checked object to print in error messages. Defaults to the heuristic implemented in vname.
depth
[integer(1)] Maximum recursion depth. Defaults to 1 to directly check list elements or data frame columns. Set to a higher value to check lists of lists of elements.
info
[character(1)] Extra information to be included in the message for the testthat reporter. See [testthat]expect_that.
label
[character(1)] Name of the checked object to print in messages. Defaults to the heuristic implemented in vname.
Value
See qassert.
Examples
# 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+"))
See also
qtest, qassert
register_test_backend
Select Backend for Unit Tests
CRAN · 2.3.4 · checkmate/man/register_test_backend.Rd · 2026-05-07

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.

Aliases
register_test_backend
Usage
register_test_backend(name)
Arguments
name
[character(1)] "testthat" or "tinytest".
Value
NULL (invisibly).
vname
Lookup a variable name
CRAN · 2.3.4 · checkmate/man/vname.Rd · 2026-05-07

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.

Aliases
vname
Usage
vname(x)
Arguments
x
[any] Object.
Value
[character(1)] Variable name.
wf
Get the index of the first/last TRUE
CRAN · 2.3.4 · checkmate/man/wf.Rd · 2026-05-07

A quick C implementation for which.first (head(which(x), 1)) and which.last (tail(which(x), 1)).

Aliases
wfwl
Usage
wf(x, use.names = TRUE) wl(x, use.names = TRUE)
Arguments
x
[logical] Logical vector.
use.names
[logical(1)] If TRUE and x is named, the result is also named.
Value
[integer(1) | integer(0)]. Returns the index of the first/last TRUE value in x or an empty integer vector if none is found. NAs are ignored.
Examples
wf(c(FALSE, TRUE)) wl(c(FALSE, FALSE)) wf(NA)

버전 이력

RepositoryVersionPublishedFirst seenLast seenDocs
CRAN2.3.32025-08-182026-05-072026-05-07
CRAN2.3.22024-07-292026-05-072026-05-07
CRAN2.3.12023-12-042026-05-072026-05-07
CRAN2.3.02023-10-252026-05-072026-05-07
CRAN2.2.02023-04-272026-05-072026-05-07
CRAN2.1.02022-04-212026-05-072026-05-07
CRAN2.0.02020-02-062026-05-072026-05-07
CRAN1.9.42019-07-042026-05-072026-05-07
CRAN1.9.32019-05-032026-05-072026-05-07
CRAN1.9.12019-01-152026-05-072026-05-07
CRAN1.9.02019-01-092026-05-072026-05-07
CRAN1.8.52017-10-242026-05-072026-05-07
CRAN1.8.42017-09-262026-05-072026-05-07
CRAN1.8.32017-07-032026-05-072026-05-07
CRAN1.8.22016-11-022026-05-072026-05-07
CRAN1.8.12016-06-282026-05-072026-05-07
CRAN1.8.02016-06-062026-05-072026-05-07
CRAN1.7.42016-04-082026-05-072026-05-07
CRAN1.7.32016-03-102026-05-072026-05-07
CRAN1.7.22016-02-252026-05-072026-05-07
CRAN1.7.12016-02-022026-05-072026-05-07
CRAN1.7.02016-01-232026-05-072026-05-07
CRAN1.6.32015-10-232026-05-072026-05-07
CRAN1.6.22015-07-262026-05-072026-05-07
CRAN1.6.12015-07-172026-05-072026-05-07
CRAN1.6.02015-06-192026-05-072026-05-07
CRAN1.5.32015-05-132026-05-072026-05-07
CRAN1.5.22015-03-202026-05-072026-05-07
CRAN1.5.12014-12-142026-05-072026-05-07
CRAN1.5.02014-10-192026-05-072026-05-07
CRAN1.42014-09-032026-05-072026-05-07
CRAN1.32014-08-152026-05-072026-05-07
CRAN1.22014-07-212026-05-072026-05-07
CRAN1.12014-06-282026-05-072026-05-07
CRAN1.02014-06-172026-05-072026-05-07
CRAN2.3.42026-05-292026-05-30

보안

표시할 OSV 데이터가 없습니다.

문헌 신호

표시할 OpenAlex 데이터가 없습니다.