Displaying 20 results from an estimated 20 matches for "getclassdef".
2019 Jan 24
0
Possible setClassUnion Unloading Issue
...## Load the package and check validity of a character object
library('testpkg')
validObject('hello')
## [1] TRUE
## Detach, unload, and confirm that superclass is still attached
## to character
detach('package:testpkg', unload=TRUE)
getClassDef('character')
## Class "character" [package "methods"]
##
## No Slots, prototype of class "character"
##
## Extends: "vector", "data.frameRowLabels", "SuperClassMethod",
"chrOrNULL"
##
#...
2011 May 30
1
Query super- and subclasses of a class: is there a better way than to use 'completeClassDefinition()'
Dear List,
when I first started to use S4 classes, I used the function
'completeClassDef()' in order to see the super- and subclasses of a
certain class:
setClass(Class="A", representation=list(a="numeric"))
setClass(Class="B", contains="A", representation=list(b="character"))
# Super
x <- completeClassDefinition("B")
2018 Nov 03
1
odd NOTE in R CMD check of data; Rcpp module related
...soilDB" and "PopGenReport" have this NOTE:
Package: soilDB
Check: data for non-ASCII characters
New result: NOTE
Error in .requirePackage(package) :
unable to find required package 'raster'
Calls: <Anonymous> ... .findInheritedMethods -> getClass -> getClassDef
-> .requirePackage
Execution halted
In soiDB this is presumably triggered by loading this file:
> f <- system.file("data/gSSURGO.chunk.rda", package="soilDB")
> "raster" %in% .packages()
[1] FALSE
> load(f)
> gSSURGO.chunk
Loading required pack...
2015 Jan 21
2
reducing redundant work in methods package
...o refactor
.init_test_data_collection <- function(ns = asNamespace("methods")) {
funs = c("isClassUnion", "getClass", "genericForPrimitive",
"possibleExtends", ".dataSlot", ".requirePackage", ".classEnv",
"getClassDef", "outerLabels", ".getClassFromCache", "getFunction")
message(paste0("\nCollecting data for unit tests on ", paste(funs,
collapse=", "), " ...\n"))
# Make env with list to hold test input/output
TEST_ENV <- new.env()...
2004 Jul 22
2
Files and classes in a package?
...n methodsPackageMetaName("C", name) :
The name of the object (e.g,. a class or generic function) to find
in the meta-data must be a single string (got an object of class "NULL")
> traceback()
12: methodsPackageMetaName("C", name)
11: classMetaName(Class)
10: getClassDef(Class, where)
9: getClass(cl, TRUE)
8: .validDataPartClass(clDef, name)
7: reconcilePropertiesAndPrototype(name, slots, prototype, superClasses,
where)
6: makeClassRepresentation(Class, properties, superClasses, prototype,
package, validity, access, version, sealed, where = where)
5:...
2024 Sep 27
1
Disabling S4 primitive dispatch during method resolution affects namespace load actions
...for ?repro? in
# .doLoadActions(where, attach):
# error in load action .__A__.1 for package repro: bar$foo(): attempt
# to apply non-function
# Error in .requirePackage(package) : unable to find required package
# ?repro?
# Calls: <Anonymous> ... .findInheritedMethods -> getClass ->
# getClassDef -> .requirePackage
# Execution halted
(Here it has to be a show() call to trigger the package load, not just
dimnames().)
I have verified that the following patch prevents the failure in
loading the namespace, but which other problems could it introduce?
Index: src/library/methods/R/RClassUti...
2024 Sep 27
1
Disabling S4 primitive dispatch during method resolution affects namespace load actions
...t; # error in load action .__A__.1 for package repro: bar$foo(): attempt
> # to apply non-function
> # Error in .requirePackage(package) : unable to find required package
> # ?repro?
> # Calls: <Anonymous> ... .findInheritedMethods -> getClass ->
> # getClassDef -> .requirePackage
> # Execution halted
> (Here it has to be a show() call to trigger the package load, not just
> dimnames().)
> I have verified that the following patch prevents the failure in
> loading the namespace, but which other problems could it intro...
2015 Jan 21
2
reducing redundant work in methods package
...ion <- function(ns = asNamespace("methods")) {
>>
>> funs = c("isClassUnion", "getClass", "genericForPrimitive",
>> "possibleExtends", ".dataSlot", ".requirePackage", ".classEnv",
>> "getClassDef", "outerLabels", ".getClassFromCache", "getFunction")
>>
>> message(paste0("\nCollecting data for unit tests on ", paste(funs,
>> collapse=", "), " ...\n"))
>>
>> # Make env with list to hold test...
2004 Oct 06
1
R 2.0.0: namespaces, S4 classes & versioned package installation: failure to resolve correct pkg version
...m package:stats4_2.0.0 :
mle
>class(obj)
[1] "mle"
attr(,"package")
[1] "stats4"
as far as i could understand the problem lies in the 'package' attribute not
being set to package + version string.
In the call sequence
new -> getClass -> getClassDef: here .requirePackage(package)
is called where package is retrieved from package = packageSlot(Class)
Is this speculation correct or did I make a mistake somewhere else?
Is there any way to teach methods to look for the classes in the versioned
package in the search path?
Or is this just asking m...
2014 Nov 25
0
problem with setGroupGeneric from package methods
...doCheck = TRUE)
{
## a collection of actions performed on attach or detach
## to update class and method information.
pkg <- getPackageName(where)
classes <- getClasses(where)
for(cl in classes) {
cldef <- (if(attach) get(classMetaName(cl), where) # NOT getClassDef, it will use cache
else getClassDef(cl, searchWhere))
if(is(cldef, "classRepresentation")) {
if(attach) {
.cacheClass(cl, cldef, is(cldef, "ClassUnionRepresentation"), where)
}
else if(identical(cldef...
2015 May 04
2
Problem with adding slots to S4 object
Dear all,
I'm trying to create a virtual S4 class with some subclasses. I noticed
that adding slots to this class increases the memory use and slows the
functions down. Note that I'm adding very small slots (integer or character
both of length 1).
I've made a reproducible example at
https://github.com/ThierryO/testvirtualclass. The R CMD check --as-cran
fails on the tests.
Some of
2015 Jan 21
0
reducing redundant work in methods package
...est_data_collection <- function(ns = asNamespace("methods")) {
>
> funs = c("isClassUnion", "getClass", "genericForPrimitive",
> "possibleExtends", ".dataSlot", ".requirePackage", ".classEnv",
> "getClassDef", "outerLabels", ".getClassFromCache", "getFunction")
>
> message(paste0("\nCollecting data for unit tests on ", paste(funs,
> collapse=", "), " ...\n"))
>
> # Make env with list to hold test input/output
>
&...
2019 Sep 27
0
missing imports not detected by 'R CMD check' (?)
...## Rscript --vanilla -e 'require(methods);(M <- Matrix::Matrix(0:1,3,3)); as(M,"sparseMatrix")'
> , as, is, extends, new
> , callGeneric, callNextMethod
> , .selectSuperClasses, .slotNames, canCoerce, packageSlot
> , getClass, getClassDef, validObject
> , setClass, setClassUnion, setMethod, setOldClass
> , setValidity, slot, "slot<-", slotNames, .hasSlot
> , signature, representation, prototype)
> I see that you do not list 'setGeneric' in importFrom("methods",...
2004 Jun 18
0
Problem with setValidity() or resetClass() or ... ?
...uot;, representation("Class1"))
setClass("Class3", representation("Class2"))
setClass("Class4", representation("Class3"))
setClass("Class5", representation("Class4"))
getClass("Class3") # as I expected
Class3Def <- getClassDef("Class3", where = topenv(parent.frame()))
## the following is called in setValidity() via resetClass()
## (further explanations, see below)
completeClassDefinition("Class3", Class3Def,
where = topenv(parent.frame()), doExtends = TRUE)
## 'Extends' includs only &...
2015 May 05
1
Problem with adding slots to S4 object
...0.54 0.30 0.54 0.30
> ".inheritedArgsExpression" 0.54 0.30 0.00 0.00
> "extends" 0.54 0.30 0.00 0.00
> ".getClassFromCache" 0.08 0.04 0.08 0.04
> "getClassDef" 0.08 0.04 0.00 0.00
> "initialize" 0.08 0.04 0.00 0.00
> "new" 0.08 0.04 0.00 0.00
> "loadMethod" 0.06 0.03 0.06...
2015 May 05
0
Problem with adding slots to S4 object
...0.54 0.30 0.54 0.30
".inheritedArgsExpression" 0.54 0.30 0.00 0.00
"extends" 0.54 0.30 0.00 0.00
".getClassFromCache" 0.08 0.04 0.08 0.04
"getClassDef" 0.08 0.04 0.00 0.00
"initialize" 0.08 0.04 0.00 0.00
"new" 0.08 0.04 0.00 0.00
"loadMethod" 0.06 0.03 0.06 0.03
$sample....
2010 Feb 08
2
Error on start R in server
...ance in '{', 101 then 98
Warning: stack imbalance in 'if', 99 then 97
Warning: stack imbalance in '<-', 84 then 85
Warning: stack imbalance in '{', 82 then 84
Warning: stack imbalance in 'if', 80 then 82
Traceback:
1: .getClassFromCache(Class, where)
2: getClassDef(cl)
3: methods:::is(genfun, "genericFunction")
4: registerS3methods(nsInfo$S3methods, package, env)
5: loadNamespace(package, c(which.lib.loc, lib.loc), keep.source =
keep.source)
6: doTryCatch(return(expr), name, parentenv, handler)
7: tryCatchOne(expr, names, parentenv, handlers[[1...
2015 Jan 22
0
reducing redundant work in methods package
...on(ns = asNamespace("methods")) {
>>>
>>> funs = c("isClassUnion", "getClass", "genericForPrimitive",
>>> "possibleExtends", ".dataSlot", ".requirePackage", ".classEnv",
>>> "getClassDef", "outerLabels", ".getClassFromCache", "getFunction")
>>>
>>> message(paste0("\nCollecting data for unit tests on ", paste(funs,
>>> collapse=", "), " ...\n"))
>>>
>>> # Make env wi...
2013 Feb 05
1
S4 Classes and Initialize methods
Hello,
I am trying to improve my skill on S4 classes. But there's something
strange (to me) happening with "initialize" methods. This is probably a
normal behaviour... but... something is unclear in my mind
I declare two classes, namely "A", and "B", which has a slot of type A. The
class "A" has an initialize method. What I do not understand is that
2007 Sep 25
1
'load' does not properly add 'show' methods for classes extending 'list'
The GeneSetCollection class in the Bioconductor package GSEABase
extends 'list'
> library(GSEABase)
> showClass("GeneSetCollection")
Slots:
Name: .Data
Class: list
Extends:
Class "list", from data part
Class "vector", by class "list", distance 2
Class "AssayData", by class "list", distance 2
If I create