On Thu, 3 Jun 2021, Berend Hasselman wrote:
> On 2 Jun 2021, at 22:27, Allin Cottrell <cottrell(a)wfu.edu>
wrote:
>
> On Wed, 2 Jun 2021, JOSE FRANCISCO PERLES RIBES wrote:
>
>> Dear team:
>>
>> I'm loading some data to R-Studio from Gretl using the Gretl-GUI through
>> the Tools==>Start GNU R==>as multiple time series,....
>>
>> Using R 4.0.X there were no problems and the gretldata was appearing on my
>> R sesion. However, in my first attempt after the upgrade to R.4.1.0 I get
>> the following error:
>>
>> R version 4.1.0 (2021-05-18) -- "Camp Pontanezen"
> [...]
>>
>> *Error: cannot add binding of 'vnum' to the base environment*
>>
>> Somebody has a clue on what is happening?
>
> In the NEWS for the R 4.1.0 release, we have: "The base
> environment and its namespace are now locked (so one can no
> longer add bindings to these or remove from these)." This seems
> to mean that we can't define any constants ("bind" any
> identifiers) in gretl.Rprofile, which is a little utility script
> that we source from within R to set things up for gretl/R
> interaction.
>
> We'll have to try to find a workaround for this new limitation.
> It's not obvious to me how to proceed -- any R experts have
> suggestions?
I am not an accomplished Rexpert.
You are using the environment variable R_PROFILE to source
.../gretl.Rprofile. This is done in the base environment of R.
The only workaround I can think of is to use R's source function
to source gretl.Rprofile in the script Rsrc.
Thanks, Berend. Here's what I've come up with: our gretl.Rprofile is
now a thin wrapper which defines no variables but just uses source()
to execute (a) our boilerplate setup code then (b) the code the user
specified, if any.
Using the Rprofile mechanism is the only way I've found to get
interactive use of R-via-gretl right: that is, have R execute a
script and then pass control to stdin. And "quarantining" our setup
code within source() seems to work fine.
Allin