That was very helpful, Helio. Thank you.I don't use Debian based. These days I use Fedora-26 and CentOS 7 (the following was done on this one).
At first try it did not work, but after doing the following changes, your example run OK.
At Preferences>General>Programs>R library location changed to:
/usr/lib64/R/lib/libR.so
Then closed and restarted gretl:
How I started gretl:
R_HOME=/usr/lib64/R gretl &