[ESS] cannot add bindings to a locked environment

Vitalie Spinu @p|nuv|t @end|ng |rom gm@||@com
Sat Jul 23 23:20:13 CEST 2016



>> On Sat, Jul 23 2016 05:09, Boylan, Ross wrote:

> The reason I was trying to set the environment was to get around the following problem.  I was going to  post this to the R list, but after debugging it I suspect it may be ess-related, and so I'm posting it here.

> Sequence
> 1. start R 3.1 via ESS 16.04 in Emacs 24.4
> 2.in R, do library(LazarSim)

Is this package public somewhere? I would like to try to reproduce if possible.

> Debugging that error showed the env in the error message was <environment: namespace:LazarSim>

> I expected that the file contents of step 3 would end up in the global
> namespace, 

No. The code by default ends in the package namespace. You don't need to set
anything. You should be able to deactivate the namespaced evaluation with C-c
C-t C-s. This is primary use of this command right now. There is no C-c C-t C-a
anymore.

> Here's the file for step 3, minus comments
> setClass("AbstractTest", representation=representation(alpha="numeric"))

> setGeneric("test", function(self, r, ...) standardGeneric("test"))

> setGeneric("shortName", function(self) standardGeneric("shortName"))
> setMethod("shortName", c("AbstractTest"),
>           function(self) c(class(self)))

> StandBonf <- setClass("StandBonf", contains="AbstractTest")
> setMethod("test", c("StandBonf"),
>           function(self, r, ...) covariates(bonf(r$all, alpha=self using alpha)))


Works just as expected for me. Would it be possible for you to install the
development version of ESS?

  Vitalie




More information about the ESS-help mailing list