Footnote on Rlib use from gretl. How do you call an R function from
within
gretl if that function requires a library that's not loaded by default?
... version with R wrapper function
<hansl>
foreign language=R --quiet
skewness_R <- function(x) {
library(moments)
skewness(x)
}
end foreign
scalar s = R.skewness_R(x)
</hansl>
However, there's an alternative, illustrated below:
<hansl>
foreign language=R --quiet
library(moments)
end foreign
scalar s = R.skewness(x)
</hansl>
Neither of these works for me on Windows 7. The following fails with "The symbol
'R.skewness' is undefined"
<hansl>
nulldata 100
set verbose off
set R_functions on
x = normal()
foreign language=R --quiet
library(moments)
end foreign
scalar s = R.skewness(x)
</hansl>
Peter