Displaying 5 results from an estimated 5 matches for "smallerequ".
Did you mean:
smallerequal
2016 Apr 05
3
Problem with <= (less than or equal): not giving the expected result
Thanks Adrian and Thierry (from the previous answer).
I was aware of the all.equal function, but there is nothing similar for <= (e.g. all.smallerEqual)?
cheers, jo
On 05 Apr 2016, at 14:31, Adrian Du?a <dusa.adrian at unibuc.ro<mailto:dusa.adrian at unibuc.ro>> wrote:
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...
2016 Apr 05
0
Problem with <= (less than or equal): not giving the expected result
...n be extracted from a given body of data.
~ John Tukey
2016-04-05 14:46 GMT+02:00 Rainer Johannes <Johannes.Rainer at eurac.edu>:
> Thanks Adrian and Thierry (from the previous answer).
>
> I was aware of the all.equal function, but there is nothing similar for <=
> (e.g. all.smallerEqual)?
>
> cheers, jo
>
> On 05 Apr 2016, at 14:31, Adrian Du?a <dusa.adrian at unibuc.ro<mailto:
> dusa.adrian at unibuc.ro>> wrote:
>
> Yes, that does have to do with floating point representation.
> I use this function for these types of comparisons (works with v...
2016 Apr 05
1
Problem with <= (less than or equal): not giving the expected result
...iven body of data. ~ John Tukey
2016-04-05 14:46 GMT+02:00 Rainer Johannes <Johannes.Rainer at eurac.edu<mailto:Johannes.Rainer at eurac.edu>>:
Thanks Adrian and Thierry (from the previous answer).
I was aware of the all.equal function, but there is nothing similar for <= (e.g. all.smallerEqual)?
cheers, jo
On 05 Apr 2016, at 14:31, Adrian Du?a <dusa.adrian at unibuc.ro<mailto:dusa.adrian at unibuc.ro><mailto:dusa.adrian at unibuc.ro<mailto:dusa.adrian at unibuc.ro>>> wrote:
Yes, that does have to do with floating point representation.
I use this function for...
2016 Apr 05
0
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,
2016 Apr 05
5
Problem with <= (less than or equal): not giving the expected result
Dear All,
I have the following problem:
I have a function in which I check if the difference between values is smaller or equal to a certain threshold. I however realized that I might get there some unexpected results:
> abs(1 - 0.95) >= 0.05
[1] TRUE
## So that?s fine, but:
> abs(1 - 0.95) <= 0.05
[1] FALSE
Apparently, abs(1 - 0.95) is not equal to 0.05, which I find however quite