search for: basenamespaceenv

Displaying 8 results from an estimated 8 matches for "basenamespaceenv".

2019 Oct 09
2
S3 lookup rules changed in R 3.6.1
...s more relevant environments when looking up class > definitions. Unfortunately it is not clear to me what exactly this means. Here?s a minimal example code that works under R 3.5.3 but breaks under R 3.6.1 (I don?t know about 3.6.0). ``` # Define ?package namespace?: ns = new.env(parent = .BaseNamespaceEnv) local(envir = ns, { test = function (x) UseMethod('test') test.default = function (x) message('test.default') test.foo = function (x) message('test.foo') .__S3MethodsTable__. = new.env(parent = .BaseNamespaceEnv) .__S3MethodsTable__.$test.default = test...
2003 Apr 06
0
namespaces and assignment: a problem/question
...e is no way to figure out which enclosing frame, and thus where to assign 'fname' to. [I recall reading somewhere about "there is no way to identify the enclosing environment of a given environment".] My current hack is to check whether the environment of 'fname' is '.BaseNamespaceEnv', and if so to use 'assign( envir=' rather than '<<-'. However, this isn't really satisfactory, as it's possible for a function to have environment '.BaseNamespaceEnv' but not to reside in 'package:base'. I also have no idea whether this sort of thi...
2019 Oct 09
0
S3 lookup rules changed in R 3.6.1
...> definitions. > > Unfortunately it is not clear to me what exactly this means. > > Here?s a minimal example code that works under R 3.5.3 but breaks under > R 3.6.1 > (I don?t know about 3.6.0). > > ``` > # Define ?package namespace?: > ns = new.env(parent = .BaseNamespaceEnv) > local(envir = ns, { > test = function (x) UseMethod('test') > test.default = function (x) message('test.default') > test.foo = function (x) message('test.foo') > > .__S3MethodsTable__. = new.env(parent = .BaseNamespaceEnv) >...
2014 Nov 24
0
Error "promise already under evaluation ..."
...hot on the original problem would now be to either use: > > dim2 <- function(x) dim(x) > foo <- function(x, dim=dim2(x)) { dim } > > or simply avoid the name clash via: > > foo <- function(x, dimx=dim(x)) { dimx } I think you'll find that baseenv()$dim(x) and .BaseNamespaceEnv$dim(x) are about 25 times faster than base::dim(x). This doesn't seem like it should be necessary... Radford
2007 May 15
1
getNamespaceExports("base") error
Hi! >getNamespaceExports("base") Error in ls(NULL, all = TRUE) : using 'as.environment(NULL)' is defunct getNamespaceExports function (ns) { ns <- asNamespace(ns) if (isBaseNamespace(ns)) ls(NULL, all = TRUE) else ls(getNamespaceInfo(ns, "exports"), all = TRUE) } <environment: namespace:base> One possible way to fix this could be
2015 Jan 22
5
:: and ::: as .Primitives?
On Thu, Jan 22, 2015 at 11:44 AM, <luke-tierney at uiowa.edu> wrote: > > For default methods there ought to be a way to create those so the > default method is computed at creation or load time and stored in an > environment. We had considered that, but we thought the definition of the function would be easier to interpret if it explicitly specified the namespace, instead of
2002 Mar 22
1
name spaces?
I'm revisiting the R/S DBI package and was wondering if there is any plan to implement package name spaces in R/S. I've taken to the habit of prepending a few characters to function names in packages to avoid collisions, e.g., dbConnect(). An alternative would be DBI::connect() (s/::/preferred/) which in some ways I find more pleasing. Not having thought about it in detail, it seems pretty
2015 Nov 06
4
Puzzled by eval
I am currently puzzled by a seach path behavior. I have a library of a dozen routines getlabs(), getssn(), getecg(), ... that interface to local repositories and pull back patient information. All have a the first 6 arguments in common, and immediately call a second routine to do initial processing of these 6. The functions "joe" and "fred" below capture the relevant