search for: ismethodsdispatchon

Displaying 16 results from an estimated 16 matches for "ismethodsdispatchon".

2024 Mar 13
1
Spurious warning in as.data.frame.factor()
...precation warning only when not called by method dispatch from as.data.frame(): - bdy[[2L]] <- quote(if((sys.nframe() <= 1L || !identical(sys.function(-1L), as.data.frame))) + bdy[[2L]] <- quote(if((sys.nframe() <= 1L || !( + identical(sys.function(-1L), as.data.frame) || ( + .isMethodsDispatchOn() && + methods::is(sys.function(-1L), 'derivedDefaultMethod') && + identical( + sys.function(-1L)@generic, + structure('as.data.frame', package = 'base') + ))))) .Deprecated( msg = gettextf( "Direct call of '%s()' is depr...
2013 Oct 18
1
Possible problem with namespaceImportFrom() and methods for generic primitive functions
...eck), or even if I try to load it using devtools::load_all() I tried to investigate the problem, and I found that the error arises in the base::namespaceImportFrom() function, and more precisely in this block: for (n in impnames) if (exists(n, envir = impenv, inherits = FALSE)) { if (.isMethodsDispatchOn() && methods:::isGeneric(n, ns)) { genNs <- get(n, envir = ns)@package Here n is '[', and the get(n, envir = ns) expression returns .Primitive("["), which is a function and has no @package slot. This will only occur if exists(n, envir = impenv, inherits =...
2016 Apr 19
2
S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment
See also .isMethodsDispatchOn, which is what trace uses to decide if the methods package needs to be loaded. ~G On Tue, Apr 19, 2016 at 5:34 AM, Michael Lawrence <lawrence.michael at gene.com > wrote: > Not sure why R_has_methods_attached() exists. Maybe Martin could shed > some light on that. > > On Mon, A...
2004 Jan 08
3
S3, S4, namespace
I have encountered an issue which I have been unable to resolve, involving an S3 generic (print) being declared S4 generic in a package, and the method being exported. This all works fine - the problem occurs when I try to import the method to another package. Here is the bit that works fine. ------------- #the .r file for package bar
2016 Apr 19
4
S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment
...rks after fixing the check to ensure that R_MethodsNamespace > is not R_GlobalEnv, but one could load a serialized S4 object and > expect S3 dispatch to work with Rscript. > > On Tue, Apr 19, 2016 at 6:51 AM, Gabriel Becker <gmbecker at ucdavis.edu> > wrote: > > See also .isMethodsDispatchOn, which is what trace uses to decide if the > > methods package needs to be loaded. > > > > ~G > > > > On Tue, Apr 19, 2016 at 5:34 AM, Michael Lawrence > > <lawrence.michael at gene.com> wrote: > >> > >> Not sure why R_has_methods_attached...
2009 Aug 17
2
S4 Generics and NAMESPACE : justified warning ?
...ision 49278) +++ src/library/base/R/namespace.R (working copy) @@ -797,8 +797,12 @@ } } for (n in impnames) - if (exists(n, envir = impenv, inherits = FALSE)) - warning(msg, " ", n) + if (exists(n, envir = impenv, inherits = FALSE)) { + if (.isMethodsDispatchOn() && methods:::isGeneric(n, ns)) { + if (methods:::isGeneric(n, impenv)) + warning("replacing previous generic import: ", n) + } else warning(msg, " ", n) + } importIntoEnv(impenv, impnames, ns, impvars) if (r...
2010 Mar 17
1
Suggestion: Not having to export .conflicts.OK in name spaces
...ported. If so, a patch for library() is: >svn diff library.R Index: library.R =================================================================== --- library.R (revision 51296) +++ library.R (working copy) @@ -312,7 +312,7 @@ nogenerics <- !.isMethodsDispatchOn() || checkNoGenerics(env, package ) if(warn.conflicts && - !exists(".conflicts.OK", envir = env, inherits = FALSE)) + !exists(".conflicts.OK", envir = ns, inherits = FALSE)) checkC...
2024 Mar 12
1
Spurious warning in as.data.frame.factor()
Hi, The acrobatics that as.data.frame.factor() is going thru in order to recognize a direct call don't play nice if as.data.frame() is an S4 generic: ??? df <- as.data.frame(factor(11:12)) ??? suppressPackageStartupMessages(library(BiocGenerics)) ??? isGeneric("as.data.frame") ??? # [1] TRUE ??? df <- as.data.frame(factor(11:12)) ??? # Warning message: ??? # In
2016 Apr 19
0
S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment
...package? The above example works after fixing the check to ensure that R_MethodsNamespace is not R_GlobalEnv, but one could load a serialized S4 object and expect S3 dispatch to work with Rscript. On Tue, Apr 19, 2016 at 6:51 AM, Gabriel Becker <gmbecker at ucdavis.edu> wrote: > See also .isMethodsDispatchOn, which is what trace uses to decide if the > methods package needs to be loaded. > > ~G > > On Tue, Apr 19, 2016 at 5:34 AM, Michael Lawrence > <lawrence.michael at gene.com> wrote: >> >> Not sure why R_has_methods_attached() exists. Maybe Martin could shed >&...
2016 Apr 19
0
S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment
...ck to ensure that R_MethodsNamespace >> is not R_GlobalEnv, but one could load a serialized S4 object and >> expect S3 dispatch to work with Rscript. >> >> On Tue, Apr 19, 2016 at 6:51 AM, Gabriel Becker <gmbecker at ucdavis.edu> >> wrote: >> > See also .isMethodsDispatchOn, which is what trace uses to decide if the >> > methods package needs to be loaded. >> > >> > ~G >> > >> > On Tue, Apr 19, 2016 at 5:34 AM, Michael Lawrence >> > <lawrence.michael at gene.com> wrote: >> >> >> >> Not...
2024 Mar 14
1
Spurious warning in as.data.frame.factor()
...ly when not called by method dispatch from as.data.frame(): > - bdy[[2L]] <- quote(if((sys.nframe() <= 1L || !identical(sys.function(-1L), as.data.frame))) > + bdy[[2L]] <- quote(if((sys.nframe() <= 1L || !( > + identical(sys.function(-1L), as.data.frame) || ( > + .isMethodsDispatchOn() && > + methods::is(sys.function(-1L), 'derivedDefaultMethod') && > + identical( > + sys.function(-1L)@generic, > + structure('as.data.frame', package = 'base') > + ))))) > .Deprecated( > msg = gettextf( > &qu...
2006 Nov 21
1
strange R GUI crash
Hi all, I know I shouldn't really expect the following to work, but it provokes a crash of the GUI on my computer (Win xp professional). --- >sessionInfo() Version 2.3.1 (2006-06-01) i386-pc-mingw32 attached base packages: [1] "methods" "stats" "graphics" "grDevices" "utils" "datasets" [7] "base"
2019 Mar 29
1
Discrepancy between is.list() and is(x, "list")
I know I said that I had no further comments on object oriented semantics. However, I found a contradiction in the R documentation. Gabriel Becker wrote: > So, there are implicit classes, but *only when the data object is NOT an "R object" In the R Language Definition: > The R specific function typeof returns the type of an R object. > Lists have elements, each of which can
2016 Apr 19
3
S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment
Thanks for looking into it, your approach sounds good to me. See also R_has_methods_attached() (https://github.com/wch/r-source/blob/42ecf5f492a005f5398cbb4c9becd4aa5af9d05c/src/main/objects.c#L258-L265). I'm fine with Rscript not loading "methods", as long as everything works properly with "methods" loaded but not attached. -Kirill On 19.04.2016 04:10, Michael
2011 Dec 23
2
missing value where TRUE/FALSE needed
Merry Xmas to all, I am writing a function and curiously this runs sometimes on one data set and fails on another and i cannot figure out why. Any help much appreciated. If i run the code below with data <- iris[ ,1:4] The code runs fine, but if i run on a large dataset i get the following error (showing data structures as matrix is large) > str(cluster.data) num [1:9985, 1:811] 0 0 0 0
2003 Apr 24
2
R-1.7.0 build feedback: NetBSD 1.6 (PR#2837)
R-1.7.0 built on NetBSD 1.6, but the validation test suite failed: Machinetype: Intel Pentium III (600 MHz); NetBSD 1.6 (GENERIC) Remote gcc version: gcc (GCC) 3.2.2 Remote g++ version: g++ (GCC) 3.2.2 Configure environment: CC=gcc CXX=g++ LDFLAGS=-Wl,-rpath,/usr/local/lib make[5]: Entering directory `/local/build/R-1.7.0/src/library' >>> Building/Updating