similar to: Rf_defineVar(symbol, R_UnboundValue, environment) questions

Displaying 20 results from an estimated 6000 matches similar to: "Rf_defineVar(symbol, R_UnboundValue, environment) questions"

2013 Aug 18
1
How does R_UnboundValue and removing variables work?
Reading "R Internals" made me believe that R_UnboundValue was a placeholder that would be skipped over in variable lookup. viz. the section of R Internals "Hash tables" says "items are not actually deleted but have their value set to R_UnboundValue.", which seems to align with what I read in envir.c. So, I reasoned, if I have a function that returns R_UnboundValue,
2008 May 24
1
value returned by findFun when the name cannot be found.
Dear list, I have been using "findVar" (defined in src/main/envir.c) happily and would like to use "findFun". However I have trouble when the name searched cannot be found: while "findVar" returns R_UnboundValue, "findFun" does not (the 4 last lines of "findFun" are copied below). error(_("could not find function
2014 Dec 03
2
we need an exists/get hybrid
Hi All, I've been looking into speeding up the loading of packages that use a lot of S4. After profiling I noticed the "exists" function accounts for a surprising fraction of the time. I have some thoughts about speeding up exists (below). More to the point of this post, Martin M?chler noted that 'exists' and 'get' are often used in conjunction. Both functions are
2014 Dec 03
2
we need an exists/get hybrid
Thanks Winston! I'm amazed that "[[" beats calling the .Internal directly. I guess the difference between .Primitive vs. .Internal is pretty significant for things on this time scale. NULL meaning NULL and NULL meaning undefined would lead to the same path for much of my code. I'll be swapping out many exists and get calls later today. Thanks! I do still think it would be
2015 Jan 09
2
RFC: getifexists() {was [Bug 16065] "exists" ...}
>>>>> Martin Maechler <maechler at stat.math.ethz.ch> >>>>> on Fri, 9 Jan 2015 14:00:38 +0100 writes: >>>>> Michael Lawrence <lawrence.michael at gene.com> >>>>> on Thu, 8 Jan 2015 14:02:26 -0800 writes: >> On Thu, Jan 8, 2015 at 11:57 AM, <luke-tierney at uiowa.edu> wrote: >>> On Thu, 8
2015 Jan 08
2
RFC: getifexists() {was [Bug 16065] "exists" ...}
On Thu, Jan 8, 2015 at 11:57 AM, <luke-tierney at uiowa.edu> wrote: > 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(). As mentioned, the possibility of a >> NULL value is problematic. One solution is a sentinel value that indicates >> an unbound value
2014 Feb 11
1
getting environment from "top" promise
Hi all, It seems that there is a use case for obtaining the environment for the "top" promise. By "top", I mean following the promise chain up the call stack until hitting a non-promise. S4 data containers often mimic the API of base R data structures. This means writing S4 methods for functions that quote their arguments, like with() and subset(). The methods package
2002 Jan 02
1
Building R-1.4 on Tru64
Hello everyone, I've just attempted to build R-1.4 on Compaq Tru64 (I'll enclose the text from bug.report() from R-1.3.1 at the end.) The relevant part of the log is below. Any ideas? gcc -shared -o methods.so do_substitute_direct.o methods_list_dispatch.o method_meta_data.o slot.o -L/usr/local/lib /usr/ucb/ld: Warning: Unresolved: TYPEOF Rf_error Rf_protect Rf_substitute
2015 Jan 08
4
RFC: getifexists() {was [Bug 16065] "exists" ...}
If we do add an argument to get(), then it should be named consistently with the ifnotfound argument of mget(). As mentioned, the possibility of a NULL value is problematic. One solution is a sentinel value that indicates an unbound value (like R_UnboundValue). But another idea (and one pretty similar to John's) is to follow the SYMSXP design at the C level, where there is a structure that
2014 Jul 16
1
C-API: removing key-value pairs in an environment
Hi, I am trying to remove key-value pairs from an environments (using C). While adding seems straightforward with `Rf_defineVar()`, I cannot find a function to remove objects from a given environment. Would anyone know if there is such a function ? Best, Laurent
2014 Dec 03
0
we need an exists/get hybrid
I've looked at related speed issues in the past, and have a couple related points to add. (I've put the info below at http://rpubs.com/wch/46428.) There?s a significant amount of overhead just from calling the R function get(). This is true even when you skip the pos argument and provide envir. For example, if you call get(), it takes much more time than .Internal(get()), which is what
2014 Dec 04
0
we need an exists/get hybrid
All, So that suggests that .GlobalEnv[["X"]] is more efficient than get("X", pos=1L). What about .GlobalEnv[["X"]] <- value, compared to assign("X", value)? Dave On Wed, Dec 3, 2014 at 3:30 PM, Peter Haverty <haverty.peter at gene.com> wrote: > Thanks Winston! I'm amazed that "[[" beats calling the .Internal > directly. I
2015 Jul 15
2
bquote/evalq behavior changed in R-3.2.1
On Jul 15, 2015, at 12:51 PM, William Dunlap wrote: > I think rapply() was changed to act like lapply() in this respect. > When I looked at the source of the difference, it was that typeof() returned 'language' in 3.2.1, while it returned 'list' in the earlier version of R. The first check in rapply's code in both version was: if (typeof(object) != "list")
2004 Oct 08
2
R-2.0.0 findVar and findFun question
Dear all, when working on a project with embedded R, I found out that R-2.0.0 causes a problem where older versions worked OK. Rf_findVar(...) causes the following error when used to find a generic function (such as print): fun = Rf_findVar(...); R_tryEval(fun, ...); Error in function (object, ...) : Invalid generic function in usemethod Alternatively, using Rf_findFun(...) seems OK in this
2015 Jul 15
2
bquote/evalq behavior changed in R-3.2.1
David, If you are referring to the solution that would be: rapply(list(test), eval, envir = fenv) I thought I explained in the question that the above code does not work. It does not throw an error, but the behavior is no different (at least in the output or result). Using the above code still results in the x object not being stored in fenv on 3.1.2. Dayne On Wed, Jul 15, 2015 at 4:40 PM,
2007 Jul 04
2
problem with findFun call from embedded R
I was debugging a problem reported to me regarding PL/R, and found that I can duplicate it using only R sources. It might be characterized as possibly a misuse of the findFun() function, but I leave that for the R devel experts to decide. The below results are all with R-2.5.1 (I can't seem to download r-patched at the moment, but didn't see anything in the 2.5.1-patched release
2009 Aug 06
1
[R] Repeatable, But Time Varying R GUI Crash (PR#13880)
On 8/6/2009 4:11 PM, Marilyn & Rich Short wrote: > Hello, > > I'm having a problem in R. The R GUI is crashing with a message to > contact Microsoft for the solution. I've contacted Microsoft and they > are of no help. Below is a distilled set of code that will cause the > crash. As you will see, there are two do-loops within which is a "load" >
2015 Jul 15
3
bquote/evalq behavior changed in R-3.2.1
In 3.1.2 eval does not store the result of the bquote-generated call in the given environment. Interestingly, in 3.2.1 eval does store the result of the bquote-generated call in the given environment. In other words if I run the given example with eval rather than evalq, on 3.1.2 "x" is never stored in "fenv," but it is when I run the same code on 3.2.1. However, the given
2015 Jan 09
0
RFC: getifexists() {was [Bug 16065] "exists" ...}
>>>>> Michael Lawrence <lawrence.michael at gene.com> >>>>> on Thu, 8 Jan 2015 14:02:26 -0800 writes: > On Thu, Jan 8, 2015 at 11:57 AM, <luke-tierney at uiowa.edu> wrote: >> On Thu, 8 Jan 2015, Michael Lawrence wrote: >> >> If we do add an argument to get(), then it should be named consistently >>>
2019 Oct 09
2
S3 lookup rules changed in R 3.6.1
tl;dr: S3 lookup no longer works in custom non-namespace environments as of R 3.6.1. Is this a bug? I am implementing S3 dispatch for generic methods in environments that are not packages. I am trying to emulate the R package namespace mechanism by having a ?namespace? environment that defines generics and methods, but only exposes the generics themselves, not the methods. To make S3 lookup work