Closed jakob-r closed 9 years ago
Well it does what the docs say. If it has the class, it is "pumped up" to a vector. 3 is not "integer".
The real issue seems to be that you dont use checkmate. if you ensure that your 3 is actually a 3L after arg checks, this problem disappears.
so like f(x) x = asInt(x) ensureVector(x, 3, "integer")
I guess this might be the better solution than to complicate ensureVec with another special case, which is also really hard to define.
Either agree / close or tell me why i am wrong
Sound fine but then and I agree but on the other hand ensureVector
does not ensure anything.
> ensureVector("hello", n = 3, cl = "integer")
[1] "hello"
But it's documented and I am fine
it "ensures" it for a given class. or for all objects, it you leave that out.
(you often want ONLY to transform certain objects into a list and let others pass)
Please check if that is the desired outcome