similar to: Question about substitute() and function def

Displaying 20 results from an estimated 30000 matches similar to: "Question about substitute() and function def"

2006 Jan 25
2
Using substitute from inside an S4 method
Hi all, I would like to access the name of a variable passed to an S4 method. For a function, I would do this: f <- function(x) as.character(substitute(x)) This also works for a the examples I have tried for methods that do not have extra, non-dispatch args: setGeneric("A", function(x, ...) standardGeneric("A")) setMethod("A",
2007 May 27
2
[Bioc-devel] promptClass
promptClass fails to identify methods associated with the class. Here is a fix: Index: promptClass.R =================================================================== --- promptClass.R (revision 41719) +++ promptClass.R (working copy) @@ -165,7 +165,7 @@ if (nmeths > 0) { .meths.body <- " \\describe{" for (i in 1:nmeths) { - .sigmat
2007 Apr 26
1
Problem with R-2.5.0 patched and Matrix package
Hi, Using latest R 2.5.0 Patched, I'm unable to install the Matrix package from cran.fhcrc.org. I get: Creating a new generic function for "isSymmetric" in "Matrix" Creating a new generic function for "unname" in "Matrix" Error in conformMethod(signature, mnames, fnames, f) : In method for function "!": formal arguments omitted in
2007 May 17
3
RFC: adding an 'exact' argument to [[
Hi all, One of the things I find most problematic in R is the partial matching of names in lists. Robert and I have discussed this and we believe that having a mechanism that does not do partial matching would be of significant benefit to R programmers. To that end, I have written a patch that modifies the behavior of "[[" as follows: 1. [[ gains an 'exact' argument with
2003 Feb 19
3
Pretty onscreen plots?
I'm looking for ideas for creating high-quality plots for use in projected presentations (powerpoint, etc) --- ideally high-quality png, jpg, bmp. The graphics produced using the postscript device look very good. Those generated with win.graph(), png are plagued by the jaggy lines. So far, the only way I can use the postscript plots in my presentations is using separate screen capture
2007 Jun 12
1
PATCH: install inst/ before doing lazyload on Windows
Hi, On Windows, package files in the inst/ subdir are installed after the lazyload creation. This differs from Linux where inst/ is installed _before_ lazyload creation. Since packages may need data in inst, I think the order on Windows should be changed. Perhaps like this: diff --git a/src/gnuwin32/MakePkg b/src/gnuwin32/MakePkg index 57af321..868e8f1 100644 --- a/src/gnuwin32/MakePkg +++
2007 May 08
2
Problem calling $ inside a $ method
Hello, I wonder if this will make it through the spam filters given the subject line. I'm seeing the following when trying to call a dollar method inside of a dollar method. setClass("Foo", representation(d="list")) [1] "Foo" f <- new("Foo", d=list(bob=1, alice=2)) ## We can call dollar at this level and it works as expected
2007 Jul 21
2
dict package: dictionary data structure for R
Hi all, The dict package provides a dictionary (hashtable) data structure much like R's built-in environment objects, but with the following differences: - The Dict class can be subclassed. - Four different hashing functions are implemented and the user can specify which to use when creating an instance. I'm sending this here as opposed to R-packages because this package will
2005 Mar 21
1
Buglet in install.packages warning message
I've been experimenting with install.packages and it's new ability to track down dependencies from a list of repositories and encountered this: install.packages(c("foo", "bar"), repos="http://cran.r-project.org", dependencies=c("Depends", "Suggests")) dependencies 'foo' are not availabledependencies 'bar'
2006 Sep 22
1
Possible bug in base::namespaceImportFrom?
Hi, namespaceImportFrom in base/R/namespace.R has the following: fdef <- methods:::getGeneric(genName, impenv) The definition of getGeneric is in methods/R/RMethodUtils.R starts with: getGeneric <- ## return the definition of the function named f as a generic. ## ## If there is no definition, throws an error or returns ## NULL according to the value of
2006 Dec 14
1
A possible improvement to apropos
Hello all, I've had the following apropos alternative in my ~/.Rprofile for some time, and have found it more useful than the current version. Basically, my version ignores case when searching. If others find this useful, perhaps apropos could be suitably patched (and I'd be willing to create such a patch). + seth Here is my version of apropos: APROPOS <- function (what, where =
2006 Jul 10
1
Add .git to SCM excludes for build and INSTALL scripts
Git is a source code management system like CVS, svn, arch, and others. It would be nice to add exclude support to R CMD build and INSTALL so that the .git subdir of an R package is handled appropriately. Here is a possible patch: diff --git a/src/scripts/INSTALL.in b/src/scripts/INSTALL.in index 75da9db..09e5ab5 100644 --- a/src/scripts/INSTALL.in +++ b/src/scripts/INSTALL.in @@ -863,7
2006 Nov 07
1
Getting the name of a SEXP type in package code?
Hi, Is there an alternative to type2char that is available for use in package code? It would be useful for producing more informative error messages. + seth
2005 Mar 18
2
Trouble debugging with gdb, R on Windows
I'm trying to follow the example in the R for Windows FAQ on running gdb and am getting stuck because gdb tells me "Cannot access memory at address ...". Here's what my gdb session looks like (This one from a cygwin shell, but same results from plain Windows CMD shell): $ cd R-devel/src/gnuwin32 $ gdb ../../bin/Rgui.exe GNU gdb 5.2.1 Copyright 2002 Free Software Foundation,
2004 Aug 09
2
Approaches to using RUnit
Having used JUnit and PyUnit, I was pleased to see the release of the RUnit package on CRAN. I'm wondering if there are any RUnit users out there that would be willing to share some tips on how they organize their code to work with RUnit. Specifically, I'm wondering about the best way to load/import/source the functions to be tested. I would like to end up with a script, testall or some
2006 Oct 11
1
Possible bug in accessing methods documentation?
Hi, Reading help("Documentation"), I'm led to believe that a help call like: ?myFun(x, sqrt(wt)) Will search for help on the appropriate method in the case that myFun is generic. This isn't working for me. Here is an example using the Biobase package: ## If Biobase is not installed source("http://bioconductor.org/biocLite.R") biocLite("Biobase")
2006 Oct 25
3
NA handling in as.character applied to a list
Hi all, In some circumstances, as.character applied to a list converts real NA's into the string "NA". Propagation of NAs is something R does very well and unless there are good reasons for losing the NA, it would improve the consistency w.r.t. NA handling for as.character to behave differently. Here's an example: ## Create a list with character, logical, and integer NA
2007 Jun 04
2
locked environment and inheritance
Hi, I have a S3 package with namespace called "myS3Pkg". Inside my package I would like to create a S4 class which extends (adds 2 slots) another S4 class from some other package. The class should be created in "myPkg" environment (and not global environment). Using: setClass("myS4class", representation("otherS4class", mydata = "numeric"),
2006 May 10
1
What is callGeneric used for?
I've recently come across two pieces of code using calls to callGeneric() inside the definition of a method. In both cases, it appears to me that the callGeneric call could be replaced with a "real" call to the generic, say foo(x) instead of callGeneric(x) inside method foo. My understanding from the docs is that when called with arguments, it is just like calling the actual
2006 Aug 22
1
ANN: 'weaver' package, caching for Sweave
Hi all, I've added a new package 'weaver' to the BioC repository: http://www.bioconductor.org/packages/1.9/bioc/html/weaver.html The weaver package provides extensions to the Sweave utilities included in R's base package. The focus of the extensions is on caching computationally expensive (time consuming) code chunks in Sweave documents. Why would you want to cache code