Displaying 20 results from an estimated 6000 matches similar to: "Documentation for namespaces"
2018 Apr 18
2
odd assignInNamespace / setGeneric interaction
A coworker got tired of having to type 'yes' or 'no' after quitting R: he
never wanted to save the R workspace when quitting. So he added
assignInNamespace lines to his .Rprofile file to replace base::q with
one that, by default, called the original with save="no"..
utils::assignInNamespace(".qOrig", base::q, "base")
2018 Apr 19
2
odd assignInNamespace / setGeneric interaction
>>>>> Michael Lawrence <lawrence.michael at gene.com>
>>>>> on Wed, 18 Apr 2018 14:16:37 -0700 writes:
> Hi Bill,
> Ideally, your coworker would just make an alias (or shortcut or
> whatever) for R that passed --no-save to R. I'll try to look into this
> though.
> Michael
Yes, indeed!
As some of you know, I've
2012 Dec 11
1
Reassign functions called by other functions in package graphics
I am trying to get a function written in R that calls a cascade of functions from the graphics package, and I want to eventually call replacements to functions in the graphics package instead of the originals. Specifically, I have a function that calls qqnorm in stats, which calls qqnorm.default in stats, which calls plot in graphics, which calls plot.default and plot.new, and I want my own
2013 Feb 07
1
assignInNamespace to create a setwd() replacement: how to use unlockBinding()?
In my .Rprofile for Windows, I had the following functions defined to
mirror a few features
I miss from linux:
(a) replace setwd() with a version that stashes the current directory so
it can be easily restored
(b) writes a short version of the current R directory to the Windows
title bar: I can always see where I am,
with multiple Rgui windows.
(c) creates a cd() shorthand for setwd(), but
2011 May 31
1
assignInNamespace and new bindings
Hello,
assignInNamespace refuses to assign an object to a name that is not
already used in the namespace.
Something like this would make it possible:
--- src/library/utils/R/objects.R (revision 56024)
+++ src/library/utils/R/objects.R (working copy)
@@ -252,8 +252,9 @@
stop("environment specified is not a package")
ns <- asNamespace(substring(nm, 9L))
2012 Jul 30
1
locked binding of setwd() in R 2.15.x causes .Rprofile to fail
[Env: Win XP, R 2.14.2, R 2.15.0]
I have a replacement function for setwd() in my .Rprofile which displays
the current R path in the R window
title. It no longer works in R 2.15.x, giving the error below. Worse,
the error prevents the rest of my
.Rprofile script from completing.
Is there some way to rescue this, i.e., preserve this behavior in
R 2.15? If not, how can I modify my script so it
2007 Apr 23
2
stringsAsFactor global option (was "character coerced to a factor")
--- Gabor Grothendieck <ggrothendieck at gmail.com>
wrote:
> Just one caveat. I personally would try to avoid
> using
> global options since it can cause conflicts when
> two different programs assume two different settings
> of the same global option and need to interact.
I see this argument often, and don't buy it. In any case, for this
particular option, the
2006 Oct 03
1
developing a package with a name space
Hello -
I'm currently maintaining an R package that uses a name space, and am
also starting a new R package that will use a name space.
According the the R News June 2003 issue, "Adding a name space to a
package may complicate debugging code ... it is a good idea not to add a
name space to a package until it is completely debugged, and to remove
the name space if further debugging
2009 Mar 31
4
what is the preferred method to create a package local variable?
for the moment, I'm using:
.onAttach <- function(libname, pkgname) {
.bbg.db.conn <<- dbConnect(dbDriver("PostgreSQL"), user="blah","blah")
}
.onUnload <- function(libpath) {
dbDisconnect(.bbg.db.conn)
}
which results in a hidden global variable in the global environment.
I would prefer to make the assignment only in the package namespace.
2006 Feb 06
1
Error in fun(...) : couldn't find function "assignInNamespace"
I started my laptop, opened a shell and get this error message:
R : Copyright 2005, The R Foundation for Statistical Computing
Version 2.2.1 (2005-12-20 r36812)
ISBN 3-900051-07-0
lines deleted
Error in fun(...) : couldn't find function "assignInNamespace"
Error: .onLoad failed in 'loadNamespace' for 'Matrix'
Fatal error: unable to restore saved data in .RData
2005 Dec 29
1
'last.warning' problem at startup; package Matrix (PR#8453)
On starting an R session, I get the messages:
Fatal errir: unable to restore save data in .RData
Error in fun(...): couldn't find function "assignInNamespace"
Error: .onLoad failed in 'loadNamespace' for 'Matrix'
The only object in my .RData is last.warning, thus:
> last.warning
$"optim or nlminb returned message false convergence (8)"
2009 Oct 30
1
.Rprofile replacement function setwd() causing errors
In my .Rprofile I have the following functions which display the
current directory in the main R window title bar,
and modify base::setwd() to keep this up to date. I like this because I
can always tell where I am in the file system.
cd <- function(dir) {
base::setwd(dir)
utils::setWindowTitle( short.path(base::getwd()) )
}
short.path <- function(dir, len=2) {
np
2006 Sep 05
3
terms.inner
Question:
I am trying to impliment a function in R that we use quite regularly in
Splus, and it fails due to a lack of the "terms.inner" function in R.
The substitute is?
Part question and part soapbox:
Why remove terms.inner from R? It's little used, but rather innocuous.
Mostly soapbox:
I figured it was no big deal, as I originally discovered the use of
terms.inner from
2016 Apr 15
4
simple interactions
I'd like to get interaction terms in a model to be in another form. Namely, suppose I had
variables age and group, the latter a factor with levels A, B, C, with age * group in the
model. What I would like are the variables "age:group=A", "age:group=B" and
"age:group=C" (and group itself of course). The coefficients of the model will then be
the age effect
2020 Sep 25
1
Extra "Note" in CRAN submission
When I run R CMD check on the survival package I invariably get a note:
...
* checking for file ?survival/DESCRIPTION? ... OK
* this is package ?survival? version ?3.2-6?
* checking CRAN incoming feasibility ... NOTE
Maintainer: ?Terry M Therneau <therneau.terry at mayo.edu>?
...
This is sufficient for the auto-check process to return the following failure message:
Dear maintainer,
2012 Jan 11
2
lubridate does not install on FreeBSD any more
With newest R devel
#sessionInfo()
R Under development (unstable) (2012-01-10 r58085)
Platform: amd64-portbld-freebsd10.0 (64-bit)
locale:
[1]
de_DE.ISO8859-15/de_DE.ISO8859-15/de_DE.ISO8859-15/C/de_DE.ISO8859-15/de_DE.ISO8859-15
attached base packages:
[1] stats graphics grDevices utils datasets methods base
I get the following error when I try to build and install lubridate from
2006 May 12
2
reusing routines
I've created some Splus code for a microarray problem that
- needed to be in C, to take advantage of some sparse matrix
properties
- uses a cholesky decompostion as part of the computation
For the cholesky, I used the cholesky2 routine, which is a part of the
survival library. It does just what I want and I'm familiar with it (after
all, I wrote it).
In Splus, this all works
2006 Jan 01
4
S3 vs. S4
Dear R People:
Could someone direct me to some documentation on the
difference between S3 and S4 classes, please?
For example, why would a person use one as opposed to another?
Maybe pros and cons of each?
Thanks in advance!
R Version 2.2.0 (I'm downloading the new one this afternoon!) Windows.
Happy New Year!
Sincerely,
Erin Hodgess
Associate Professor
Department of Computer and
2013 Oct 16
2
How to obtain restricted estimates from coxph()?
Hello,
I'm trying to use coxph() function to fit a very simple Cox proportional
hazards regression model (only one covariate) but the parameter space is
restricted to an open set (0, 1). Can I still obtain a valid estimate by
using coxph function in this scenario? If yes, how? Any suggestion would be
greatly appreciated. Thanks!!!
[[alternative HTML version deleted]]
2006 Oct 13
2
bug: Editing function formals deletes the environment
First, here's the specific bug I have. Later I'll say why I care.
> ls(zappo)
Error in try(name) : object "zappo" not found
# good.
> f = function(zappo) { function(y) zappo + y }
> g = f(1)
> g(1)
[1] 2
> formals(g)
$y
> formals(g)$y
> formals(g)$y = 2
> g
function (y = 2)
zappo + y
> g(1)
Error in g(1) : object "zappo" not found