Thon de Boer
2003-Dec-21 07:45 UTC
[R] Get message "cannot do complex assignments in base namespace" error
I am constantly running into the problem where I get error messages like "cannot do complex assignments in base namespace". 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. 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? Thanks, Thon de Boer
Prof Brian Ripley
2003-Dec-21 08:18 UTC
[R] Get message "cannot do complex assignments in base namespace" error
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