search for: get0

Displaying 20 results from an estimated 23 matches for "get0".

Did you mean: get
2015 Jan 09
2
RFC: getifexists() {was [Bug 16065] "exists" ...}
...t; On Thu, 8 Jan 2015, Michael Lawrence wrote: >>> >>> If we do add an argument to get(), then it should be named consistently >>>> with the ifnotfound argument of mget(). You are right... I forgot to say so earlier in the thread. The definition now is get0 <- function (x, envir = pos.to.env(-1L), mode = "any", inherits = TRUE, ifnotfound = NULL) .Internal(get0(x, envir, mode, inherits, ifnotfound)) >>>> As mentioned, the possibility of a >>>> NULL value is problematic. One solution...
2020 Nov 13
3
exists, get and get0 accept silently inputs of length > 1
Dear R-devel, The doc of exists, get and get0 is unambiguous, x should be an object given as a character string. However these accept longer inputs. It can lead an uncareful user to think these functions are vectorized when they're not, and generally lets through bugs that one might have preferred to trigger earlier failure. ``` r exists(...
2020 Nov 13
0
[External] exists, get and get0 accept silently inputs of length > 1
...ld be worth allowing name objects (type "symbol") so thee don't have to be converted to character for the call and then back to names internally for the environment lookup. Best, luke On Fri, 13 Nov 2020, Antoine Fabri wrote: > Dear R-devel, > > The doc of exists, get and get0 is unambiguous, x should be an object given > as a character string. However these accept longer inputs. It can lead an > uncareful user to think these functions are vectorized when they're not, > and generally lets through bugs that one might have preferred to trigger > earlier fai...
2020 Nov 17
0
[External] exists, get and get0 accept silently inputs of length > 1
...acter for the call and then > > back to names internally for the environment lookup. > > > > Best, > > > > luke > > > > On Fri, 13 Nov 2020, Antoine Fabri wrote: > > > > > Dear R-devel, > > > > > > The doc of exists, get and get0 is unambiguous, x should be an object > given > > > as a character string. However these accept longer inputs. It can lead > an > > > uncareful user to think these functions are vectorized when they're > not, > > > and generally lets through bugs that one mig...
2020 Nov 17
2
[External] exists, get and get0 accept silently inputs of length > 1
...t;) so > thee don't have to be converted to character for the call and then > back to names internally for the environment lookup. > > Best, > > luke > > On Fri, 13 Nov 2020, Antoine Fabri wrote: > > > Dear R-devel, > > > > The doc of exists, get and get0 is unambiguous, x should be an object given > > as a character string. However these accept longer inputs. It can lead an > > uncareful user to think these functions are vectorized when they're not, > > and generally lets through bugs that one might have preferred to trigger &...
2020 Jun 23
1
mget(missingArgument)?
...t; a <- (function(x) { y <- "y from function's environment"; mget(c("x","y","z"), envir=environment(), ifnotfound=666)})() > str(a) List of 3 $ x: symbol $ y: chr "y from function's environment" $ z: num 666 The similar function get0() gives an error in that case. > b <- (function(x) get0("x", envir=environment(), ifnotfound=666))() Error in get0("x", envir = environment(), ifnotfound = 666) : argument "x" is missing, with no default Bill Dunlap TIBCO Software wdunlap tibco.com [[alterna...
2020 Nov 17
1
[External] exists, get and get0 accept silently inputs of length > 1
...ly for the environment lookup. > > > > Best, > > > > luke > > > > On Fri, 13 Nov 2020, Antoine Fabri wrote: > > > > > Dear R-devel, > > > > > > The doc of exists, get and get0 is unambiguous, x should be > an object given > > > as a character string. However these accept longer inputs. > It can lead an > > > uncareful user to think these functions are vectorized when > they're not, > > > and gene...
2015 Jan 08
2
RFC: getifexists() {was [Bug 16065] "exists" ...}
...could implement the behavior using SYMSXP, or not. Nor would the binding need to be mutable. The binding would be considered independent of the environment from which it was retrieved. As Pete has mentioned, it could be a useful abstraction to have in general. > Adding getIfExists, or .get, or get0, or whatever seems fine. Adding > an argument to get() with missing giving current behavior may be OK > too. Rewriting exists and get as .Primitives may be sufficient though. > > Best, > > luke > > > Michael >> >> >> >> >> On Thu, Jan 8, 201...
2015 Jan 09
0
RFC: getifexists() {was [Bug 16065] "exists" ...}
...at this is a much larger step than solving the "getIfExists()" problem. In the R development cycle I'd think that it should go to the next (2015-2016) "3.3" cycle, rather than the current "3.2" one with goal in April. >> Adding getIfExists, or .get, or get0, or whatever seems fine. Adding >> an argument to get() with missing giving current behavior may be OK >> too. Rewriting exists and get as .Primitives may be sufficient though. Thank you, Luke. Given that, Duncan's and the other inputs, I think we should go for a new funct...
2017 Dec 15
1
something weird has happened....!!!!!!!!!!
You could try this and see what you get: unique( yguii(ZEEL.NS, "o") - yguii(ZEEL.NS, "o") ) or maybe table( yguii(ZEEL.NS, "o") - yguii(ZEEL.NS, "o") ) You showed two sets of output from the expression yguii(ZEEL.NS, "o") Were they done one right after the other? Or could ZEEL.NS have changed in between? The function could be
2019 Jul 13
2
Mitigating Stalls Caused by Call Deparse on Error
...base/R/traceback.R?? ?(revision 76827) +++ src/library/base/R/traceback.R?? ?(working copy) @@ -16,9 +16,19 @@ ?#? A copy of the GNU General Public License is available at ?#? https://www.R-project.org/Licenses/ ? -.traceback <- function(x = NULL) { -??? if(is.null(x) && !is.null(x <- get0(".Traceback", envir = baseenv()))) -?? ?{} +.traceback <- function(x = NULL, max.lines=getOption("deparse.max.lines")) { +??? if(!(is.numeric(max.lines) && !is.na(max.lines) && +???????? as.integer(max.lines) > 0L) +??? ) { +??????? max.lines <- -1L +???...
2019 Jul 14
2
[External] Mitigating Stalls Caused by Call Deparse on Error
...27) > +++ src/library/base/R/traceback.R?? ?(working copy) > @@ -16,9 +16,19 @@ > ?#? A copy of the GNU General Public License is available at > ?#? https://www.R-project.org/Licenses/ > ? > -.traceback <- function(x = NULL) { > -??? if(is.null(x) && !is.null(x <- get0(".Traceback", envir = baseenv()))) > -?? ?{} > +.traceback <- function(x = NULL, max.lines=getOption("deparse.max.lines")) { > +??? if(!(is.numeric(max.lines) && !is.na(max.lines) && > +???????? as.integer(max.lines) > 0L) > +??? ) { > +??...
2019 Jul 16
1
[External] Mitigating Stalls Caused by Call Deparse on Error
...working copy) >>> @@ -16,9 +16,19 @@ >>> # A copy of the GNU General Public License is available at >>> # https://www.R-project.org/Licenses/ >>> >>> -.traceback <- function(x = NULL) { >>> - if(is.null(x) && !is.null(x <- get0(".Traceback", envir = baseenv()))) >>> - {} >>> +.traceback <- function(x = NULL, max.lines=getOption("deparse.max.lines")) { >>> + if(!(is.numeric(max.lines) && !is.na(max.lines) && >>> + as.integer(max.lines)...
2019 Jul 14
0
[External] Mitigating Stalls Caused by Call Deparse on Error
...27) > +++ src/library/base/R/traceback.R?? ?(working copy) > @@ -16,9 +16,19 @@ > ?#? A copy of the GNU General Public License is available at > ?#? https://www.R-project.org/Licenses/ > ? > -.traceback <- function(x = NULL) { > -??? if(is.null(x) && !is.null(x <- get0(".Traceback", envir = baseenv()))) > -?? ?{} > +.traceback <- function(x = NULL, max.lines=getOption("deparse.max.lines")) { > +??? if(!(is.numeric(max.lines) && !is.na(max.lines) && > +???????? as.integer(max.lines) > 0L) > +??? ) { > +??...
2019 Jul 15
0
[External] Mitigating Stalls Caused by Call Deparse on Error
.../base/R/traceback.R?? ?(working copy) >> @@ -16,9 +16,19 @@ >> ?#? A copy of the GNU General Public License is available at >> ?#? https://www.R-project.org/Licenses/ >> ? >> -.traceback <- function(x = NULL) { >> -??? if(is.null(x) && !is.null(x <- get0(".Traceback", envir = baseenv()))) >> -?? ?{} >> +.traceback <- function(x = NULL, max.lines=getOption("deparse.max.lines")) { >> +??? if(!(is.numeric(max.lines) && !is.na(max.lines) && >> +???????? as.integer(max.lines) > 0L) >&g...
2016 Jun 25
2
strange behavior in 'inherits' check for loaded S4 object
Hi, (sorry for the wall of text; the issue here appears to be rather complicated) I'm seeing a somewhat strange case where checking whether an S4 object inherits from a parent class defined from another package with 'inherits' fails if that object is materialized through a call to 'load'. That's a mouthful, so I've put together a relatively small reproducible example
2016 Jul 29
2
strange behavior in 'inherits' check for loaded S4 object
...is code returns NULL: > > https://github.com/wch/r-source/blob/trunk/src/library/methods/R/SClasses.R#L238-L240 > > So, the class hierarchy is looked up using this code: > > if(isTRUE(nzchar(package))) { > whereP <- .requirePackage(package) > value <- get0(cname, whereP, inherits = inherits) > } > > However, because the '.__C__SubMatrix' object is only made available > in the package's namespace, not within the package environment, it is > not resolved, and so lookup fails. (Presumedly, that lookup is done > when ini...
2016 Jul 29
0
strange behavior in 'inherits' check for loaded S4 object
...he has not been populated yet; ie, this code returns NULL: https://github.com/wch/r-source/blob/trunk/src/library/methods/R/SClasses.R#L238-L240 So, the class hierarchy is looked up using this code: if(isTRUE(nzchar(package))) { whereP <- .requirePackage(package) value <- get0(cname, whereP, inherits = inherits) } However, because the '.__C__SubMatrix' object is only made available in the package's namespace, not within the package environment, it is not resolved, and so lookup fails. (Presumedly, that lookup is done when initially building a cache for S...
2016 Jul 31
2
strange behavior in 'inherits' check for loaded S4 object
...>>> https://github.com/wch/r-source/blob/trunk/src/library/methods/R/SClasses.R#L238-L240 >>> >>> So, the class hierarchy is looked up using this code: >>> >>> if(isTRUE(nzchar(package))) { whereP <- >>> .requirePackage(package) value <- get0(cname, whereP, >>> inherits = inherits) } >>> >>> However, because the '.__C__SubMatrix' object is only >>> made available in the package's namespace, not within the >>> package environment, it is not resolved, and so lookup >>> fai...
2016 Jul 30
0
strange behavior in 'inherits' check for loaded S4 object
...>> https://github.com/wch/r-source/blob/trunk/src/library/methods/R/SClasses.R#L238-L240 >> >> So, the class hierarchy is looked up using this code: >> >> if(isTRUE(nzchar(package))) { whereP <- >> .requirePackage(package) value <- get0(cname, whereP, >> inherits = inherits) } >> >> However, because the '.__C__SubMatrix' object is only >> made available in the package's namespace, not within the >> package environment, it is not resolved, and so lookup >> fai...