Comments (5)
RTFM you bloody noob !!!!
Hi Dirk, more seriuosly there is this overview, that mentions scalars
https://github.com/mllg/checkmate
There is checkInt and checkCount?
from checkmate.
Take it from me, I did!
I looked at checkInt
, checkCount
and all the others that check numeric values. However, in my opinion they seem to be for real or integerish values, not for native integer values because of the tol
value. checkInt(4)
is TRUE
but not checkInteger(4)
.
Probably I interpret or use some functions in a wrong manner?
from checkmate.
So, you want to function that lets 1L pass, but not 1?
from checkmate.
What I should add here:
Nearly always I want this behavior: I have a function f(k) where k is supposed to be an int.
Now, a user should be able to say f(1L) and f(1), as
a) most users do not even really know that 1 is NOT an int. I dont want to hassle them with an error.
b) typing the L might be cumbersome
So what i do is
k = asInt(k)
- That performs a check whether k is "integerish", so allow 1 as well
- after the above line I have type-safety, so I know that k is now really of type "integer" in my code, as it is potentially converted from 1 to 1L
Does that make sense?
from checkmate.
First Comment: Yes.
Second Comment: That makes sense, I will use it this way.
Thanks!
from checkmate.
Related Issues (20)
- Check on names does not error when using R keywords [suggestion] HOT 1
- assertString(na.ok = TRUE) does not check whether NA is a character-type HOT 1
- `check_number(2, lower = Inf)` is `TRUE` HOT 2
- `reportAssertions` always reports errors from top level
- [Feature requrest] `assertBool` HOT 1
- 2 tests in test_checkIntegerish.R fail on 32-bit platforms [ FAIL 2 | WARN 0 | SKIP 1 | PASS 3004 ] HOT 3
- unwanted warning with `makeAssertCollection`
- mini issue: Possibility of testing if a number is strictly greater than another HOT 1
- testScalarNA and data.table HOT 1
- [feature request] pipe friendly assert/test statements
- checkNamed, assertNamed: unhelpful assretion error message
- How to use `checkCharacter()`, arg `names =` ? HOT 2
- Original variable name does not appear when `matchArg` doesn't find choice
- Adding Support for S7 Class Checking?
- `assert_date` NA missing behavior inconsistent with `assert_numeric` and others HOT 1
- add sorted argument to expect_date
- sorted option not enforced when sort violations bridge NA HOT 2
- possibly add sorted = FALSE to ls() calls to increase performance HOT 1
- Proposal: Add a quick summary of the prefixes to the docs
- Enabling PCRE RegEx patterns
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from checkmate.