Re: [R] long integer handling

2020-11-13 Thread Rui Barradas
Hello, I forgot to suggest package gmp. See the second example in ?gmp::bigz Hope this helps, Rui Barradas Às 05:50 de 14/11/20, Rui Barradas escreveu: Hello, You can compute the exact result with package Rmpfr. See ?mpfr and [1]. library(Rmpfr) two <- mpfr(2, precBits = 64) two^64 - 1 #

Re: [R] long integer handling

2020-11-13 Thread Rui Barradas
Hello, You can compute the exact result with package Rmpfr. See ?mpfr and [1]. library(Rmpfr) two <- mpfr(2, precBits = 64) two^64 - 1 #1 'mpfr' number of precision 64 bits #[1] 18446744073709551615 [1] https://www.mpfr.org/ Hope this helps, Rui Barradas Às 01:44 de 14/11/20, Yousri F

Re: [R] analyzing results from Tuesday's US elections

2020-11-13 Thread Jeff Newmiller
It was explained in the video... his counts were so small that they spanned the 1-9 and 10-99 ranges. On November 13, 2020 6:59:49 PM PST, Rolf Turner wrote: > >On Thu, 12 Nov 2020 01:23:06 +0100 >Martin Møller Skarbiniks Pedersen wrote: > >> Please watch this video if you wrongly believe that

Re: [R] analyzing results from Tuesday's US elections

2020-11-13 Thread Rolf Turner
On Thu, 12 Nov 2020 01:23:06 +0100 Martin Møller Skarbiniks Pedersen wrote: > Please watch this video if you wrongly believe that Benford's law > easily can be applied to elections results. > > https://youtu.be/etx0k1nLn78 Just watched this video and found it to be delightfully enlightening a

Re: [R] [External] long integer handling

2020-11-13 Thread Richard M. Heiberger
You need the Rmpfr package. Your calculation of 2^64 is an ordinary double precision number with 53 bits of precision. > library(Rmpfr) Loading required package: gmp Attaching package: ‘gmp’ The following objects are masked from ‘package:base’: %*%, apply, crossprod, matrix, tcrossprod C

Re: [R] long integer handling

2020-11-13 Thread JRG via R-help
The largest consecutive integer that can be represented in double precision is 2^53. You'll have to move past double precision. ---JRG On 2020-11-13 20:44, Yousri Fanous wrote: > I want to calculate 2^64-1 which is > 18446744073709551615 > > I set the following options to prevent scientific n

[R] long integer handling

2020-11-13 Thread Yousri Fanous
I want to calculate 2^64-1 which is 18446744073709551615 I set the following options to prevent scientific notation options("scipen"=100, "digits"=4) > x<-2^64 -1 > x [1] 18446744073709551616 This is not correct. There seem to be still some approximation happening. How can I get the correct resul

Re: [R] "NaN" answer don't understand why

2020-11-13 Thread Bill Dunlap
fit <- robustgam::robustgam(...) produces a list, with no class attached, so residuals(fit) invokes the default method for residuals(), which essentially returns the 'residuals' component of 'fit'. There is no such component so it returns NULL, an object of length zero. The mean of a length-zero

[R] "NaN" answer don't understand why

2020-11-13 Thread varin sacha via R-help
Dear R-experts, Here below my reproducible example. No error message but I can not get a result. I get "NaN" as a result. I don't understand what is going on. Many thanks for your precious help, as usual.  # # # # # # # # # # # # # # # # # # # # # # # # # x<-c(499,491,500,517,438,495,501,525,5

Re: [R] find local max in moving window

2020-11-13 Thread Rui Barradas
Hello, The best option is package zoo, function(s) rollapply. p <- zoo::rollapply(nordn, width = 15, FUN = max, fill = c(NA, 0, NA)) These are meant as checks, see the differences between the one-liner above and your result. dim(position) length(p) w <- which(position[, 1] == p) position[

[R] find local max in moving window

2020-11-13 Thread ani jaya
Dear r list, I try to locate any local max value and location of data that follow 7 moving window condition, meaning that this data is largest and centered in 7 values to the left and 7 values to the right. I can solve it by using for and if function, like below: dput(nordn) c(`1` = 36.3167318892