type_alike: Compare Types of Objects

View source: R/type.R

type_alikeR Documentation

Compare Types of Objects


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, numerics, and functions.


type_alike(target, current, settings = NULL)



the object to test type alikeness against


the object to test the type alikeness of


NULL, or a list as produced by vetr_settings()


For integers and numerics, 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 type.mode parameter to the vetr_settings() object passed as the settings parameter to this function.

See Also

type_of, alike, vetr_settings(), in particular the section about the type.mode parameter which affects how this function behaves.

vetr documentation built on Jan. 7, 2023, 1:19 a.m.