type_alike: Compare Types of Objects

Description Usage Arguments Details See Also


By default, checks type_of objects and two objects are considered type_alike if they have the same type. There is special handling for integers, reals, and functions.


type_alike(target, current, mode = 0L, fuzzy.int.max.len = 100)



the object to test type alikeness against


the object to test the type alikeness of


integer(1L) in 0:2, see details


max length of numeric vectors to consider for integer likeness (e.g. c(1, 2) can be considered "integer", even though it is numeric); currently we limit this check to vectors shorter than 100 to avoid a potentially expensive computation on large vectors


For integers and reals, if current is integer or integer-like (e.g. 1.0) it will match real or integer target values. Closures, built-ins, and specials are all treated as type function.

Specific behavior can be tuned with the mode parameter the values of which range from 0L to 2L, with a lower value corresponding to more relaxed comparison level.

See Also

type_of, alike

brodieG/alike documentation built on May 13, 2019, 7:44 a.m.