Displaying 20 results from an estimated 40000 matches similar to: "Generic/method consistency in print and summary"
2005 Sep 01
1
generic function S3 consistency warning advice
Hi
section 6.1 of R-exts suggests that a package can take over a
function in the base
package and make it generic.
I want to do this with Re() and have the following lines in my R code:
"Re" <- function(x){UseMethod("Re" )}
"Re.default" <- get("Re" ,pos=NULL,mode="function")
"Re.octonion" <- function(x){give.comp(x,1)}
2012 Nov 21
1
S3 generic/method consistency issue with R CMD check
Hi,
I'm having some trouble setting methods for the qr family of functions. I
believe I have distilled my misunderstanding in the code snippet below:
foo <- function(x, ...) UseMethod("foo")
foo.default <- function(x) { }
# foo
setGeneric(name = "foo", useAsDefault = foo)
setMethod("foo", signature(x="bar"),
function(x, ...) { }
)
2002 Jun 18
2
generic/method consistency ?
Dear R-list
I am compiling my first R-package and I get this warning:
...
* checking generic/method consistency ... WARNING
plot:
function(x, ...)
plot.SimNI:
function(tags, closedArea, color, ...)
...
What does this mean exactly?
Thanks in advance.
Anders.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read
2009 Nov 11
1
Clarification on generic functions and methods
I have constructed the following functions and need a little clarification:
### function to fit the model parameters
jml.fit <- function(dat, con = 1e-3, bias=FALSE, ...){
do stuff ...
}
### default function which calls jml.fit
jml.default <- function(dat, con = 1e-3, bias=FALSE, ...){
result <- jml.fit(dat, con = 1e-3, bias)
result$call <- match.call()
class(result) <-
2001 Mar 19
3
generic database access methods
I've been putting together a package that defined generic methods for
database access. The packages is called "Rdbi." It borrows as much as
possible from existing database packages / proposals. I'd like to start
a discussion about the proposed interface. Here's what I've come up
with so far:
#
# Rdbi: connectionMethods.R
#
dbConnect <- function(dbObj, ...)
Suggestion for exception handling: More informative error message for "no applicable method..." (S3)
2009 Oct 20
1
Suggestion for exception handling: More informative error message for "no applicable method..." (S3)
I'd like to suggest that whenever there is no S3 method implementation
available for a particular class, that the error message would also
report the class structure of the object dispatched on.
Example:
foo <- function(...) UseMethod("foo")
foo.ClassA <- function(object, ...) { cat("foo() for ClassA called.\n") }
> foo(structure(1, class="ClassA"))
2001 Oct 01
1
generic default values
I have a generic function
test.equal <- function(obj1, obj2, ...) UseMethod("test.equal")
however, the only argument that specific methods use is "fuzz" so I
would like to change this to
test.equal <- function(obj1, obj2, fuzz=???) UseMethod("test.equal")
The problem is that some methods use slightly different default values
for fuzz than others. How should
2010 Jun 13
1
S4 classes and S3 generic functions
A general goal for the next version of R is to make S4 and S3 play
better together.
As mentioned in a previous thread, one limitation has been that S3
generic functions, specifically the UseMethod() call, did not make use
of S4 inheritance when dispatching on general S4 objects.
This has been fixed in a version committed today (updated to rev 52267).
The code change is not large, but it
2006 Mar 15
1
Additional arguments in S3 method produces a warning
Hello,
I just notice this:
> x <- c(1:4,0:5, 4, 11)
> library(pastecs)
Loading required package: boot
> tp <- turnpoints(x)
> extract(tp, no.tp = FALSE, peak = TRUE, pit = FALSE)
[1] FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE TRUE FALSE
FALSE
Warning message:
arguments after the first two are ignored in: UseMethod("extract", e, n,
...)
>
2023 Feb 28
1
Generic Function read?
Dear R-Users,
I noticed that *read* is not a generic function. Although it could
benefit from the functionality available for generic functions:
read = function(file, ...) UseMethod("read")
methods(read)
?# [1] read.csv???? read.csv2??? read.dcf???? read.delim read.delim2?
read.DIF???? read.fortran
?# [8] read.ftable? read.fwf???? read.socket? read.table
The users would still
2011 Sep 27
1
Is there a "latex" summary function in the quantreg package for just 1 tau?
Hello dear R help members,
I wish to get a nice LaTeX table for a rq object.
Trying to use the functions I found so far wouldn't work. I can
start opening the functions up, but I am wondering if I had missed some
function which is the one I should be using.
Here is an example session for a bunch of possible errors:
(Thanks)
data(stackloss)
y <- stack.loss
x <- stack.x
rq_object
2011 Apr 20
3
Make as.factor an S3 generic?
as.factor / as.ordered is not written as a generic. This differs from
as.numeric, as.matrix, and other as.*. The following seems to address
this and does not break make check-all.
FWIW, the patch is against r55563, because with r55564 I see
/home/mtmorgan/src/R-devel/src/main/dounzip.c:75:15: error: storage size
of ?dt? isn?t known
/home/mtmorgan/src/R-devel/src/main/dounzip.c:88:5: warning:
2024 Apr 20
2
passing a modified argument to an S3 method
I do not understand what your goal is here (more context may be helpful,
perhaps to others rather than me). So I doubt this is what you want, but
here is a guess -- no need to respond if it is unhelpful:
## test.default returns NULL if object "y" not found in **calling
environment and enclosures**;
## otherwise y.
test <- function(x){
UseMethod("test")
}
test.default
2009 Mar 11
1
Could you please add "time<-" as a generic function in the 'stats' package ?
Dear R developers,
As you might have noticed, recent changes in R-dev will not allow the
definition of S3 methods with S4 classes.
But until now, we have defined "time<-" in our 'timeSeries' package as
an S3 generic because other packages are using the same function.
Indeed, if we had defined it as an S4 generic, the other packages
would not coexist well with ours.
2011 Oct 04
3
inconsistent behavior of summary function
The summary function behaves inconsistently with data frame columns, e.g.
summary(rock) #max of area 12212, correct
summary(rock$area) #max of area 12210, incorrect max
I know that
summary(rock$area, digits=5)
will correct the error (I DID read the manual). But my point is the inconsistency, because I get the correct answer without having to add the digits option in the first
2010 Jun 09
0
Argument mismatches in S3 generic and method
The way R treats the first argument to an S3 method
which uses a different name for the argument than
the generic depends on whether there is a ... in the
argument list. If there is is no ellipsis then
the call cannot tag the argument with either name
but an untagged first argument works:
> zNoDots <- function(x) UseMethod("zNoDots")
> zNoDots.foo <- function(fooObject)
2008 Jul 31
2
S 3 generic method consistency warning please help
I would like to include this in a package. The S3 methods on R CMD check
says
* checking S3 generic/method consistency ... WARNING
window:
function(x, ...)
window.chron:
function(data, day1, hour1, day2, hour2, ...)
See section 'Generic functions and methods' of the 'Writing R Extensions'
manual.
I have looked and can not figure it out. This function is for convience.
What
2011 Mar 04
3
Generic mixup?
Hello list.
This is from an R session (admittedly, I''m still using R 2.11.1):
> print
function (x, ...)
UseMethod("print")
<environment: namespace:base>
> showMethods("print")
Function "print":
<not a generic function>
Don''t the two results contradict each other? Or do I have a terrible
misunderstanding of what
2012 Dec 04
1
inconsistencies between ?class and ?UseMethod
Hi,
The 2 man pages give inconsistent description of class():
Found in ?class:
If the object does not have a class attribute, it has an implicit
class, ?"matrix"?, ?"array"? or the result of ?mode(x)? (except
that integer vectors have implicit class ?"integer"?).
Found in ?UseMethod:
Matrices and arrays have class ?"matrix"?
2012 Feb 09
1
passing an extra argument to an S3 generic
I'm trying to write some functions extending influence measures to
multivariate linear models and also
allow subsets of size m>=1 to be considered for deletion diagnostics.
I'd like these to work roughly parallel
to those functions for the univariate lm where only single case deletion
(m=1) diagnostics are considered.
Corresponding to stats::hatvalues.lm, the S3 method for class