Displaying 20 results from an estimated 129 matches for "s3methods".
2016 Nov 11
0
.S3methods: issue in content of info data.frame
...in the data.frame returned in attribute 'info'. The column 'from'
mostly gets the value "registered S3method for ..." except for visible
methods. Is this the expected behavior?
See code and output below.
Thank you.
Bests,
Renaud
$ Rscript -e "library(xtable); attr(.S3methods('plot'), 'info');
sessionInfo()"
visible from generic isS4
plot.acf FALSE registered S3method for plot plot FALSE
plot.data.frame FALSE registered S3method for plot plot FALSE
plot.decomposed.ts FALSE register...
2010 Feb 14
1
How S3method() is implemented and called? And when to use it?
R-exts.pdf discribes S3method a little bit. But I want to understand
more on how it is called, implemented and when to use it.
I don't find it in an R session. But I see S3method() in some NAMESPACE files.
> S3method
Error: object 'S3method' not found
> ?S3method
No documentation for 'S3method' in specified packages and libraries:
you could try '??S3method'
I
2009 May 27
1
"Error: package/namespace load failed"
I am writing my first R package, and I have been getting the following series of errors when I run R CMD check:
* checking S3 generic/method consistency ... WARNING
Error: package/namespace load failed for 'REEMtree'
Call sequence:
2: stop(gettextf("package/namespace load failed for '%s'", libraryPkgName(package)),
call. = FALSE, domain = NA)
1: library(package,
2015 Jul 07
3
List S3 methods and defining packages
Hi,
from the man page ?methods, I expected to be able to build pairs
(class,package) for a given S3 method, e.g., print, using
attr(methods(print), 'info').
However all the methods, except the ones defined in base or S4
methods, get the 'from' value "registered S3method for print", instead
of the actual package name (see below for the first rows).
Is this normal
2019 May 14
2
[R-pkg-devel] Three-argument S3method declaration does not seem to affect dispatching from inside the package.
CCing r-devel.
On Tue, 14 May 2019 at 02:11, Pavel Krivitsky <pavel at uow.edu.au> wrote:
>
> Dear All,
>
> I've run into this while updating a package with unfortunately named
> legacy functions. It seems like something that might be worth changing
> in R, and I want to get a sense of whether this is a problem before
> submitting a report to the Bugzilla.
>
>
2013 Apr 19
2
NAMESPACE and imports
I am cleaning up the rms package to not export functions not to be called
directly by users. rms uses generic functions defined in other packages.
For example there is a latex method in the Hmisc package, and rms has a
latex method for objects of class "anova.rms" so there are anova.rms and
latex.anova.rms functions in rms. I use:
2007 Nov 05
2
namespace crash on S3method("as.ff",function)
Dear all,
I have defined a generic as.ff(x, ...) and a method as.ff.function(x, ...) which converts a standard R function x into a chunked version operating on large ff objects. Everything works fine, but when registering
S3method("as.ff",function)
in NAMESPACE, the installation fails with some kind of parsing error:
adding build stamp to DESCRIPTION
installing NAMESPACE file
2010 Nov 30
1
warning creating an as.array method in a package
[Env: R 2.11.1, Win Xp, using Eclipse/StatET]
In a package I'm working on, I want to create as.matrix() and as.array()
methods for a particular kind of
object (log odds ratios). These are returned in a loddsratio object as
the $coefficients component,
a vector, but really reflect an underlying (R-1)x(C-1)xstrata array,
whose attributes are contained in other
components.
I define coef,
2004 Oct 17
2
Errors while compiling packages with namespace?
Hello,
I try to set up namespaces for packages. It is fine for several of them,
except one whose compilation fails (under Windows XP & R 2.0.0):
---------- Making package svViews ------------
adding build stamp to DESCRIPTION
installing NAMESPACE file and metadata
Error in parse(file, n, text, prompt) : syntax error on line 21
Execution halted
make[2]: *** [nmspace] Error 1
make[1]: ***
2010 Dec 09
1
warning creating an as.array method in a package
I posted on this topic to r-help, but never got a sufficient answer, so
I'm reposting here.
[Env: R 2.11.1, Win Xp, using Eclipse/StatET]
In a package I'm working on, I want to create as.matrix() and as.array()
methods for a particular kind of
object (log odds ratios). These are returned in a loddsratio object as
the $coefficients component,
a vector, but really reflect an underlying
2019 May 14
0
[R-pkg-devel] Three-argument S3method declaration does not seem to affect dispatching from inside the package.
Hi, I?aki,
Thanks for looking into this.
On Tue, 2019-05-14 at 11:33 +0200, I?aki Ucar wrote:
> > So, calling the same generic function with the same class results
> > in different dispatching behaviour depending on whether the call is
> > from within the package doing the export or from the outside.
>
> It does not depend on whether you export gen.formula() or not. When
2006 Sep 01
1
as.environment(NULL)
Hi
In NEWS, it says
R CMD check now tests that the package can be loaded, and that
the package and namespace (if there is one) can each be loaded
in startup code (before the standard packages are loaded).
For package "onion", I think I have followed all of
sections 1.6.1 - 1.6.6 of R-exts, and it passes R CMD check for
R-2.3.1.
However, using R version 2.4.0 Under
2015 Jul 07
0
List S3 methods and defining packages
...#39; -- the namespace in which the generic to
which the method belongs is defined, and the namespace in which the method is
defined. I think the former is what you're interested in, but the latter likely
what methods() might be modified return.
For your use case, maybe something like
.S3methodsInNamespace <- function(envir, pattern) {
mtable <- get(".__S3MethodsTable__.", envir = asNamespace(envir))
methods <- ls(mtable, pattern = pattern)
env <- vapply(methods, function(x) {
environmentName(environment(get(x, mtable)))...
2023 Mar 08
1
Default Generic function for: args(name, default = TRUE)
?.S3methods
f <- function()(2)
> length(.S3methods(f))
[1] 0
> length(.S3methods(print))
[1] 206
There may be better ways, but this is what came to my mind.
-- Bert
On Wed, Mar 8, 2023 at 11:09?AM Leonard Mada via R-help <
r-help at r-project.org> wrote:
> Dear R-Users,
>
> I want t...
2019 May 14
2
[R-pkg-devel] Three-argument S3method declaration does not seem to affect dispatching from inside the package.
On Tue, 14 May 2019 at 12:31, Pavel Krivitsky <pavel at uow.edu.au> wrote:
>
> > Note that disabling name-based dispatch implies two things: 1) the
> > inability to override your method by defining gen.formula in the
> > global environment, and 2) another package can break yours (i.e.,
> > internal calls to gen()) by registering an S3 method for gen() after
>
2015 Jul 08
0
List S3 methods and defining packages
...ewcastle.edu.au/R/help/06/07/30791.html
>
> Kevin Wright
>
>
> On Wed, Jul 8, 2015 at 5:09 AM, Renaud Gaujoux
> <renaud at mancala.cbio.uct.ac.za> wrote:
>> Thank you for your reply Martin.
>> Your code made me realize that S3 methods are added to the
>> .__S3MethodsTable__. of the package that defines the generic, not to
>> the ones defining the method itself.
>> How does things work in the case of a method from one package B
>> masking the one from another package A? I don't get any warning
>> message and there seems to be only one...
2016 Nov 03
0
.S4methods inconsistent behavior with methods, .S3methods
If I call
.S4methods(sd)
I get the error
## Error in getGeneric(generic.function) :
## argument 'f' must be a string, generic function, or primitive:
got an ordinary function
By contrast, methods and .S3methods just state that no methods are found.
methods(sd)
## no methods found
S3methods(sd)
## no methods found
It seems like the behavior of these functions ought to be consistent.
Maybe they should split the difference and say no methods are found,
but warn the the input is not generic?
--
Regards,...
2019 Feb 18
0
Error in rbind(info, getNamespaceInfo(env, "S3methods"))
...ease? I'm sorry
> this isn't very much to go on. Hopefully someone can point me in the right
> direction.
When packages are installed, a hidden environment is created called
".__NAMESPACE__.". It contains a number of objects; it looks as though
one of yours called "S3methods" is corrupted. I can't guess whether it
is one coming from staRdom or one already in your library, but it
appears yours doesn't have the usual number of columns (which I think is 3).
So you could get a list of all packages in your library, and run
sapply(allpackages, function(x)...
2019 May 18
0
[R-pkg-devel] Three-argument S3method declaration does not seem to affect dispatching from inside the package.
Hi, Inaki,
On Tue, 2019-05-14 at 12:50 +0200, I?aki Ucar wrote:
> The thing is that, in R, "nearer" means "the calling environment"
> (and then, other things). When you call test_me(), the calling
> environment for gen() is the package namespace. When you call gen()
> directly, thenthe calling environment is the global environment. So
> what happens here follows
2013 Apr 24
1
Problem with S3 method dispatch and NAMESPACE
I have updated the rms package to extensively use NAMESPACE. I cannot get
certain S3 methods to dispatch. For example I have in NAMESPACE
S3method(anova, rms)
S3method(latex, anova.rms)
anova.rms produces an object of class "anova.rms" and there is a
latex.anova.rms function in rms. But when I do latex(anova(fit)) I get an
invocation of latex.default.
I have tried using