Displaying 7 results from an estimated 7 matches for "isenviron".
Did you mean:
ienviron
2006 Oct 15
1
Feature request: names(someEnv) same as ls(someEnv)
...ice if names() returned the equivalent of ls() for
environments.
--- a/src/main/attrib.c
+++ b/src/main/attrib.c
@@ -687,6 +687,8 @@ SEXP attribute_hidden do_names(SEXP call
s = CAR(args);
if (isVector(s) || isList(s) || isLanguage(s))
return getAttrib(s, R_NamesSymbol);
+ if (isEnvironment(s))
+ return R_lsInternal(s, 0);
return R_NilValue;
}
+ seth
--
Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center
http://bioconductor.org
2007 Sep 20
1
copying promise
1. Is there some way to copy a promise so that the copy has the same
expression in its promise as the original. In the following we
y is a promise that we want to copy to z. We
want z to be a promise based on the expression x since y is a
promise based on the expression x. Thus the answer to the code
below is desired to be z=2 but its 1, 1 and y in the next three
examples so they are not the
2008 Jan 04
1
Evaluating R expressions from C
I am currently puzzled by a passage in the R Extensions manual, section 5.10:
SEXP lapply(SEXP list, SEXP expr, SEXP rho)
{
R_len_t i, n = length(list);
SEXP ans;
if(!isNewList(list)) error("`list' must be a list");
if(!isEnvironment(rho)) error("`rho' should be an environment");
PROTECT(ans = allocVector(VECSXP, n));
for(i = 0; i < n; i++) {
defineVar(install("x"), VECTOR_ELT(list, i), rho);
SET_VECTOR_ELT(ans, i, eval(expr, rho));
}
I'm trying to u...
2014 Oct 17
1
Making parent.env<- an error for package namespaces and package imports
...rl
Index: src/main/builtin.c
===================================================================
--- src/main/builtin.c (revision 66783)
+++ src/main/builtin.c (working copy)
@@ -356,6 +356,24 @@
return( ENCLOS(arg) );
}
+static Rboolean R_IsImportsEnv(SEXP env)
+{
+ if (isNull(env) || !isEnvironment(env))
+ return FALSE;
+ if (ENCLOS(env) != R_BaseNamespace)
+ return FALSE;
+ SEXP name = getAttrib(env, R_NameSymbol);
+ if (!isString(name) || length(name) != 1)
+ return FALSE;
+
+ const char *imports_prefix = "imports:";
+ const char *name_strin...
2008 Jul 18
0
Rcpp from C++
...value, SEXP rho)
but I haven't tried that yet in detail.
getVar is the other way around and finds the data to an R variable name:
SEXP getVar(SEXP name, SEXP rho)
{
SEXP ans;
if(!isString(name) || length(name) != 1)
error("name is not a single string");
if(!isEnvironment(rho))
error("rho should be an environment");
ans = findVar(install(CHAR(STRING_ELT(name, 0))), rho);
return ans;
}
To get the data of an R-variable you should be able to use the constructors
from Rcpp that take an SEXP as argument, but i also haven't tried t...
2005 Aug 22
2
RFC: "loop connections"
...(STRING_ELT(sfile, 0));
stext = CADR(args);
- if(!isString(stext))
- error(_("invalid 'text' argument"));
sopen = CADDR(args);
if(!isString(sopen) || length(sopen) != 1)
error(_("invalid 'open' argument"));
@@ -1924,16 +1982,20 @@
if (!isEnvironment(venv) && venv != R_NilValue)
error(_("invalid 'environment' argument"));
ncon = NextConnection();
- if(!strlen(open) || strncmp(open, "r", 1) == 0)
- con = Connections[ncon] = newtext(desc, stext);
- else if (strncmp(open, "w", 1) == 0...
2005 Sep 18
0
Updated rawConnection() patch
...sopen = CADDR(args);
if(!isString(sopen) || length(sopen) != 1)
- error(_("invalid '%s' argument"), "open");
+ error(_("invalid '%s' argument"), "open");
open = CHAR(STRING_ELT(sopen, 0));
venv = CADDDR(args);
if (!isEnvironment(venv) && venv != R_BaseEnv)
error(_("invalid '%s' argument"), "environment");
ncon = NextConnection();
- if(!strlen(open) || strncmp(open, "r", 1) == 0)
+ if(!strlen(open) || (open[0] == 'r')) {
+ int isText = (!strlen(open) ||...