similar to: initalizing and checking validity of S4 classes

Displaying 20 results from an estimated 3000 matches similar to: "initalizing and checking validity of S4 classes"

2009 May 18
1
S4 method dispatch and namespaces: why is default method selected
Hi, I ran into the following peculiarity involving S4 method dispatch and namespaces. I develop a package which have a namespace and which depends on 'pixmap' package, which itself does not have a namespace. Now, in my package I have a class which has a slot for objects from class "pixmap" and I want to have a "plot" method for this new class. Not to clutter the
2003 Nov 19
2
Was: setValidity and "initialize" method conflict ? [in R-help]
Hello, Thomas Stabla (statho3@web.de) has already sent this question to R-help, Wed, 12 Nov 2003 21:21:31 +0100, but we are not sure whether we should better post this mail to this audience than to R-help: --------------------------------------------------------------------- We are using S4-classes and want to force a validity check when an object is created. How can this be done, when an
2008 Aug 26
1
Dramatic slowdown of R 2.7.2?
Dear R users/developers, simple comparison of code execution time of R 2.7.1 and R 2.7.2 shows a dramatic slowdown of the newer version. Rprof() identifies .Call function as a main cause (see the code below). What happened with R 2.7.2? Kind regards Marek Wielgosz Bayes Consulting ######### Probably useful info ############### ### CPU: Core2Duo T 7300, 2 GB RAM ### WIN XP ### both standard
2007 Mar 13
3
inconsistent behaviour of add1 and drop1 with a weighted linear model
Dear R Help, I have noticed some inconsistent behaviour of add1 and drop1 with a weighted linear model, which affects the interpretation of the results. I have these data to fit with a linear model, I want to weight them by the relative size of the geographical areas they represent. _________________________________________________________________________________________ > example
2007 Mar 31
1
Problem with S4 inheritance: unexpected re-initialization?
Dear all, To explain my problem I am attaching a demonstration package "myclasspkg": I have the following two S4 classes with similar inheritance: SubSubClassA <- SubClassB <- BaseClass SubSubClassB <- SubClassB <- BaseClass In R I am calling the following functions: > library(myclasspkg) > subA <-
2003 Mar 17
1
What does is() mean?
Suppose you have a class, say sex, for lack of a better example, and you are tempted, in defining the behavior of the call, is(x,"sex") to check whether certain basic features are satisfied, not to just trust the claim that x is specified to be of class "sex". `Without delving into details further sanity checking of the structure of the object is sometimes prudent to avoid
2007 Apr 29
1
[debug] package - Error in all.levs (PR#9638)
Dear All, I encountered the following problem: fun1 <- function(x){ 2*cos(x) } >library(debug) > mtrace(fun1) > fun1(0.1) Error in all.levs[[j]] : subscript out of bounds > sessionInfo() R version 2.5.0 (2007-04-23) i386-pc-mingw32 locale: LC_COLLATE=Polish_Poland.1250;LC_CTYPE=Polish_Poland.1250; LC_MONETARY=Polish_Poland.1250;LC_NUMERIC=C;LC_TIME=Polish_Poland.1250 attached
2009 Jul 09
1
How to: initialize, setValidity, copy-constructor
Hello list, I'm having troubles setting up a basic calss hierarchy with S4. Here is a simplified schema of what I'd like to do: - Two classes: A and B that extends A - Ensure that the slots added by B are consistent with the slots of A - Let A initialize itself (I'm not supposed to know the internal cooking of A) - By default set the slots of B based on the slots that A initialized
2007 Mar 08
1
Searching and deleting elements of list
Hi, I have a problem. Please, look at example and try to help me!! > A<-c("aaa","bbb","ccc","ddd","eee") > B<-c("vvv","ooo","aaa","eee","zzz","bbb") > C<-c("sss","jjj","ppp","ddd") > D<-c("bbb","ccc")
2007 Dec 23
1
Problem with initialize of S4 classes
Dear all Below is the code for "scriptPreFilter.R" which gives the following result: > source("scriptPreFilter.R") > prefltr <- new("PreFilter", mad=c(0.5,0.01)) [1] "------initialize:PreFilter------" [1] "------initialize:Filter------" > str(prefltr) Formal class 'PreFilter' [package ".GlobalEnv"] with 2 slots
2009 Oct 26
1
Why 'validity' is not called? (S4)
I thought that 'validity' defined in 'setClass' should be called in 'new'. Could somebody let me know why 'validity' is not called? How to make it be called? > setClass( + Class='A', + representation=representation( + x='numeric' + ), + validity=function(object){ + cat("~~~ A: inspector ~~~\n") +
2008 Feb 29
1
Problems initializing an extended S4 class
Hi all, I am having trouble extending S4 classes in cases where I'm using both validity and initialize methods. I've read as much S4 information as I can find, but I've yet to have that "a-ha" moment. In my application, I am using validity methods to guard against inappropriate input data that my code has no way of handling, and initialize methods to detect and deal
2008 Jan 22
1
deparse, substitute and S4 generics
Hello everyone, I encountered the following confusing behavior of 'deparse' and 'substitute' while programming with S4 classes (see example below). It seems like the presence of '...' argument in the definition of the generic generates the problem. I have no clue why, can anyone explain that to me? Are there any "workarounds"? Thanks a lot for your time!
2007 Mar 04
1
Problem using callNextMethod() in S4
Dear all, Maybe, I am doing something wrong, but using R-2.5.0 on my Intel-Mac, I have problems using function callNextMethod() in method initialize. I am loading the following code as file "testS4.R": setClass("baseClass", representation(myname = "character", mydir = "character", "VIRTUAL"),
2007 Jan 25
1
using non-ASCII strings in R packages
Hello dear useRs and wizaRds, I am currently developing a package that will enable to use administrative map of Poland in R plots. Among other things I wanted to include region names in proper Polish language so that they can be used in creating graphics etc. I am working on Windows and when I build the package it is complaining about non-ASCII characters R code files. I was wondering what would
2006 Jun 23
2
problem with hist() for 'times' objects from 'chron' package
Hello dear useRs and wizaRds, I encountered the following problem using the hist() method for the 'times' classes from package 'chron'. You should be able to recreate it using the code: library(chron) # pasted from chron help file (?chron) dts <- dates(c("02/27/92", "02/27/92", "01/14/92", "02/28/92", "02/01/92")) class(dts)
2006 Mar 04
2
convert string to AR class
Hi everyone, I''m trying to convert a string passed on the command-line into an ActiveRecord class, so I can do something like this. a="SomeClass" a.find(:all) where class SomeClass < ActiveRecord::Base end This appears to work (better ways would be appreciated): a="SomeClass" b=eval a b.find(:all) However I would like to make sure
2012 Jan 10
1
Can "prototype" and "initialize" coexist?
Folks, My object oriented background is in Java and C++. I am a novice to using S4/object-oriented coding in R but not to R. Below is an example that I found that I have expanded on. I am not getting how "prototype" and "initialize" work together, if at all. Here is output from a short "session" > setClass("xx", +
2006 Sep 27
1
acts_as_taggable with single-table inheritance?
Does anyone have any experience making this work? I installed the plugin and tried the following: class SomeClass < ActiveRecord::Base acts_as_Taggable end class SubClass1 < SomeClass end class SubClass2 < SomeClass end SubClass1.tag_with("tag") and notice that taggable_type = SomeClass when I do SubClass2.find_tagged_with("tag") a SubClass1 object is
2010 Apr 21
1
VERY basic question about S4 classes
Hi,   I'm new to R and S4 classes. I defined a class with two methods (myMethod1 and myMethod2). I want to call myMethod1 within myMethod2. Why does the code below not work? The name 'myMethod1' doesn't appear to have meaning inside myMethod2, even though the two methods belong to the same class.     setClass(Class="SomeClass",      representation=representation(