similar to: Sharing variables in seperate workspace

Displaying 20 results from an estimated 1000 matches similar to: "Sharing variables in seperate workspace"

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))
2013 Jul 26
1
How to best implement package options?
Dear developeRs, I have a package, pls, that implements package options. The users are supposed to use a function pls.options() to manipulate them. If a user changes the options, they are stored in .GlobalEnv. I was recently informed that this is against current CRAN submission policies, so I need to change that. I have looked at several different packages that implement package options, and
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
2009 Jan 23
1
overwriting '<-' and infinite recursions
Hello all, I'm having a problem when overwriting the '<-' function and was told I'd better post it here for help. The reason why I need to overwrite it is complicated and not easy to tell in a few words; but this seems the only clean option other than hacking R's core source code. My code looks like: # in .onLoad of a package; or if you want to test, put it in a function
2011 Aug 08
1
Overwriting imported function in another package
I am running into a limitation of the grid::grid.newpage function, for which I would like to overwrite this function with a slightly modified one. Hopefully this is a temporary working solution until the package gets updated. I found a way to overwrite the function in the package:grid namespace. However, lattice imports grid rather than depending on it. So I need a way to overwrite this imported
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
2015 Jan 21
2
reducing redundant work in methods package
Hi all, The function call series genericForPrimitive -> .findBasicFuns -> .findAll happens 4400 times while the GenomicRanges package is loading. Each time .findAll follows a chain of environments to determine that the methods namespace is the only one that holds a variable called .BasicFunsList. This accounts for ~10% of package loading time. I'm sure there is some history to that
2018 Dec 21
2
Bug report: R.home() cause package Rcpp failed executing sourceCpp, similar bug are labeled "BUG 16660" since 2016 and here I could provide a solution that tested in my laptop.
https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=16660 Here is the bug, which R.home may generate a path contains a whitespace. this will cause Rcpp failed executing sourceCpp > sourceCpp("b:/2018-12-14/src/18020/MCMC.cpp") Error in system(cmd, intern = !showOutput) : 'D:/Program' not found Error in system(cmd, ignore.stderr = TRUE, intern = TRUE) :
2011 Jan 26
1
Problem with "setMethod" in R package
Dear all, My apologies for re-posting this question, but I have not found any solution to my problem so far. I also think that my post may have been overseen due to the posting time and high traffic on this list. I experience a problem in implementing a S4 class in a package and would appreciate your help in this matter. The class is implemented using Rcpp, which works well. I then extend
2015 Jan 21
2
reducing redundant work in methods package
Doing it like this: genericForPrimitive <- function(f, where = topenv(parent.frame()), mustFind = TRUE) { ans = .BasicFunsList[[f]] ## this element may not exist (yet, during loading), dom't test null if(mustFind && identical(ans, FALSE)) stop(gettextf("methods may not be defined for primitive function %s in this version of R",
2024 Mar 21
1
[External] Re: Building Packages. (fwd)
[forgot to copy to R-help so re-sending] ---------- Forwarded message ---------- Date: Thu, 21 Mar 2024 11:41:52 +0000 From: luke-tierney at uiowa.edu To: Duncan Murdoch <murdoch.duncan at gmail.com> Subject: Re: [External] Re: [R] Building Packages. At least on my installed version (which tells me it is out of date) they appear to just be modifying the "package:utils" parent
2024 Mar 21
1
[External] Re: Building Packages. (fwd)
If you are wondering why RStudio did this, you can see their substitute function using (parent.env(environment(install.packages)))$hook They appear to do these things: - Allow package installation to be disabled. - Check if a package to be installed is already loaded, so that RStudio can restart R for the install. - Add Rtools to the PATH if necessary. - Trigger an event to say
2011 Jan 23
0
setMethod call in package code using Rcpp
Dear all, I experience a problem in implementing a S4 class in a package and would appreciate your help in this matter. The class is implemented using Rcpp, which works well. I then extend the class with R functions, adding them as methods with a call to setMethod(...). When I do this outside the package (after loading the package with "library(...)"), everything works smoothly.
2009 Oct 04
1
Modify base R functions in Rprofile.site
Hi everyone, I want to modify two base R functions 'parse' and 'deparse' immediately after R has started, so I added some code in the file 'Rprofile.site' under the 'etc' directory. Here is a simple example: parse=function(...){ base::parse(...) } I'll get an error when I start R as follows: Error: cannot change value of locked binding for
2013 Feb 27
0
How to specify ff object filepaths when reading a CSV file into a ff data frame.
Really old subject?, so, all my apologizes for digging up but, since I also ran into this? maybe this hack can be useful to someone I propose monkey patching here: library(ff) my.as.ffdf.data.frame <- function (x, vmode = NULL, col_args = list(), ...) { rnam <- attr(x, "row.names") if (is.integer(rnam)) { if (all(rnam == seq_along(rnam))) rnam <- NULL else
2015 Jan 21
0
reducing redundant work in methods package
Note that setMethod() resolves .BasicFunsList in the methods namespace directly when setting a method on a primitive. Somehow there should be consistency between genericForPrimitive() and the check in setMethod(). Also, we can probably step away from the use of elNamed(), given that [[ now uses exact matching. Have you tried patching methods to use .BasicFunsList directly as in setMethod? On
2010 May 29
3
S4 dispatch for .DollarNames (utils)
Hello, I'm trying to make .DollarNames generic and implement a method for it in a package. .DollarNames is the function that is now called to get completion possibilities. My R code looks like this: setGeneric( ".DollarNames" ) setClass("track", representation(x="numeric", y="numeric")) ## A class extending the previous, adding one more
2008 Mar 13
3
Sealed for setGeneric
Hi the list When two setGeneric occurs on the same function, the second erage the first and erase all the function previously define. Is it possible to prevent that ? Is it possible to declare a setGeneric that can not be erased later ? Something like the |sealed for setMethod...| || |Thanks| || Christophe
2015 Jan 22
0
reducing redundant work in methods package
I also just noticed that there is a bug: identical(ans, FALSE) should be is.null(ans). So no error is thrown: > methods:::genericForPrimitive("foo") NULL Will fix. On Wed, Jan 21, 2015 at 3:13 PM, Peter Haverty <haverty.peter at gene.com> wrote: > Doing it like this: > > genericForPrimitive <- function(f, where = topenv(parent.frame()), mustFind > = TRUE) {
2006 May 19
1
UseMethod infelicity
If I do > example(lm) ... > mycoef <- function(object, ...) UseMethod("coef", object) > mycoef(lm.D9) Error in mycoef(lm.D9) : no applicable method for "coef" which is pretty surprising, as coef has a default method. After a bit of digging, this comes from do_usemethod having defenv = environment where the generic was defined */ defenv =