Displaying 20 results from an estimated 5000 matches similar to: "Testing for S4 objects"
2006 Sep 21
1
Package dependencies and imports
Dear list members,
I'm encountering the following problem with package dependencies and
imports:
The Rcmdr package doesn't declare a formal dependency (via depends or
suggests in the package DESCRIPTION) on the rgl package because the latter
apparently causes problems on some systems. This allows the Rcmdr package to
build and check on systems without rgl present; if rgl isn't
2005 Jan 18
1
"Attach" for S4 objects?
When passing a list as an argument to a function, I find it convenient
to attach it in the first line of th function code, then refer to the
components as A, B, etc. rather than as list$A, list$B, etc.
If I pass a S4 class object, is there a way to "attach" it, or do I have
to refer to the slots as object at A, objetc at B, etc.?
I could always make copies,
A <- object at A
2008 Mar 15
1
length of S4
Hi the list,
With basic type, length gives the length of the vector
Wtih list, length gives the number of item
With S4 object, length gives...one. Even with an objet with empty slot.
setClass("E",representation(e="numeric"))
[1] "E"
length(new("E"))
[1] 1
setClass("E",representation(e="matrix"))
[1] "E"
2008 Nov 20
1
How to convert S4 class slots into data.frame or how to assign variables of type 'Date'
Hi,
I created a class (S4) with some slots like value, date, description
(it's actually a financial transaction class). Now I need a method to
convert this class forth and back into a single row data.frame, where
every slots represents a column. This method looks at the moment like
this:
> setMethod("as.data.frame", "Transaction",
function(x, row.names =
2010 Apr 24
3
S4 Inheritance of environments
I looked through the documentation and the mailing lists and could not
find an answer to this. My apologies if it has already been answered.
If it has, a pointer to the relevant discussion would be greatly
appreciated.
Creating S4 classes containing environments exhibits unexpected
behavior/features.? These have a different in two ways:
1) slotName for the data: ".xData" instead of
2011 Jun 04
1
S4 class, passing argument names to function, modify original
Hello, an S4 class "Foo" is defined with a setter, $. For several reasons, the setter calls a function, .foo.update(). However, bypassing the argument names of the setter does not work. Question 1: Why not and how can I fix this? Question 2: What is the way to define either the function or the setter to modify the original object (not returning the modified copy of it an overwrite the
2006 Apr 29
0
R-News submission
Dear Roman,
I've attached the latex file for the copy-edited version of your manuscript
-- correcting English grammar and style, and making the paper conform more
closely to the R News style. Can you check this over to confirm that I've
not altered the meaning of your text and to approve the copy-edits?
Thanks,
John
--------------------------------
John Fox
Department of Sociology
2005 Dec 04
0
FW: Error in structural equation model - "The model hasnegativedegrees of freedom"
Dear R-help list members,
I forgot to copy my reply to the r-help list. Here's most of it.
John
--------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox
--------------------------------
-----Original Message-----
From: John Fox [mailto:jfox at mcmaster.ca]
Sent: Sunday,
2009 Jun 18
1
validObject throws non-caught error when slot doesn't exist
I have been retooling an S4 class definition to include another slot and
have found that the methods::validObject function (defined in
methods/R/SClasses.R) in R-devel throws an error that isn't caught
internally (and thus not controllable by 'test' argument) when
retrieving a non-existent slot. The offending line of code is shown below:
> validObject
function (object, test =
2009 Aug 17
2
S4: inheritance of validity methods?
Dear Developers,
In current implementation of validity method, objects are first coerced to
superclass (slots are striped). Thus, it is not possible to write validity
method which would perform some checks on children slots.
Say, I want to check if number of slots in a class is equal to "n":
setClass("A", representation(a="numeric", n="integer"),
2005 Jul 20
0
Internationalization of the Rcmdr package
Dear r-devel list members,
I've prepared a version of the Rcmdr package that uses the new tools for
internationalization and localization in R 2.1.x. For the present, this is
the development version of the Rcmdr package (1.1-0), available at
<http://socserv.socsci.mcmaster.ca/jfox/Misc/Rcmdr/index.html>. There is
currently a French translation provided with the package, courtesy of
2008 Jan 23
0
pseudo dataframes with RODBC
Dear R-devel list members,
For several years, I've maintained for my private use and for demonstrations
a set of functions [e.g., for indexing, with(), summary(), etc.] that employ
the RODBC package and a database to provide a "pseudo" data frame. Row
"indexes" can be specified as SQL queries. I know that the idea isn't
original, and I haven't done anything with
2005 Apr 16
0
Version 1.0-0 of the Rcmdr package
Dear list members,
I've just uploaded version 1.0-0 of the Rcmdr package to CRAN. For people
who haven't seen the package before, the "R Commander" provides a
basic-statistics graphical user interface to R, based on the tcltk package.
The new version incorporates a number of improvements to the R Commander
interface, as documented in the CHANGES file distributed with the
2005 Apr 16
0
Version 1.0-0 of the Rcmdr package
Dear list members,
I've just uploaded version 1.0-0 of the Rcmdr package to CRAN. For people
who haven't seen the package before, the "R Commander" provides a
basic-statistics graphical user interface to R, based on the tcltk package.
The new version incorporates a number of improvements to the R Commander
interface, as documented in the CHANGES file distributed with the
2011 Aug 09
2
S4 classes, some help with the basics
Hi All,
I have tried to find an answer within documentation, but I cannot:
o How can call a class "slot" without knowing the name a priori?
E.g., let's say I use the "pcaMethods" library to create a "pcaRes"
object. How can I call parts of that object without using the specific
names of the object in the call?
example code:
library(pcaMethods)
2013 Feb 15
1
Iterating through slots of an S4 object
I want to loop through slots of an S4 object and am unsure how to do so
since the only way I can find to access them is individually in the form
'object@slotName'. I have guessed at a few possibilities which did not work
and I have read some S4 object tutorials and things but still unsuccessful.
I presume it is possible though?
Any help would be much appreciated,
Scott
[[alternative
2009 Jan 23
1
"for" loop wiht S4 Objects
Hi all,
I'm working with the S4-Class system and I have a little problem with
Implementing iteration functionality in my S4 class but it don't work:
> setClass("foo",representation(bar="list"))
> x <- new("foo",bar=list(1,2,3))
>for(e in x) cat(e)
invalid type/length (S4/1) in vector allocation
But when I extend from a
2004 Nov 23
2
Convergence problem in GLMM
Dear list members,
In re-running with GLMM() from the lme4 package a generalized-linear mixed
model that I had previously fit with glmmPQL() from MASS, I'm getting a
warning of a convergence failure, even when I set the method argument of
GLMM() to "PQL":
> bang.mod.1 <- glmmPQL(contraception ~ as.factor(children) + cage + urban,
+ random=~as.factor(children) + cage +
2015 May 28
3
S4 inheritance and old class
Hey everyone,
I would like to develop a package using S4 classes.
I have to define several S4 classes that inherits from each others as
follow:
# A <- B <- C <- D
I also would like to define .DollarNames methods for these class so, if I
have understood well, I also have to define an old class as follow:
# AOld <- A <- B <- C <- D
setOldClass(Classes = "AOld")
2006 Feb 20
0
changes in r-devel for S3/S4 objects
Two recent changes have been committed to r-devel, related to
discussions on this list earlier:
1. setOldClass() has an argument prototype= to specify the default
object for the class. If provided, the S3 class can be a slot in an S4
class, with a valid default object.
(It's still not going to work well to have an S3 non-virtual class as a
superclass of an S4 class. See the