to_integer

Convert to Integer

Coerces a value to an integer robustly. Handles strings with spaces, percentages, commas, and recognizes ‘TRUE’/‘FALSE’.

Parameters

Returns

NA The converted integer.

Examples

to_integer("12 300")
to_integer("TRUE")
to_integer(3.14)