Skip to content
Prev 359815 / 398503 Next

Problem with <= (less than or equal): not giving the expected result

Yes, that does have to do with floating point representation.
I use this function for these types of comparisons (works with values as
well as with vectors):

check.equal <- function(x, y) {
    check.vector <- as.logical(unlist(lapply(x, all.equal, y)))
    check.vector[is.na(check.vector)] <- FALSE
    return(check.vector)
}

See:
?all.equal

Hth,
Adrian

On Tue, Apr 5, 2016 at 2:34 PM, Rainer Johannes <Johannes.Rainer at eurac.edu>
wrote: