Displaying 20 results from an estimated 90000 matches similar to: "Set environment name"
2007 Jan 07
2
environmentName
I noticed the new environmentName in R 2.5.0dev. Thus I gather that
each environment has:
(1) a name
(2) a hex value
so
1. environmentName gets the name. Is there any way to set the name?
2. is there any way to get the hex value for an environment other than doing:
e <- new.env()
capture.output(e)
2016 Dec 08
2
methods(`|`) lists all functions?
Dear R-Devel,
I was attempting an exercise in Hadley Wickam's book "Advanced R". The
exercise is to find the generic with the greatest number of methods.
I found that 'methods(`|`)' produces a list of length 2506, in R
3.3.1. Similar behavior is found in 3.4.0. It seems to include all
functions and methods. I imagine something is being passed to "grep"
without
2010 May 13
2
What functions are called internally in R to resolve what variable is referred?
Hello All,
If I refer to a variable 'x', 'x' will be searched in the current
frame or the parent frame, or the parent of the parent frame, etc.,
until it is found (or not found at all)? Could you please show me what
code in R source that handles this? Is it in the C code or the R code?
Thanks,
Tom
2015 Jul 07
3
List S3 methods and defining packages
Hi,
from the man page ?methods, I expected to be able to build pairs
(class,package) for a given S3 method, e.g., print, using
attr(methods(print), 'info').
However all the methods, except the ones defined in base or S4
methods, get the 'from' value "registered S3method for print", instead
of the actual package name (see below for the first rows).
Is this normal
2005 May 06
4
How to understand packages, namespaces, environments
I would be very glad of pointers to information on how the concepts of
packages, namespaces and environments are interrelated in R.
I am trying to get a handle on this both so I can delve further into
understanding other people's code and so I can organize my own in a
more coherent manner.
From my reading about environments it seems they function as what I
would intuitively call
2007 Sep 18
1
Re-attaching a package environment drops the attributes
Hi.
contrary to other environments, the attributes of a *package*
environment are dropped (from the new environment) when attach():ing
it to the search() path. This might or might not be surprising, but
have some side effects if rearranging/attaching package environments.
# Example - Regular environments
env <- new.env()
attr(env, "foo") <- "bar"
print(env)
##
2011 Apr 13
2
How to get the names of all the packages that depend on a give package?
Dear All,
I want to check what packages depends on a given package. For example,
glmnet depends on Matrix. I want get the names of all the packages
that depend on Matrix on CRAN. Is there a way to do so? Thanks!
> library(glmnet)
Loading required package: Matrix
Loading required package: lattice
--
Tom
2016 Apr 13
0
formula argument evaluation
%=>% would have precendence ('order of operations') problems also.
A + B %=>% C
is equivalent to
A + ( B %=>% C)
and I don't think that is what you want.
as.list(quote(A + B %=>% C)) shows the first branch in the parse tree. The
following function, str.language, shows the entire parse tree, as in
> str.language(quote(A + B %=>% C))
`quote(A + B %=>%
2008 Aug 15
6
Saving environment object
Hi,
When I create an environment object with new.env() and populate it with
values then how can I save it into an .RData file properly, so it can be
loaded later on in a new session?
Saving an environment object with save() or save.image() results in an error
message when loading again:
Error: protect(): protection stack overflow
Regards,
benjamin
======================================
2011 Feb 02
1
Hidden environment
Hi
I wondering if its possible to make a hidden environment for a package, so
the user cant see whats in it but the diffrent functions inside the package
can use the variables in the environment.
Hope you can understand what Im after.
Joel
--
View this message in context: http://r.789695.n4.nabble.com/Hidden-environment-tp3253502p3253502.html
Sent from the R help mailing list archive at
2011 Aug 23
1
How to keep the command 'R CMD INSTALL -l' running, even when some error is encountered?
Hi,
'R CMD INSTALL -l' will stop if some error is encountered. I don't
find in the manual an option to keep the command running. Is there
such an option?
--
Tom
2003 May 21
2
"locked environment"
I have a class defined as an extension to matrix:
fooCLASS <- setClass("foo",representation("matrix"))
and define a method for a generic function (no problem):
setMethod("diff",signature(x="foo"),diff.foo <- function(x){x})
but I get a different behaviour for another generic function:
setMethod("lag",signature(x="foo"),lag.foo
2011 Feb 28
7
Where to put External Nodes in Multiple Environments?
All,
For those that are using external nodes (as local files) and multiple
environments, where do you put the external node files?
Ie, do you put them down in the environment itself
/etc/puppet/env/env1/manifests/extdata/nodes
/etc/puppet/env/env.../manifests/extdata/nodes
/etc/puppet/env/envN/manifests/extdata/nodes
OR, up above the environments?
/etc/puppet/manifests/extdata/nodes
Which
2008 Mar 18
7
download.file()
Hi,
I wanted to download a file and did the following:
---------------------------------------------------------
> fileLink <- 'ftp://ftp.ncbi.nih.gov/pub/geo/DATA/supplementary/series/GSE1000/GSE1000_RAW.tar'
> download.file(fileLink,'/geoDat')
trying URL 'ftp://ftp.ncbi.nih.gov/pub/geo/DATA/supplementary/series/GSE1000/GSE1000_RAW.tar'
ftp data connection made,
2006 Jan 18
2
Loading of namespace on load of .Rdata (was strange behaviour of load)
Last week Giovanni Parrinello posted a message asking why various packages were loaded when he loaded an .Rdata file. Brian Ripley replied saying he thought it was because the saved workspace contained a reference to the namespace of ipred. (Correspondence copied below).
This begs the question: how did the reference to the namespace of ipred come to be in the .Rdata file? Brian did say it is
2004 Nov 23
3
str() resets class for environments
I noticed the following today --- str() seems to remove any extra
class information added to an environment.
> e <- new.env()
> class(e)
[1] "environment"
> class(e) <- c("foo", class(e))
> class(e)
[1] "foo" "environment"
> str(e)
Classes 'foo', 'environment' length 0 <environment>
> class(e)
[1]
2006 Jun 02
4
function environment
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
how can I automatically access the functions that I loaded into a
separate environment?
> save(A,B,file="myfun.r")
> load("myfun.r",envir=(ENV<-new.env()))
> ls(ENV)
[1] "A" "B"
?"[" turned up that I can access the functions via
> ENV$A
function ()
{
}
> ENV$A()
NULL
Now, how
2004 Jan 05
2
Set values in namespaces
Hello,
I want to use global variables in a package which is using a namespace.
But I don`t know how to change the values of the global variables.
I know how to get the value of the variables, e.g.
> base::pi
[1] 3.141593
but following code doesn`t work
> base::pi <- 3.14
Error: Object "base" not found
Thanks for your help,
Thomas Stabla
--
> version
_
platform
2010 Jul 07
2
How not to print '\\' as '\\'
Hello All,
'\\' is printed as '\\', but it is actually only one character.
Sometimes, I'd rather print it as a single '\'. Is there a function to
do so in R?
> nchar('\\')
[1] 1
> print('\\')
[1] "\\"
--
Tom
2008 Nov 17
4
functional (?) programming in r
the following is a trivialized version of some functional code i tried
to use in r:
(funcs = lapply(1:5, function(i) function() i))
# a list of no-parameter functions, each with its own closure environment,
# each supposed to return the corresponding index when applied to no
arguments
sapply(funcs, function(func) func())
# supposed to return c(1,2,3,4,5)
there is absolutely nothing unusual in