is_whole: Check if a vector might be coercible to integer

View source: R/codebook.R

is_wholeR Documentation

Check if a vector might be coercible to integer

Description

Check if a vector might be coercible to integer

Usage

is_whole(x)

maybe_int(x)

Arguments

x

A numeric vector.

Details

Take the results from these function with caution, as floating point precision can affect rounding. They are intended to be used for deciding what col_type to choose for a column in a delimited file when processing it with readr functions. If the original data is not an integer, readr will issue parsing errors.

Value

A single logical.

Functions

  • is_whole(): Check if vector only has whole values. Return TRUE for whole values larger than the largest integer which can be represented.

  • maybe_int(): Check if a vector can be coerced to integer.


svraka/asmisc documentation built on June 12, 2025, 12:04 p.m.