Displaying 20 results from an estimated 5000 matches similar to: "setClass inside a function"
2008 May 20
1
S4 generic for lowess
Hi,
A lowess method is defined in our package for one of our S4 classes. To
explicitely define the generic this is being used
if (!isGeneric("lowess"))
setGeneric("lowess", useAsDefault = lowess)
This works fine for many other methods inherited from various R
packages. In this case a warning is issued in R CMD check:
* checking R code for possible problems ... NOTE
2008 May 28
1
Cross-compilers for 2.7.0
Hello,
Am I right in thinking the cross-compilations tools, kindly maintained
by Prof Ripley, are still waiting to be updated for 2.7.0?
Thanks,
Iago
--
Iago Mosqueira
Cefas
Systems Modelling
Pakefield Rd.
Lowestoft NR33 0HT
U.K.
+44 (0)1502 558003
2005 Feb 17
1
Subsetting using dimnames on S4 array-based class
Hello,
I did send this message to r-help and got no reply, no I am resubmitting
here in case this was a bit too specific for the other list.
Many thanks,
Iago
From:
Iago Mosqueira
<imosqueira@suk.azti.es>
To:
r-help@stat.math.ethz.ch
Subject:
Subsetting using dimnames on S4
array-based class
2009 Feb 04
1
lattice key inside panel
Hello,
I am trying to draw a key inside a single panel in a lattice xyplot. The
panel function uses panel.number() to use a slightly different style for
one of the panels. Once inside than panel I am using
draw.key(list(text=list(lab='catch'),
lines=list(lwd=c(2)),
text=list(lab='landings'),
rectangles=list(col=rgb(0.1, 0.1, 0, 0.1)),
x=0,
2006 Oct 04
1
Default argument value for "["
Dear all,
After installing R 2.4.0, a definition of "[" for an S4 class has
stopped working as the default for drop in the generic, TRUE, appears to
override the default in the method
The method is defined for demonstration purposes as
setMethod("[", signature(x="FLQuant"),
function(x, i="missing", j="missing", k="missing",
2003 Jun 23
3
FW: S4 classes, creating in C
I am using C code to create an S4 object based on Douglas Bates's example
in his lecture notes on
<http://www.ci.tuwien.ac.at/Conferences/DSC-2003/Tutorials/RExtensions/slide
s.pdf>
http://www.ci.tuwien.ac.at/Conferences/DSC-2003/Tutorials/RExtensions/slides
.pdf
e.g.
SEXP La_DGE_dc(SEXP A)
{
SEXP aa = PROTECT(duplicate(A));
SEXP adims, pivot, val;
int
2007 Oct 09
2
Package compile under Windows on 2.6.0
Dear all,
We are experiencing some trouble when compiling R packages using R
2.6.0 and the new Rtools installer under Windows XP.
(1) First, compiling any package using the new setup stops with an
errorrelated to some "/" issue on the inst folder. This folder only
contains a CITATION file
---------- Making package FLCore ------------
adding build stamp to DESCRIPTION
installing
2010 Feb 02
1
S4 setClass / initialize misunderstanding
Hi, I recently ran into this problem. I couldn't find any mention of it in
the setClass documentation.
setClass("Foo", representation(file = "character"))
setMethod("initialize", "Foo", function(.Object, file) {
print(file)
})
setClass("Bar", contains = "Foo")
And the error:
Error in print(file) : argument "file" is
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
2003 Sep 05
1
Problem with S4 slots in C code (PR#4073)
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_000_01C3738F.63DE3390
Content-Type: text/plain;
charset="iso-8859-1"
#I want to be able to create a new S4 class and read data into it using C
code
# Here is a very simple S4 object inheriting from "array", but with 5
2005 Jun 14
1
operators as S4 methods
Dear all,
I need to re-define some mathematical operators (+, *, /, etc) for an S4
class based on array. All references I have found (S Programming, Green
Book) show how to define S3 methods for this (like in page 89 of S
Programming for "-.polynomial"). What is the preferred S4 way for doing
this? I hope I haven't missed some obvious piece of documentation.
Many thanks,
Iago
2010 Mar 08
1
setClass or setValidity?
Hi,
I'm reading up on S4 classes *). There seem to be at least two ways of input validation:
setClass() (using the 'validity' argument) and setValidity(). Is it a matter of taste which function is used? Or should more complex validation code better be put in a setValiditity call?
*) A (Not So) Short Introduction to S4 Object Oriented Programming in R
V0.5.1 Christophe Genolini
2004 Jun 16
2
Loading 'akward' data file
Generally you'd use file() to open the file, then use readLines(), say
inside a while() loop to read one `chunk' at a time. However, your example
looks a bit strange. The possibility of empty line makes it a bit more
complicated, by that last couple of lines seems to suggest that you could
have a line of data follow by another line of data without variable label.
If that's true, I
2012 Apr 03
1
Create Model Object (setClass?setMethod?)
Hi all,
I have a self written likelihood as a model and functions to optimize and
get fitted values, confidence intervals ect.
I wonder if there is a way to define a 'class', or a 'model' (or a certain
object)? so that I can use 'summary' to produce a summary like it does for a
lm object.
Also, it should be able to use 'predict' and 'plot' and other
2008 May 07
1
optional setValidity()
Hi
Suppose I have an S4 class "foo" and a validity checking
function ".checkfoo()":
setClass("foo", representation=representation("numeric"))
setValidity("foo" , .checkfoo)
is fine; in my application, .checkfoo() verifies that a bunch
of necessary conditions are met.
But .checkfoo() is very time consuming and I want
to give users the option
2011 Jun 01
1
Overloading S4 methods
Dear all,
I am experiencing some problems with S4 method overloading. I have
defined a generic for graphics:plot, using
setGeneric("plot", useAsDefault = plot)
and with
importFrom('graphics', 'plot') and
exportMethods('plot') in the NAMESPACE file of pkg A.
I then proceed to define a method for signature c('myS4class',
'missing'). This works
2009 Mar 29
1
Recent setClass fails where previous succeeded
These lines of code
setClass("A", representation(x="numeric"))
setMethod(initialize, "A", function(.Object, ...) stop("oops"))
setClass("B", representation("A"))
result in
> setClass("B", representation("A"))
Error in initialize(value, ...) : oops
in
R version 2.9.0 alpha (2009-03-28 r48239)
R version 2.10.0
2003 Aug 21
2
mcmc
Hello,
I am about to move all of my modelling work into R, and I have been
investigating the present state of MCMC and Bayesian methods in R.
Following a thread on the mailing list in 2000, I have looked at
mcmcpack and Hydra. Three years down the line, is there anything new in
this area? I have used both MCSim and WinBUGS in the past. The first one
seems promising, but is too focused towards
2009 Mar 20
1
classes and methods
I have put together a test class and methods
> setClass("foo",representation(x="numeric"))
[1] "foo"
> setMethod("plot","foo",function(x,y,...)boxplot(x,...))
[1] "plot"
> x <- rnorm(100)
> class(x) <- "foo"
> plot(x)
> y <- new("foo",x=rnorm(50))
> class(y)
[1] "foo"
My
2004 Jun 21
2
Cross build Makefile
Hello,
I am trying to use Yan and Rossini's Makefile for cross building Windows
versions of R packages in Linux with R 1.9.0. When compiling R with the
mingw tools I get an error about expm1 being undeclared when first found
at src/main/arithmetic.c:1019
If I fiddle a bit with it later on I also get errors about log1p bein
undeclared.
Any idea what should I look for?
I am using R 1.9.0 in