Displaying 20 results from an estimated 30000 matches similar to: "save/load and package namespaces"
2011 Mar 17
2
Scope and apply-type functions
So, I've been confused by this for a while. If I want to create functions in
an apply, it only uses the desired value for the variable if I create a new
local variable:
> lapply(1:5,function(h){k=h;function(){k}})[[1]]()
[1] 1
> lapply(1:5,function(k){function(){k}})[[1]]()
[1] 5
>
Normally, a function will use values for a variable if the variable is local
to the definition of
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
2005 Dec 21
2
Newbie - Summarize function
Dear R Users,
I have searched through the archives but I am still struggling to find a
way to process the below dataset. I have a dataset that has stratum and
plot identifier. Within each plot there is variable (Top) stating the
number of measurments that should be used to to calculate the mean to the
largest "top" elements within one of the vectors (X). I would like to
process
2011 Aug 23
2
Increase transparency: suggestion on how to avoid namespaces and/or unnecessary overwrites of existing functions
aDear list,
I'm aware of the fact that I posted on something related a while ago,
but I just can't sweat this off and would like to ask your for an opinion:
The problem:
Namespaces are great, but they don't resolve certain conflicts regarding
name clashes. There are more and more people out there trying to come up
with their own R packages, which is great also! Yet, it becomes
2006 Feb 15
1
S3 generics without NS and cleanEx()
Good morning,
we recently observed a problem with importing S3 generics from a foreign
package (without namespace), defining a S3 method in a package _with_
namespace and the `cleanEx()' function which is automatically generated
and executed before examples are run by R CMD check.
To be more precise. Package `strucchange' defines a S3 generic
sctest <- function(x, ...)
2012 Nov 13
2
Is function(x){x}(5) a valid expression?
I was surprised to notice that statements like:
h = function(...){list(...)}(x=4)
do not throw syntax errors. R claims that 'h' is now a function, but I
can't seem to call it.
> h = function(x){list(x)}(4)
> is(h)
[1] "function" "OptionalFunction" "PossibleMethod"
> h()
Error in list(x) : 'x' is missing
> h(4)
Error in h(4)
2013 Jan 26
1
Setting global variables inside R reference class ?
Hello,
I'm a newbie to R, I have a quesiton.
I'm a bit confused on global variable assignments.
I have the following situation. I have 2 global variables current_idx and
previous_idx. *These 2 global variables have to be set by a method in a
reference class*.
Essentially, using <<- assignment operator should work right ? But, I get
this warning
Non-local assignment to non-field
2003 Jun 20
3
namespaces not available
This happened to me with R-1.7.0, Linux RH9:
------------------------------------------------------------------
> q()
Save workspace image? [y/n/c]: y
Warning messages:
1: namespaces may not be available when loading
2: names in persistent strings are currently ignored
gb at lasker:~/R/test$ R
R : Copyright 2003, The R Development Core Team
Version 1.7.0 (2003-04-16)
R is free software
2016 May 06
2
Is it possible to increase MAX_NUM_DLLS in future R releases?
Thanks for all your great answers.
The app I?m working on is indeed an exploratory data analysis tool for gene expression, which requires a bunch of bioconductor packages.
I guess for now, my best solution is to divide my app into modules and load/unload packages as the user switch from one module to another.
This brought me another question: it seems that unload package with the
2018 Aug 05
2
MASS::boxcox "object not found"
Hi there,
I wrote a function that wraps MASS::boxcox as:
bc <- function(vec) {
lam <- boxcox(lm(vec ~ 1))
lam <- lam$x[which.max(lam$y)]
(vec^lam - 1)/lam
}
When I invoke it as:
> x <- runif(20)
> bc(x)
Error in eval(predvars, data, env) : object 'vec' not found
I have googled, and rewrote the above function as:
bc <- function(vec) {
dat <<-
2018 Aug 05
2
MASS::boxcox "object not found"
Hi there,
I wrote a function that wraps MASS::boxcox as:
bc <- function(vec) {
lam <- boxcox(lm(vec ~ 1))
lam <- lam$x[which.max(lam$y)]
(vec^lam - 1)/lam
}
When I invoke it as:
> x <- runif(20)
> bc(x)
Error in eval(predvars, data, env) : object 'vec' not found
I have googled, and rewrote the above function as:
bc <- function(vec) {
dat <<-
2004 Oct 06
1
R 2.0.0: namespaces, S4 classes & versioned package installation: failure to resolve correct pkg version
Hi,
further down from the problem I asked about yesterday I encounter the following
problem (please appologize for the lengthy mail - I have not found a brief example
making the issue clear):
- using R packages making use of namespaces &
- S4 classes
when using
--with-package-versions in the install call:
Pkgs install ok and the first pkg 'base' can be loaded in R
2015 Jan 08
4
unloadNamespace
In the documentation the closed thing I see to an explanation of this is
that ?detach says "Unloading some namespaces has undesirable side effects"
Can anyone explain why unloading tseries will load zoo? I don't think
this behavior is specific to tseries, it's just an example. I realize
one would not usually unload something that is not loaded, but I would
expect it to do
2015 Jan 26
2
speedbump in library
>>>>> Michael Lawrence <lawrence.michael at gene.com>
>>>>> on Mon, 26 Jan 2015 05:12:55 -0800 writes:
> A isNamespaceLoaded() function would be a useful thing to
> have in general if we are interested in readable code. An
> efficient implementation would be just a bonus.
Good point (readability), and thank you for the support!
Note
2006 Mar 27
5
InPlaceEditor convertHTMLLineBreaks
I''m curious if anyone else has a need to disable
*convertHTMLLineBreaks*. I actually need to show the <p>''s and <br>''s
in the editor and browsing the source code, see that this isn''t
configurable.
Jamie
2007 May 01
1
Possible problem with S4 dispatch
Hi,
First a bit of disclaimer... I haven't isolated this problem into an
easy to reproduce case, and I won't be surprised if the root cause is
a fault in my code's use of name spaces or some such.
The error I'm seeing is one in which the desired method is not found.
What worries me in terms of my expectations of how to debug the
problem is that showMethods and selectMethod both
2020 Jul 19
6
Speed-up/Cache loadNamespace()
Dear all,
in our current setting we have our packages stored on a (rather slow)
network drive and need to invoke short R scripts (using RScript) in a
timely manner. Most of the script's runtime is spent with package loading
using library() (or loadNamespace to be precise).
Is there a way to cache the package namespaces as listed in
loadedNamespaces() and load them into memory before the
2010 May 24
1
library location and error messages when loading packages
Hello,
I am running R on a server that several people share. Previously we
all had separate libraries for R.
I have set up R so everyone on the server shares the same library and
I downloaded the latest version of R and installed it on the
main drive of our server in the "Program Files" folder (obvious
enough).
I changed the Environmental Variables in the advanced system setting
so
2006 Oct 24
9
[WARN] Got 99% CPU?
Hey folks,
I ran into a few people at RubyConf who were having 99% CPU issues. Please contact me if you meet the following criteria:
1. You are running a production site.
2. You are experiencing 99% CPU errors.
3. This is frequent enough that you cannot manage it.
Thank you. Please contact me off-list about it.
--
Zed A. Shaw, MUDCRAP-CE Master Black Belt Sifu
http://www.zedshaw.com/