Displaying 20 results from an estimated 627 matches for "usemethods".
Did you mean:
usemethod
2004 Nov 15
1
UseMethod call with no arguments
Dear R developers,
I will ask a very straightforward question concerning UseMethod's future,
because people depending on my code wonder what will happen to it next.
In R v2.0.1 NEWS it says
o The undocumented use of UseMethod() with no argument is now
formally deprecated.
and in the R v2.0.1 help(UseMethod) it says
'UseMethod' accepts a call with no arguments and tries to
1999 Apr 14
5
R's UseMethod() does not dispatch on changed class() (PR#167)
(opening new bug report thread, on suggestion of BDR ..)
I said on vaguely related topic:
MM> There's another long-standing
MM> UseMethod / NextMethod / Dispatch problem that I've never traced/solved..
MM>
MM> Look at the $RHOME/tests/mode-methods.R file !
Peter Dalgaard already remarked :
PD> ..i.e. this:
PD> abc <- function(x, ...) {
PD> if
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"?
2001 Nov 16
1
UseMethod() fails to (PR#1176)
match the argument 'x' if there is another argument with prefix 'x'
Full_Name: Henrik Bengtsson
Version: 1.3.1
OS: Sun Solaris 8
Submission from: (NULL) (130.235.3.49)
I ran into a strange problem with UseMethod(). Run the following code:
foo.Bar <- function(this, x=0, xidx=0) {
cat("In foo.Bar(): ", this, ", x=", x, ", xidx=", xidx,
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 =
2005 Apr 10
2
the difference between UseMethod and NextMehod?
hi,usRs,i am studing the R programming,but i can not get the point abut the difference between UseMethod and NextMehod.i have read the manual and try to find the solutin from internet,but i still not master it well.so anyone can give me a guide?it will be better to show some examples .
thank you !
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"))
2003 Jan 20
0
UseMethod change; isas-tests; all.equal
I was a little optimistic that the modified version passed _all_ the
tests. When I installed the complete change, all the fullcheck tests
passed except two, demos and isas-tests.
There is a tiny difference in the output of the demos test, where the
previous demos.Rout had what looks like an unwanted piece of output,
printing an attribute "legend" after doing
symnum(summary(detg.mod,
2001 Nov 16
0
Best/safest way to use UseMethod()?
I raised the questions below a couple of months ago by sending it to the developers mailing list, but I don't know if it got through since no one replied to it.
Looking at the [R] distribution, the UseMethod() is used in the following way:
alias <- function(object, ...) UseMethod("alias")
or
barplot <- function(height, ...) UseMethod("barplot")
What I
2005 Oct 31
0
Minor typos with UseMethod docs (PR#8269)
Full_Name: Mike Kay
Version: R-patched
OS: Linux
Submission from: (NULL) (137.75.70.37)
Hi,
The following patch cleans up some grammar in the docs for UseMethod
(library/base/help/UseMethod)
-mike
--- UseMethod 2005-09-28 20:06:39.000000000 +0000
+++ /tmp/UseMethod 2005-10-31 21:21:05.534708720 +0000
@@ -5,7 +5,7 @@
Description:
R possesses a simple generic function mechanism
S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment
2016 Apr 18
3
S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment
Scenario: An S3 method is declared for an S4 base class but called for
an instance of a derived class.
Steps to reproduce:
> Rscript -e "test <- function(x) UseMethod('test', x); test.Matrix <-
function(x) 'Hi'; MatrixDispatchTest::test(Matrix::Matrix())"
Error in UseMethod("test", x) :
no applicable method for 'test' applied to an
2003 Mar 26
0
Rprof/UseMethod
I'm having difficulty with Rprof. I have a documentation example test.qss that
runs fine without profiling, but under Rprof,
> Rprof()
> source("test.qss")
Error in standardGeneric("model.matrix") :
UseMethod used in an inappropriate fashion
Luke wrote about a similar circumstance last summer:
# From: Luke Tierney (luke@stat.umn.edu)
# Date: Fri Jul
1999 Jul 15
2
R: UseMethod with primitives?
Hello,
is the following somehow possible with Mod() being a primitive:
"Mod" <- function(x)
UseMethod("Mod")
"Mod.default" <- function(x) {
.Primitive("Mod") ### I know it?s wrong. How can I access the
original Mod ?
}
Thanks for help
M. Eger
--
+-------------------------------------------------------
| Marcus Eger
| Philipps Universitaet
2005 Oct 18
3
Finding code for R functions
Greetings,
I am trying to figure out how to find the source code for R functions. I
am specifically interested in finding the code for the "prcomp"
function. I know that typing the function name without parenthesis will
lead to the code (or to a .Internal or .FORTRAN or .C call). However, I
don't really understand what is going on. For example, typing "mean"
gives a
2010 Dec 22
1
forcing evaluation of a char string argument
I'm trying to make a function to turn a regular function into an S3 generic
one. I want myMethod to be:
function(x,...) UseMethod("myMethod")
But I keep getting:
function(x,...) UseMethod(func)
Here's the function:
toGeneric<-function(func) {
env<-environment(get(func))
# default method of new generic = the original function
2023 Oct 20
0
UseMethod forwarding of local variables
UseMethod has since the beginning had the 'feature' that local
variables in the generic are added to the environment in which the
method body is evaluated. This is documented in ?UseMethod and
R-lang.texi, but use of this 'feature' has been explicitly discouraged
in R-lang.texi for many years.
This is an unfortunate design decision for a number of reasons (see
below), so the plan
2003 Jan 21
0
UseMethod; all.equal; isas-tests
1. UseMethod (via usemethod in objects.c) now uses the definition of
class() to dispatch, with the methods package attached (dataClass(x))
and without (attr(x, "class")).
Packages using a construction of the form
if(is.null(class(x))) class(x) <- data.class(x)
UseMethod("foo")
should now get similar dispatch with the methods package attached.
2. all.equal and some of its
2004 Oct 28
1
Internal function isUME() in findGeneric() is wrong (PR#7320)
Full_Name: Jeff Hallman
Version: 2.0
OS: Linux
Submission from: (NULL) (132.200.32.34)
The function findGeneric() in the utils namespace contains this internal
function:
isUME <- function(e) {
if (is.call(e) && (is.name(e[[1]]) || is.character(e[[1]]))) {
switch(as.character(e[[1]]), UseMethod = as.character(e[[2]]),
"{" =
2004 Sep 27
2
Getting code for functions
Hello
Pardon for the elementary question, I did try searching the archives
with various terms, but to no avail. I am using R1.9.1 on a windows
machine
One of the great advantages of R (to me, anyway) is being able to see
the code for a function , e.g. by typing sd one sees the code for
getting a standard deviation.
However, for many functions this only provides info. including
UseMethod, eg.
2006 Apr 14
3
The object argument of NextMethod.
My question is when the object argument of NexthMethod be used?
In the following example, weather object argument is used will not
affects the result.
###
foo=function(x) {UseMethod("foo")}
foo.cls1=function(x)
{
x=x+1;class(x)<-"ncls"
NextMethod()
}
foo.ncls=function(x)
{
cat("ncls\n")
}
foo.cls2=function(x)
{
cat("cls2\n");print(x)
}