| type_of | R Documentation |
Type evaluation and comparison is carried out with special treatment for numerics, integers, and function types. Whole number NA-free numeric vectors of sufficiently short length (<100 by default) representable in the integer type are considered to be type integer. Closures, built-ins, and specials are all treated as type closure.
type_of(object)
type_alike(target, current, settings = NULL)
object |
the object to check the type of |
target |
the object to test type alikeness against |
current |
the object to test the type alikeness of |
settings |
NULL, or a list as produced by |
Specific behavior can be tuned with the type.mode parameter to the
vetr_settings() object passed as the settings parameter to this function.
For type_of character(1L) the type of the object, for type_alike
either TRUE, or a string describing why the types are not alike.
alike(), vetr_settings(), in particular the section about
the type.mode parameter which affects how this function behaves.
type_of(1.0001) # numeric
type_of(1.0) # integer (`typeof` returns numeric)
type_of(1) # integer (`typeof` returns numeric)
type_of(sum) # closure (`typeof` returns builtin)
type_of(`$`) # closure (`typeof` returns special)
type_alike(1L, 1)
type_alike(1L, 1.1)
type_alike(integer(), numeric(100))
type_alike(integer(), numeric(101)) # too long
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.