similar to: Missing arguments to new

Displaying 20 results from an estimated 3000 matches similar to: "Missing arguments to new"

2004 Apr 19
3
How to write an S4 method for sum or a Summary generic
If I have a class Foo, then i can write an S3 method for sum for it: >setClass("Foo",representation(a="integer"));aFoo=new("Foo",a=c(1:3,NA)) >sum.Foo <- function(x,na.rm){print(x);print(na.rm);sum(x at a,na.rm=na.rm)} >sum(aFoo) But how do I write an S4 method for this? All my attempts to do so have foundered. For example
2003 Dec 18
1
qbinom when probability is 1 (PR#5900)
Full_Name: Jonathan Swinton Version: 1.8.0 OS: Windows 2000 Submission from: (NULL) (193.132.159.34) Calling qbinom with a sample probability of 1 returns NaN > qbinom(p=0.95,size=10,prob=1) [1] NaN I believe that this is wrong and that qbinom(p,size,prob=1) should always be size for 0<p<=1. The documentation says that The quantile is defined as the smallest value x such that F(x)
2004 Apr 20
2
Re: [R] Unexpected behaviour of identical (PR#6799)
"Swinton, Jonathan" <Jonathan.Swinton@astrazeneca.com> writes: > # works as expected > > ac <- c('A','B'); > > identical(ac,ac[1:2]) > [1] TRUE > > #but > > af <- factor(ac) > > identical(af,af[1:2]) > [1] FALSE > > Any opinions? Did a cross-check with Splus and it doesn't do that , so I think it
2003 Nov 19
2
Was: setValidity and "initialize" method conflict ? [in R-help]
Hello, Thomas Stabla (statho3@web.de) has already sent this question to R-help, Wed, 12 Nov 2003 21:21:31 +0100, but we are not sure whether we should better post this mail to this audience than to R-help: --------------------------------------------------------------------- We are using S4-classes and want to force a validity check when an object is created. How can this be done, when an
2002 Aug 06
2
[ and setMethod conflict?
I noticed this oddity about [ and setMethod. First, I define testFunc, which sorts a data frame by the first column and returns the entries that aren't NAs, and testIt, which runs testFunc repeatedly on a random large data frame, each time saving the return into a dummy placeholder (for demonstration's sake). > require(methods) Loading required package: methods [1] TRUE > testFunc
2002 Aug 06
2
[ and setMethod conflict?
I noticed this oddity about [ and setMethod. First, I define testFunc, which sorts a data frame by the first column and returns the entries that aren't NAs, and testIt, which runs testFunc repeatedly on a random large data frame, each time saving the return into a dummy placeholder (for demonstration's sake). > require(methods) Loading required package: methods [1] TRUE > testFunc
2003 Sep 16
2
couldn't find function "setClass"
Hello ... With a new checkout of R-devel (last update was 2003-09-11) we are having a problem (it seems to be happening to all of us here on a few different machines) where during install/check/etc when the 'save image' happens (in packages using 'save image'): ** save image Error: couldn't find function "setClass" Execution halted This is for all packages that
2003 May 30
2
Creating a vector class
I'm trying to create a package for working on orientation data, i.e. data where the observations are 3D rotations. There are several different representations of orientations in common use: SO(3) matrices, Euler angles, unit quaternions, etc. One thing I'd like is to make it convenient to work in any representation, and have conversions to others done as needed. I'm trying to do
2003 May 21
1
callNextMethod
Hi, I don't understand why this code doesn't work (f(b2)): ///////////////// setClass("B0", representation(b0 = "numeric")) setClass("B1", representation("B0", b1 = "character")) setClass("B2", representation("B1", b2 = "logical")) f <- function(x) class(x) setMethod("f", "B0",
2004 Jan 21
1
[g]sub behaviour with NA (PR#6451)
Full_Name: Jonathan Swinton Version: 1.9.0 OS: Windows 2000 Submission from: (NULL) (193.132.159.34) Attempting to substitute a NA causes an error in sub. > sub(x=NA,pattern="x",replacement="y") Error in sub(pattern, replacement, x, ignore.case, extended) : invalid argument > sub(x=NA,pattern=NA,replacement="y") [1] NA The help page for sub says only
2004 Sep 29
1
Problem with _new_ if class "lm" in object representation.
Hi! Consider this code. setClass("Ctest" ,representation( test="character" ,bla="character" ,mod="lm" ) ) new("Ctest",test="bla") #This produces an error. #Error in validObject(.Object) : Invalid "Ctest" object: Invalid object for slot "mod" in class "Ctest": got class
2003 Jun 13
1
Problem with Rcmd check and S4 methods
In the little orientation data package I'm working on, the very first example fails, even though the same code works when used in a regular session. In my experience, this usually indicates T or F has been used instead of TRUE or FALSE, but that's not the case this time. The error message is > x <- eulerzyx(1,0,0) Error: Trying to get slot "validity" from an object of
2002 Nov 05
1
function showMethods and inheritance
Hi, The following question might come from my (deep) misunderstanding of the concepts in the package 'methods'. I have a class 'A', and a class 'B' inheriting 'A' (so defined with 'setClass' and the parameter 'contains="A"'. The class A has a method 'mymethod'. A call to 'showMethods("mymethod")' return the
2003 Sep 02
1
completeSubclasses() methods bug (PR#4051)
Full_Name: Colin A. Smith Version: 1.8.0 OS: Mac OS X 10.2.6 Submission from: (NULL) (128.102.184.81) annaffy 1.0.1 (in BioC CVS) fails to load. annaffy 1.0 (on the BioC web site) has the same problem. It looks like the load is failing because of a bug in completeSubclasses() in r-devel. It calls setIs() and doesn't specify an environment via the "where" argument. setIs()
2004 Jan 29
1
setMethodReplace.. Help!
Hi! Trying to reproduce some examples from "Programming with Data" page 341. Can not reproduce it neither on R1.8.1. nor R1.9.0devel? library(methods) setClass("track",representation(x="numeric",y="numeric")) setMethod("[" ,"track" ,function(x,...,drop=T){ track(x at x[...],y at y[...]) }
2003 Oct 13
2
Infinite recursion in getGeneric (PR#4561)
> setClass('foo') [1] "foo" > setMethod('is.logical', 'foo', function(x) TRUE) [1] "is.logical" > getGeneric('is.integer') Error in options(x) : evaluation is nested too deeply: infinite recursion? > --please do not edit the information below-- Version: platform = i686-pc-linux-gnu arch = i686 os = linux-gnu system =
2004 Apr 26
1
Segfault: .Call and classes with logical slots
Hi, the following example aiming at a class containing a logical slot segfaults under R-1.9.0 when `gctorture(on = TRUE)' is used: Code code (dummy.c): #include <Rdefines.h> SEXP foo() { SEXP ans; PROTECT(ans = NEW_OBJECT(MAKE_CLASS("test"))); SET_SLOT(ans, install("lgl"), allocVector(LGLSXP, 1)); LOGICAL(GET_SLOT(ans,
2006 Jan 17
1
data.matrix returns mode logical for zero rows (PR#8496)
Full_Name: Jonathan Swinton Version: 2.2.1 OS: Windows Submission from: (NULL) (193.132.159.169) #The first line of description for data.matrix says that it will # 'Return the matrix obtained by converting all the variables in a # data frame to numeric mode and then binding them together as the # columns of a matrix.' #However when called with a data.frame with zero rows,
2003 Jun 02
1
'methods' and environments.
Hi, I have quite some trouble with the package methods. "Environments" in R are a convenient way to emulate pointers (and avoid copies of large objects, or of large collections of objects). So far, so good, but the package methods is becoming more (and more) problematic to work with. Up to version R-1.7.0, slots that were environments were still references to an environment, but I
2004 Oct 14
2
setClassUnion
Hello, I have a question concerning "setClassUnion". I'm working with R 2.0.0 Patched (2004-10-06) on windows 2000. I tried to use "setClassUnion" in a package I am currently working on. The situation is similar to the following example: The DESCRIPTION file has entries: Depends: R (>= 2.0.0), methods Imports: methods LazyLoad: yes The NAMESPACE file has