Another alternative is to check the fractional part:
x%%1==0
or, if you want to check within a certain tolerance:
min(abs(c(x%%1, x%%1-1))) < tol
More Related Contents:
- Formatting Decimal places in R
- Round up from .5
- Convert factor to integer [duplicate]
- How to convert integer number into binary vector?
- Why would R use the “L” suffix to denote an integer?
- Keeping trailing zeros
- How to round up to the nearest 10 (or 100 or X)?
- R round to nearest .5 or .1
- What is integer overflow in R and how can it happen?
- What’s the difference between integer class and numeric class in R
- Extreme numerical values in floating-point precision in R
- Rounding numbers in R to specified number of digits
- Clarification of L in R
- How to catch integer(0)?
- R issue with rounding milliseconds
- Round a POSIX date (POSIXct) with base R functionality
- object I am trying to take the mean of is not found
- Explicitly calling return in a function or not
- Consistent width for geom_bar in the event of missing data
- Group integer vector into consecutive runs
- ggplot2 heatmaps: using different gradients for categories
- Different legends and fill colours for facetted ggplot?
- Can dplyr join on multiple columns or composite key?
- How to make variable bar widths in ggplot2 not overlap or gap
- How to group by two columns in R
- Plot inside a plot
- Add an image to a table-like output in R
- How to use empty space produced by facet_wrap?
- Count number of non-NA values by group
- hclust() in R on large datasets