Hi all,
I'm currently using the foreign block and specialized (user-defined) R
functions a bit more seriously. I'm noticing that the output from
print() calls inside the R functions does not seem to make it to the
outside. Consider the following minimal example:
<hansl>
set R_functions on
foreign language=R
Rfunc<-function(a){
print("hello from R") # doesn't get printed
out = 1000
}
end foreign
function void gretlfunc(void)
scalar z = R.Rfunc(1)
print z
end function
gretlfunc()
</hansl>
I'm seeing the result 1000 being printed from the gretl side, but not
the string "hello from R". Inside my gretl dotdir (on Windows) I have
the file Rsrc which contains the following line:
sink("C:/Users/<myuserid>/AppData/Roaming/gretl/R.out",
type="output")
but I don't have this corresponding R.out file.
My theory is that this sink() thing only works when the R source itself
also contains the function call, but not when I use the very nice
feature and call the function from the gretl side. Right?
The use case for me right now is "only" to get debugging statements
printed out, but in general I guess an R function might also contain
some more important printouts.
thanks
sven