Description Usage Arguments Details Value Examples
Utilities Useful tools for programming.
1 2 3 4 5 6 7 | now()
bquote.arg(x)
check.types(...)
quantize(x, init, step, bias = c("round", "floor", "ceiling"))
|
x |
a vector of values |
... |
named arguments, where the name of the argument is a variable class,
and the argument itself is the value to be checked for its type.
|
init |
an initial value |
step |
steps over which to be quantized |
bias |
when quantizing, should the value be rounded up or down? |
now()
returns the current numeric Linux timestamp.
bquote.arg()
is to be used inside functions.
It returns the content of the argument as a call, but evaluates parts of the argument that were wrapped inside .()
, akin to bquote()
.
check.types()
checks the class of its arguments,
and errors if an argument does not match the class that was provided
as argument name.
quantize()
quantizes a vector.
quantize()
returns a quantized numeric vector.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | now()
testfunction<-function(x){ bquote.arg(x) }
testfunction(a + b)
# a + b
testfunction(a + b + .(5+5))
# a + b + 10
check.types(numeric=3,character="a",fun=read.csv)
# TRUE
## Not run:
check.types(numeric="3")
## End(Not run)
# Error in check.types(numeric = "3") :
# Argument 1 with value 3 should be of type numeric, but is of type character
quantize(1:20,0.5,2,"ceiling")
# 2.5 2.5 4.5 4.5 6.5 6.5 8.5 8.5 10.5 10.5 12.5 12.5 14.5 14.5 16.5 16.5 18.5 18.5 20.5 20.5
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.