[R] Get message "cannot do complex assignments in base namespace" error

Thon de Boer thondeboer at yahoo.com
Sun Dec 21 10:55:55 CET 2003


Thanks for the fast reply.

When I use --vanilla for Rterm.exe (Using windows
here) I do not get the problem anymore, so that solved
half my problems. Thanks (I had used --slave --no-save
--no-restore)

But I seem to have the problem of getting the error
message "cannot do complex assignments in base
namespace" when I try to run Rgui.exe.

This is what I am trying to do. I would like to run
the Rgui program that would start up and do some
graphical plots or use the fileBrowser() widget to
load some files.

I have created the following BAT file for windows:



@echo off
set R_PROFILE=%1
set %2=%3
set %4=%5
set %6=%7
set %8=%9
cat.exe > GS_R_in.txt
rw1081\bin\Rgui.exe --no-save --no-restore
cat.exe < GS_R_out.txt
del GS_R_in.txt GS_R_out.txt

that is run by my program (GeneSpring).
The first command line argument is the R script that I
want to run and the four consecutive key-value pairs
are the system environment variable that I set that
will be picked up by the R script.
GeneSpring will also pump some data into the STDOUT
that is picked up by the cat.exe program we wrote and
dumps it in a file that is picked up in return by the
R script.

so the complete command would be something like

myR.bat script.R foo bar aap noot mies zus kees bal <
INPUT.txt > OUTPUT.txt

I had to resort to setting the R script as the
R_PROFILE environment variable to force Rgui to start
the R script I give it.

In the R script there seem to be the complex
assignments like

i at expName <- "Just a character string"

where i is a defined class. This is the assignment R
complains about, but only when I run the script as the
R_PROFILE. If I run the script as source() etc. it
runs fine.

Hope this sheds some light on the problem...

Thanks,

Thon




--- Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> Could you 
> 
> 1) Try with --vanilla.
> 2) Show us a small example.
> 
> In general user code should not be assigning in base
> (are you
> using <<- by any chance?), but there is no
> difference when redirecting
> input in Rterm as to where code is run.  (Your
> command-line flags may
> well affect it, though.)
> 
> On Sat, 20 Dec 2003, Thon de Boer wrote:
> 
> > I am constantly running into the problem where I
> get
> > error messages like "cannot do complex assignments
> in
> > base namespace".
> 
> `Like' or precisely, and all the same or not?
> 
> > It might have something to do with the fact that R
> has
> > not started up completely, since I am trying to
> run
> > some R script using Rterm < Rscript.R.
> 
> That should not work: you should need to set a
> command-line flag
> to determine if you want the session saved or not.
> 
> Given that a proper version of this is used for all
> the testing we do, 
> we are pretty confident that it does work correctly
> in a factory-fresh 
> environment.
> 
> > When I perform the same script in a Interactive R
> > session, the R script has no problem with the
> > assignments that it deems complex (like assgining
> a
> > new value to a slot in a class object).
> > 
> > Also, when I encapsulate the offending scripts
> inside
> > a local({ ... }) block, I also do not get the
> error,
> > so my theory is that my script is being run in the
> > wrong namespace, or R has not completely started
> up
> > yet or something.
> > 
> > Does anyone have an idea how I can fix this,
> without
> > having to run within the local block?
> 
> Sorry, we need to know what `this' is, first.
> 
> -- 
> Brian D. Ripley,                 
> ripley at stats.ox.ac.uk
> Professor of Applied Statistics, 
> http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865
> 272861 (self)
> 1 South Parks Road,                     +44 1865
> 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865
> 272595
>




More information about the R-help mailing list