Closed ParadaCarleton closed 3 years ago
Thanks for the feedback!
In R, 30
is automatically treated as a float instead of an int. And the integer in R needs to come with the suffix "L".
This is often unnoticeable because R typically doesn't distinguish between float and int, but the difference exists:
> typeof(1)
[1] "double"
> typeof(1L)
[1] "integer"
>
So for things to work, we need to use
> julia_call("gpd.gpdfit", x, TRUE, 30L, TRUE,
+ need_return = "R")
Note the 30L
instead of 30
, because we need to set this as a "correct" R integer and JuliaCall will do the corresponding conversion.
By the way, R does many things implicitly/automatically to treat float as int. For example,
> (1:3)[1]
[1] 1
> (1:3)[1.1]
[1] 1
> (1:3)[1.6]
[1] 1
Thanks!
Code:
Returns this:
It looks like it's possible to get RCall to realize it's an integer using
Integer(30)[1]
, but this is quite ugly.