Displaying 20 results from an estimated 5000 matches similar to: "side-effect of calling functions via `::`"
2017 Sep 01
4
side-effect of calling functions via `::`
>>>>> Lionel Henry <lionel at rstudio.com>
>>>>> on Fri, 1 Sep 2017 13:47:07 +0200 writes:
> A package should probably never register a S3 method unless it owns
> either the generic or the class.
I agree... (and typically it does "own" the class)
> Here `formula.tools` owns neither.
i.e., it neither defines as.character()
2017 Sep 01
0
side-effect of calling functions via `::`
Really, we have three levels of behavior related to dispatch: not loaded, loaded and attached. The loaded state is the most fragile - it does change some behavior (like the one below) but not others (when the package defines a new version of a generic). So it is true that the dispatch is the most problematic, in some sense you'd want it to be local to the package code when the package is not
2017 Sep 01
0
side-effect of calling functions via `::`
A package should probably never register a S3 method unless it owns
either the generic or the class. Here `formula.tools` owns neither.
Instead of registering the method, it should export it like a regular
function. This way S3 dispatch is based on lexical scoping rather than
session-wide side effect.
Lionel
> On 1 sept. 2017, at 12:57, Simon Barthelm? <simon.barthelme at gipsa-lab.fr>
2019 Jul 23
2
[External] Re: quiet namespace load is noisy
Lionel,
Thanks for your response. I understand that method overriding can be a serious issue, but as you say, this is not something that the user can act upon. Yet the message lands at the user?s feet.
In my case, the messages are cluttering my package vignettes, and may or may not represent what users see if they themselves run the vignette code, depending on what version of ggplot2, etc. they
2019 Jul 23
2
[External] Re: quiet namespace load is noisy
Dear Russ,
I had the same problem in my vignettes and setting both message and warning
to FALSE seems to remove all unwanted output:
```{r message=FALSE, warning=FALSE}
library("afex")
library("ggplot2")
library("cowplot")
theme_set(theme_grey())
```
Result:
https://cran.r-project.org/web/packages/afex/vignettes/afex_plot_introduction.html
Best,
Henrik
Am Di.,
2019 Jul 23
2
quiet namespace load is noisy
Dear R-devel,
Consider the following clip (in R version 3.6.0, Windows):
> requireNamespace("ggplot2", quietly = TRUE)
Registered S3 methods overwritten by 'ggplot2':
method from
[.quosures rlang
c.quosures rlang
print.quosures rlang
It seems to me that if one specifies 'quietly = TRUE', then messages about S3 method
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
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
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,
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:
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.
>
>
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 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,
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 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
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
2009 Mar 05
3
Package issue
I've converted the bdsmatrix package (used by coxme) to the newer style of
S4, and uploaded it. It is in the pkg directory of survival, on r-forge.
I'm stuck on something that is almost certainly a namespace issue. I've
borrowed liberally from Matrix (a big help) and read the documentation, and
just upgraded to 2.8.1 - but still stuck.
All the tests work when I run them "by
2020 May 12
4
S3 method dispatch for methods in local environments
Dear All,
In R 3.6.3 (and earlier), method dispatch used to work for methods stored in local environments that are attached to the search path. For example:
myfun <- function(y) {
out <- list(y=y)
class(out) <- "myclass"
return(out)
}
print.myclass <- function(x, ...) print(formatC(x$y, format="f", digits=5))
myfun(1:4)
# prints: [1]
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
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
>