search for: assigninnamespac

Displaying 20 results from an estimated 60 matches for "assigninnamespac".

Did you mean: assigninnamespace
2018 Apr 19
2
odd assignInNamespace / setGeneric interaction
...Wed, Apr 18, 2018 at 1:38 PM, William Dunlap via R-devel > <r-devel at r-project.org> wrote: >> 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") >> utils::assignInNamespace("q", function(sav...
2018 Apr 19
0
odd assignInNamespace / setGeneric interaction
The problem is not specific to redefining the q function, but to the interaction of assignInNamespace and setGeneric. The latter requires, roughtly, that the environment of the function being replaced by an S4 generic is (or is the descendent of) the environment in which it lives. E.g., the following demonstrates the problem % R --quiet --vanilla > assignInNamespace("plot", functio...
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") utils::assignInNamespace("q", function(save = "no", ...) base:::.qOrig(save = sa...
2018 Apr 18
0
odd assignInNamespace / setGeneric interaction
...k into this though. Michael On Wed, Apr 18, 2018 at 1:38 PM, William Dunlap via R-devel <r-devel at r-project.org> wrote: > 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") > utils::assignInNamespace("q", function(save = "no", ...) >...
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...
2013 Feb 07
1
assignInNamespace to create a setwd() replacement: how to use unlockBinding()?
...ce that cd() acts like cd - under the tcsh shell, returning to the previously stored directory. #### setwd-new.R ###### # .Rprofile functions to set current directory in WindowTitle #====================== # setwd() replacement functions #====================== oldsetwd <- base::setwd utils::assignInNamespace("setwd", function(dir) { .lastdir <<- oldsetwd(dir) utils::setWindowTitle( short.path(base::getwd()) ) .lastdir }, "base") # setwd replacement, allowing cd() to be like 'cd -' on unix (return to last dir) cd <- function(dir) { if(missing(dir)) dir <- .last...
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 Here is some directory information: -rw-rw-r-- 1 chippy chippy 1222666 Feb 2 07:20 .RData -rw------- 1 chippy chippy 21897 Feb 2 07:20 .Rhistory Is .RData corr...
2012 Dec 11
1
Reassign functions called by other functions in package graphics
...I'd like my plot.default and plot.new called (this afternoon, at least) in place of every invocation of plot.default and plot.new resp.. So far I've tried: reassignInPackage from R.utils: reassignInPackage("plot.default","graphics",my.plot.default) gives "Error in assignInNamespaceT(name, value, ns = pkgName, envir = env) : locked binding of ?plot.default? cannot be changed", even after unlockBinding("plot.default",as.environment("package:graphics")) assignInNamespace seems to almost work. Here's what I enter: plot.default<-function(...){...
2009 Mar 31
4
what is the preferred method to create a package local variable?
...er("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. I've looked at assignInNamespace, but I can't seem to make it work. Is there a preferred method for doing this? When I try adding an assignment directly in the source file, I get the "cannot change value of locked binding" error. What am I missing? Thanks, Whit
2012 Jul 30
1
locked binding of setwd() in R 2.15.x causes .Rprofile to fail
...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 will still work under R 2.14.2 and not fail under R 2.15? Error in utils::assignInNamespace("setwd", function(dir) { : locked binding of ?setwd? cannot be changed ###################### #-- functions from .Rprofile # modify setwd() to also show the current path in the window title # assigns .lastdir in the global environment local({ oldsetwd <- setwd utils::assignInNamespac...
2007 Apr 23
2
Documentation for namespaces
Brian Ripley recently replied to a comment of mine by referring to a function 'assignInNamespace', which I had not heard of. Is there a good write up on name spaces in R? There are little tidbits in the manuals on the R site, but I found nothing substative. I'd like to understand these better. Terry Therneau
2006 Oct 03
1
developing a package with a name space
...if further debugging is needed ... other alternatives are being explored ... ". Is renaming/removing the NAMESPACE file still the favored approach when developing and debugging code for an R package? I suppose the alternative I have in mind is something like sourcing an R file, and using assignInNamespace(), may be more trouble than it is worth. I am doing this development using ESS by the way. Thanks for any guidance! Erik Iverson
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)" "LMEoptimize<-"(`*tmp*`, value = list(maxIter = 200, toleran...
2009 Oct 30
1
.Rprofile replacement function setwd() causing errors
...ngth(parts <- unlist(strsplit(dir, '/'))) parts <-rev( rev(parts)[1:min(np,len)] ) dots <- ifelse (np>len, '...', '') paste(dots,paste(parts, '/', sep='', collapse='')) } utils::setWindowTitle(short.path(base::getwd())) utils::assignInNamespace("setwd", function(dir){ .Internal(setwd(dir)) utils::setWindowTitle( short.path(base::getwd()) ) }, "base") However, this causes errors in some cases where setwd is used by other functions, particularly example(): > library(HistData) >...
2012 Jan 11
2
lubridate does not install on FreeBSD any more
...ing messages: 1: Setting LC_CTYPE failed, using "C" 2: Setting LC_TIME failed, using "C" 3: Setting LC_MESSAGES failed, using "C" 4: Setting LC_PAPER failed, using "C" Error : .onLoad failed in loadNamespace() for 'lubridate', details: call: utils::assignInNamespace("+.Date", add_dates, "base") error: locked binding of '+.Date' cannot be changed Error: loading failed Execution halted ERROR: loading failed * removing '/usr/local/lib/R/library/lubridate' * restoring previous '/usr/local/lib/R/library/lubridate' D...
2006 Oct 13
2
bug: Editing function formals deletes the environment
...39;m using R 2.3.1 for macosX. Upgrading is not an option. This is what I do: library(R2HTML) # get the function to modify x = getFromNamespace("HTML.data.frame", "R2HTML") # change the default for an argument formals(x)["Border"]=list(NULL) # put the function back assignInNamespace("HTML.data.frame", x, "R2HTML") #test the function: HTML(data.frame(1:2), file=stdout()) Error: could not find function "HTMLReplaceNA" # what seems to be happening is that the formals function is stripping the namespace off the variable x. I can't tell why...
2011 Nov 08
1
Warning message interpretation
Using the rmarketdata package and getting a warning message. What does this warning message tell me ? What could I do to eliminate or address it ? require(rdatamarket) Loading required package: rdatamarket Loading required package: zoo Warning message: In assignInNamespace("as.Date.numeric", function(x, origin, ...) { : binding of ?as.Date.numeric? is locked and will not be changed -- View this message in context: http://r.789695.n4.nabble.com/Warning-message-interpretation-tp4014483p4014483.html Sent from the R help mailing list archive at Nabble.com.
2009 Sep 09
1
Monkey patching +.POSIXt
...mes necessary, internal hackery, hence the title.) The problem is I can't figure out how to override +.POSIXt so that it gets called from +. Simply including a new +.POSIXt function in the package doesn't work because (I presume) + finds and uses base::+.POSIXt. The next thing I tried was assignInNamespace("+.POSIXt", lubridate::`+.POSIXt`, "base") but that doesn't seem to work either, despite the documentation: "They do attempt to alter a copy registered as an S3 method if one is found." (perhaps there is a missing not there?) In desperation, I also tried the fo...
2012 May 09
1
Paquete Spatstat
...R version 2.15.0, y Ubuntu 12.04 los cuales ya lo actualice. El paquete (spatstat) esta instalado pero puntualmente es problema es asi: / > library("spatstat") Loading required package: mgcv Error : .onLoad failed in loadNamespace() for ''Matrix'', details: call: assignInNamespace(".M.classEnv", .M.classEnv, ns = "base") error: locked binding of ''.M.classEnv'' cannot be changed Error: package ''mgcv'' could not be loaded/ Ya cargué el paquete "mgcv" y tambien un paquete "deldir" que lei por ahi q...
2012 Jul 31
2
Error Installing Package with Dependency on "Matrix"
...}". When I try to install, I get the following error: [ebernstein@coolio R]$ R CMD INSTALL temp -l /home/ebernstein/Rlib_2.15.1/ * installing *source* package ‘temp’ ... ** R ** preparing package for lazy loading Error : .onLoad failed in loadNamespace() for 'Matrix', details: call: assignInNamespace("..Old..as.matrix", base::as.matrix, ns = "base") error: locked binding of ‘..Old..as.matrix’ cannot be changed Error : package ‘Matrix’ could not be loaded ERROR: lazy loading failed for package ‘temp’ * removing ‘/home/ebernstein/Rlib_2.15.1/temp’ If I remove the dependenc...