Displaying 20 results from an estimated 36 matches for "r_unboundvalue".
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 functi...
2019 Aug 15
1
Rf_defineVar(symbol, R_UnboundValue, environment) questions
While poking around the C++ code in the dplyr package I ran across the idiom
Rf_defineVar(symbol, R_UnboundValue, environment)
to [sort of] remove 'symbol' from 'environment'
Using it makes the R-level functions objects(), exists(), and get()
somewhat inconsistent and I was wondering if that was intended. E.g., use
SHLIB to make something from the following C code that dyn.load can load
int...
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 \"%s\""), CHAR(PRINTNAME(symbol)));
/* NOT REACHED */
return R_UnboundValue;
}
I assume that the comment "/* NOT REACHED */ means that R_...
2014 Dec 03
2
we need an exists/get hybrid
...njunction. Both functions are
different usages of the do_get C function, so it's a pity to run that twice.
"get" gives an error when a symbol is not found, so you can't just do a
'get'. With R's C library, one might do
SEXP x = findVarInFrame3(symbol,env);
if (x != R_UnboundValue) {
// do stuff with x
}
It would be very convenient to have something like this at the R level. We
don't want to do any tryCatch stuff or to add args to get (That would kill
any speed advantage. The overhead for handling redundant args accounts for
30% of the time used by "exists"...
2014 Dec 03
2
we need an exists/get hybrid
...function, so it's a pity to run that
> twice.
> >
> > "get" gives an error when a symbol is not found, so you can't just do a
> > 'get'. With R's C library, one might do
> >
> > SEXP x = findVarInFrame3(symbol,env);
> > if (x != R_UnboundValue) {
> > // do stuff with x
> > }
> >
> > It would be very convenient to have something like this at the R level.
> We
> > don't want to do any tryCatch stuff or to add args to get (That would
> kill
> > any speed advantage. The overhead for handling...
2004 Oct 08
2
R-2.0.0 findVar and findFun question
...ternatively, using Rf_findFun(...) seems OK in this context, but crashes if you
call it with an unexisting function name. Rf_findVar does not crash in this case,
but returns an unbound value.
My workaround for now is as follows:
fun = Rf_findVar(Rf_install(ident), R_GlobalEnv);
if (fun != R_UnboundValue) {
fun = Rf_findFun(Rf_install(ident), R_GlobalEnv);
R_tryEval(fun, ...);
}
I did some checking on the R object pointers and indeed for generic functions
Rf_findFun and Rf_findVar return different pointers (and therefore different
function objects).
What has changed with these...
2014 Dec 03
0
we need an exists/get hybrid
...t; different usages of the do_get C function, so it's a pity to run that twice.
>
> "get" gives an error when a symbol is not found, so you can't just do a
> 'get'. With R's C library, one might do
>
> SEXP x = findVarInFrame3(symbol,env);
> if (x != R_UnboundValue) {
> // do stuff with x
> }
>
> It would be very convenient to have something like this at the R level. We
> don't want to do any tryCatch stuff or to add args to get (That would kill
> any speed advantage. The overhead for handling redundant args accounts for
> 30% of...
2014 Dec 04
0
we need an exists/get hybrid
...n that
> > twice.
> > >
> > > "get" gives an error when a symbol is not found, so you can't just do a
> > > 'get'. With R's C library, one might do
> > >
> > > SEXP x = findVarInFrame3(symbol,env);
> > > if (x != R_UnboundValue) {
> > > // do stuff with x
> > > }
> > >
> > > It would be very convenient to have something like this at the R level.
> > We
> > > don't want to do any tryCatch stuff or to add args to get (That would
> > kill
> > > any spe...
2015 Jan 09
2
RFC: getifexists() {was [Bug 16065] "exists" ...}
...TRUE,
ifnotfound = NULL)
.Internal(get0(x, envir, mode, inherits, ifnotfound))
>>>> As mentioned, the possibility of a
>>>> NULL value is problematic. One solution is a sentinel value that indicates
>>>> an unbound value (like R_UnboundValue).
>>>>
>>>
>>> A null default is fine -- it's a default; if it isn't right for a
>>> particular case you can provide something else.
>>>
[..................]
>>> Adding getIfExists, or .get, or get0, o...
2015 Jan 09
0
RFC: getifexists() {was [Bug 16065] "exists" ...}
...gt; 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).
>>>
>>
>> A null default is fine -- it's a default; if it isn't right for a
>> particular case you can provide something else.
>>
>>
>>> But another idea (and one pretty similar to John's) is to follow the...
2015 Jan 08
2
RFC: getifexists() {was [Bug 16065] "exists" ...}
...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 (like R_UnboundValue).
>>
>
> A null default is fine -- it's a default; if it isn't right for a
> particular case you can provide something else.
>
>
>> But another idea (and one pretty similar to John's) is to follow the
>> SYMSXP
>> design at the C level, where there...
2015 Aug 25
0
Child thread libR.so
...* looking it up every time we need deal with transposing a multidimensional
* intput/output look it up once here and save it off
*/
aperm_function = findFun(install("aperm"), R_GlobalEnv);
if (aperm_function == NULL || aperm_function == R_NilValue ||
aperm_function == R_UnboundValue) {
aperm_function = NULL;
} else {
aperm_expression = PROTECT(allocVector(LANGSXP, 2));
SETCAR(aperm_expression, aperm_function);
}
}
---------- SNIP ----------------
This now behaves appropriately from a child thread in my custom front end.
thank you again Simon,...
2015 Aug 20
2
Child thread libR.so
...* looking it up every time we need deal with transposing a multidimensional
* intput/output look it up once here and save it off
*/
aperm_function = findFun(install("aperm"), R_GlobalEnv);
if (aperm_function == NULL || aperm_function == R_NilValue ||
aperm_function == R_UnboundValue) {
aperm_function = NULL;
} else {
aperm_expression = PROTECT(allocVector(LANGSXP, 2));
SETCAR(aperm_expression, aperm_function);
}
}
---------------------------------------- SNIP
------------------------------------------------------------------------------
but as...
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 points to the name
and a value. We already have SYMSXPs at the R level of course (name
objects) but they do not provide access to the value, which is typically
R...
2003 Jun 06
1
Problerm building R-1.7.0 on OpenBSD3.2/sparc64
...'
/home/test/proj/downl/R-1.7.0/bin/R.bin: /home/test/proj/downl/R-1.7.0/library/m
ethods/libs/methods.so: can't resolve reference 'R_DotsSymbol'
/home/test/proj/downl/R-1.7.0/bin/R.bin: /home/test/proj/downl/R-1.7.0/library/m
ethods/libs/methods.so: can't resolve reference 'R_UnboundValue'
Error in .Call("R_initialize_methods_metadata", table, PACKAGE = "methods") :
.Call function name not in load table
Execution halted
*** Error code 1
Stop in /home/test/proj/downl/R-1.7.0/src/library/methods (line 70 of Makefile).
*** Error code 1
Stop in /home/tes...
2019 Jul 12
2
strange increase in the reference number
Hi Jiefei and Duncan,
I suspect what is likely happening is that one of ENSURE_NAMEDMAX or
MARK_NOT_MUTABLE are being hit for x. These used to set named to 3, but now
set it to 7 (ie the previous and current NAMEDMAX value, respectively).
Because these are macros rather than C functions, its not easy to figure
out why one of them is being invoked from do_isvector (a cursory
exploration
2023 Nov 15
1
saveRDS()/readRDS() on environments
Dear r-devel,
I was surprised to see that saveRDS() and readRDS() work quite well with
environments, see below:
```
z <- 3 # in global env
y <- new.env()
y$a <- 1
x <- new.env(parent = y)
x$b <- 2
saveRDS(x, "x.RDS")
# in a new session
x <- readRDS("x.RDS")
y <- parent.env(x)
x$b
#> [1] 2
y$a
#> [1] 1
parent.env(y)
#> <environment:
2009 Nov 18
1
R_NilValue and segfault.
Hello.
I've been trying to wrap up the R_NilValue into OCaml-R. I nevertheless
get a segfault.
As I gathered, R_NilValue is declared in Rinternals.h:
> /* Special Values */
> LibExtern SEXP R_NilValue; /* The nil object */
> LibExtern SEXP R_UnboundValue; /* Unbound marker */
> LibExtern SEXP R_MissingArg; /* Missing argument marker */
So, in my r_data.c file, I have:
-1- an #include directive.
> #include <Rinternals.h>
-2- the function wrapping R data in OCaml data
> CAMLprim value Val_sexp (SEXP sexp)
> {
>...
2015 Jan 08
0
RFC: getifexists() {was [Bug 16065] "exists" ...}
...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 (like R_UnboundValue).
A null default is fine -- it's a default; if it isn't right for a
particular case you can provide something else.
>
> 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 points to the name
>...
2002 Jan 02
1
Building R-1.4 on Tru64
.../usr/ucb/ld:
Warning: Unresolved:
TYPEOF
Rf_error
Rf_protect
Rf_substitute
Rf_unprotect
Rf_duplicate
Rf_VectorToPairList
R_NilValue
Rf_NewEnvironment
R_set_standardGeneric_ptr
R_GlobalEnv
R_set_quick_method_check
Rf_install
Rf_allocVector
LOGICAL
R_PreserveObject
Rf_mkChar
SET_STRING_ELT
Rf_findVar
R_UnboundValue
VECTOR_ELT
R_NamesSymbol
Rf_getAttrib
Rf_length
STRING_ELT
R_CHAR
R_do_slot
Rf_asChar
PRINTNAME
Rf_isNull
CAR
CDR
R_data_class
Rf_isFunction
Rf_findFun
SETCAR
Rf_eval
INTEGER
CLOENV
Rf_findVarInFrame
Rf_isSymbol
ENCLOS
SYMVALUE
Rf_asLogical
R_MissingArg
Rf_isPrimitive
do_set_prim_method
BODY
R_defe...