Displaying 20 results from an estimated 129 matches for "s3method".
Did you mean:
s3methods
2016 Nov 11
0
.S3methods: issue in content of info data.frame
Hi,
I was trying to get a list of S3 method for a given generic, along with the
package in which they are defined, and I came across what looks like an
issue 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...
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 sp...
2009 May 27
1
"Error: package/namespace load failed"
...e bottom of this e-mail.)
Thank you in advance for your help!
Rebecca
NAMESPACE file:
useDynLib(REEMtree)
export(AutoCorrelationLRtest, FixedEffectsTree, RandomEffectsTree,
LMEpredict, PredictionTest, RandomEffectsTree, RMSE, simpleREEMdata,
REEMtree, FEEMtree)
import(nlme)
import(rpart)
S3method(is,REEMtree)
S3method(logLik,REEMtree)
S3method(plot,REEMtree)
S3method(predict,REEMtree)
S3method(print, REEMtree)
S3method(ranef,REEMtree)
S3method(tree,REEMtree)
S3method(is,FEEMtree)
S3method(logLik,FEEMtree)
S3method(plot,FEEMtree)
S3method(predict,FEEMtree)
S3method(print, FEEMtree)
S3method(...
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 behaviour? If so, is there a way to get what I want: a
character vector mapping class to package (ideally in loading order,
but this I can re-order from search()).
Thank you.
Bests,
Renaud...
2019 May 14
2
[R-pkg-devel] Three-argument S3method declaration does not seem to affect dispatching from inside the package.
...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.
>
> It appears that the 3-argument form of S3method() in NAMESPACE controls
> dispatching when the generic is called from outside the package that
> defines it but not when it's called from inside the package that
> defines it.
>
> For example the attached minimal package has four R functions:
>
> gen <- function(objec...
2013 Apr 19
2
NAMESPACE and imports
....xmean.ordinaly,pol,pphsm,predab.resample,Predict,psm,rcs,related.predictors,reVector,robcov,Rq,sascode,scored,sensuc,setPb,show.influence,specs,strat,Surv,"[.Surv",survdiffplot,survest,Survival,survplot,univarLR,validate,val.prob,val.probg,val.surv,vif,which.influence)
importFrom(Hmisc)
S3method(anova, rms)
S3method(latex, anova.rms, bj, cph, Glm, Gls, lrm, naprint.delete, ols,
pphsm, psm, rms, Rq, summary.rms, validate)
When doing R CMD INSTALL I get: [using R 2.15.3]
** preparing package for lazy loading
Error : c("bad 'S3method' directive: S3method(latex, anova.rms, bj, c...
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 and metadata
Fehler in parse(nsFile) : Unerwartetes ')' bei
348:
349: S3method("as.ff",function)
Calls: <Anonymous...
2010 Nov 30
1
warning creating an as.array method in a package
...on(object, log = object$log, ...)
if(log) object$coefficients else exp(object$coefficients)
as.array.loddsratio <- function (x, log=x$log, ...)
drop(array(coef(x, log = log), dim = dim(x), dimnames=dimnames(x)))
I believe everything is declared properly in the NAMESPACE file, e.g.,
...
S3method(dim, loddsratio)
S3method(dimnames, loddsratio)
S3method(print, loddsratio)
S3method(vcov, loddsratio)
S3method(as.matrix, loddsratio)
S3method(as.array, loddsratio)
All my tests work correctly when run in the R console, but R CMD check
gives me a perplexing warning:
* checking whether package...
2004 Oct 17
2
Errors while compiling packages with namespace?
...browseURL, methods)
importFrom(lattice, lset)
importFrom(MASS, lda)
import(svIO, graphics, grDevices, stats)
export(guiViewsCmd,
guiViewsCSS,
guiViewsCSSChange,
guiViewsDir,
guiViewsDisplay,
guiViewsFile,
report,
reportGraph,
viewHTMLinit)
S3method(view, default)
S3method(view, data.frame)
S3method(view, function)
S3method(view, matrix)
S3method(view, princomp)
S3method(view, trellis)
S3method(view, ts)
Thank you.
Best,
Philippe Grosjean
..............................................<??}))><........
) ) ) ) )
( ( ( ( ( Prof. P...
2010 Dec 09
1
warning creating an as.array method in a package
...ind 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.
These are all properly declared in the NAMESPACE as S3 methods,
...
S3method(dim, loddsratio)
S3method(dimnames, loddsratio)
S3method(print, loddsratio)
S3method(vcov, loddsratio)
S3method(as.matrix, loddsratio)
S3method(as.array, loddsratio)
Yet, when I run R CMD check, R CMD build, etc. or even load the package,
I get the warning,
> library(vcdExtra)
Loading requir...
2019 May 14
0
[R-pkg-devel] Three-argument S3method declaration does not seem to affect dispatching from inside the package.
...ou export gen.formula() or not. When
> you call gen() inside your package, the S3 dispatch mechanism finds a
> method gen.formula defined in that environment (the package's
> namespace), so it is called.
Indeed, this is the case. The issue is that when both are available and
exported, S3method takes precedence outside the package but function
name takes precedence inside the package.
> 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...
2006 Sep 01
1
as.environment(NULL)
...onion'
Error: package/namespace load failed for 'onion'
Execution halted
It looks like this package has a loading problem: see the messages for
details.
in 00check.log.
I don't understand what I have to do to fix this.
In my NAMESPACE file there are lots of lines like this:
S3method("Re", quaternion)
S3method("Im", quaternion)
S3method("i", quaternion)
S3method("j", quaternion)
S3method("k", quaternion)
what do I have to do to make onion work under R-devel?
--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre,...
2015 Jul 07
0
List S3 methods and defining packages
...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 behaviour? If so, is there a way to get what I want: a
> character vector mapping class to package (ideally in loading order,
> but this I can re-order from search()).
It's t...
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...
2019 May 14
2
[R-pkg-devel] Three-argument S3method declaration does not seem to affect dispatching from inside the package.
...en.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
> > you.
>
> That's a good point.
>
> > library(anRpackage)
> > gen(a~b)
> I am the S3method-declared method.
> > gen.formula <- function(object, ...){message("I am the externally declared method.")}
> > gen(a~b)
> I am the externally declared method.
> > test_me()
> I am the tester. Which one will I call?
> I am the function with a...
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 on...
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.
...modify gen.formula() to issue the warning before passing on
to .gen.formula(). Then, direct calls to gen.formula() would produce a
warning, but gen(formula) would by pass it.
> > That is, for a call from inside a package, the order of precedence
> > would be as follows:
> > 1. S3method() in that package's NAMESPACE.
> > 2. Appropriately named function in that package (exported or
> > not).
> > 3. Appropriately named function in calling environment (which
> > may be
> > GlobalEnv).
> > 4. S3method() in other loaded packages...
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 "anova.rms" and `anova.rms` in S3method() to no av...