type_alike: Compare Types of Objects

Description Usage Arguments Details See Also

Description

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.

Usage

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

Arguments

target

the object to test type alikeness against

current

the object to test the type alikeness of

mode

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

fuzzy.int.max.len

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

Details

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.