Displaying 20 results from an estimated 3000 matches similar to: "ReferenceClasses examples {method}"
2011 Jan 28
1
ReferenceClasses examples {method}
Dear r-devel-list, dear John Chambers,
I'm trying to learn OOP-possibilities in R and I was going through the
documentation 'ReferenceClasses {methods}' (great work, by the way...).
Reading associated Examples, something bothers me : it seems to me that there
are errors in 'edit' and 'undo' methods. I think that :
- 'undo' should update 'edits' field
2012 Oct 27
2
Class generator functions for reference classes
As of rev. 61035 in r-devel, setRefClass() now returns a generator
function, as setClass() has done since 2.15.0.
The convenient style is now:
mEdit <- setRefClass("mEdit",......)
xx <- mEdit(data = xMat)
instead of
xx <- mEdit$new(data = xMat)
The returned object still has fields and methods accessible as before.
See the "Value" and "Reference Class
2011 Jun 04
2
Interfacing a C++ class
Hello
Apologies for cross-posting, the discussion should (if) go to R-devel, but I also want to reach the rcpp-devel people.
My C++ class FOO is a module available through Rcpp, and it works fine and is -- so far -- bug free. With trying to further develop my R package, I thought it was a good idea to interface my C++ workhorse FOO with an S4 class Foo. After some long and not always insightful
2012 May 15
1
Object-oriented programming (OOP)
Hello everybody, please excuse my bad English. I am Alfredo Naime and
I'm from to Venezuela.
I want to make a lib with tools for simulation (queues, inventories,
factory, etc.) using object-oriented programming (OOP).
You have any manuals on the handling of data types, classes,
inheritance, etc. in R with examples and how to make a R lib.
Thank you, very much.
Alfredo
2005 May 04
1
error with the function GOHyperG from GOstats package
I am running R 2.0.0, GOstats 1.1.1 and GO 1.7.0,
and when I use the function GOHyperG, I have the following error:
w1<-as.list(hgu95av2LOCUSID)
w2<-unique(unlist(w1))
set.seed(123)
myLL<-sample(w2,100)
xx <- GOHyperG(myLL)
Error in mget(x, env = GOTERM, ifnotfound = NA) :
recursive default argument reference
In fact first I tried this function with my locusId ' list (with
2010 May 19
1
Nomogram with multiple interactions (package rms)
Dear list,
I'm facing the following problem :
A cox model with my sex variable interacting with several continuous variables : cph(S~sex*(x1+x2+x3))
And I'd like to make a nomogram. I know it's a bit tricky and one mights argue that nomogram is not a good a choice...
I could use the parameter interact=list(sex=("male","female"),x1=c(a,b,c))... but with rcs or pol
2013 Mar 01
1
S4-classes: Assignment of values to slots by reference
Dear R-users,
I am working on a project that uses S4-classes. At some point I encountered the problem - well known to R - that I have to pass 3 different objects to a function, that should modify several slots of them and of course there is no passing by reference in R.
Then I read this thread by Steve Lianoglou: https://stat.ethz.ch/pipermail/r-help/2010-August/250468.html, which offers from
2005 Jan 20
1
ROracle error
I am running R 2.0.0 on a SunOs 5.9 machine and using Oracle 8i.1.7.0.0 (enterprise edition)
and when I try to load ROracle I receive the following error:
"require(ROracle)
Loading required package: ROracle
Loading required package: DBI
Error in dyn.load(x, as.logical(local), as.logical(now)) :
unable to load shared library
2011 Apr 07
2
How to debug reference classes?
How do you debug methods of a reference class? I've been using mtrace, which
is excellent, but i cannot figure out how to mtrace a reference class
method. Maybe there is some other way to debug these, for example with
ordinary trace? for now i am only able to use options(error=recover), which
is not giving me idea where exactly in the code i am once i am stopped on an
error.
--
View this
2011 Apr 06
2
S4 generic functions/methods vs enclosures
Apologies for asking something that is probably very obvious, i just started
with S4 classes and i guess i am not finding documentation that lays out the
grammar rules and gives enough examples.
I understand that main method of writing a member function is to write a
generic function and setMethod for this particular class. This, however,
presumes that there is "virtuality" for this
2009 Oct 08
1
"ask=F" option with plot.gam
Hello.
I'd like to plot only one component smooth function of a gam model (for example the second) (library mgcv). So, I did :
plot(my.gam, select=2, ask=F)
But plot.gam doesn't seem to understand the "ask" option, so I can't deactivate the interactive plotting. I tried and failed by forcing it through :
par(ask=F)
And the "page" option of plot.gam (automatic
2011 Dec 30
0
testthat 0.6
# testthat
Testing your code is normally painful and boring. `testthat` tries to
make testing as fun as possible, so that you get a visceral
satisfaction from writing tests. Testing should be fun, not a drag, so
you do it all the time. To make that happen, `testthat`:
* Provides functions that make it easy to describe what you expect a
function to do, including catching errors, warnings and
2011 Dec 30
0
testthat 0.6
# testthat
Testing your code is normally painful and boring. `testthat` tries to
make testing as fun as possible, so that you get a visceral
satisfaction from writing tests. Testing should be fun, not a drag, so
you do it all the time. To make that happen, `testthat`:
* Provides functions that make it easy to describe what you expect a
function to do, including catching errors, warnings and
2010 Oct 15
0
R 2.12.0 is released
I've rolled up R-2.12.0.tar.gz a short while ago. This is a development
release which contains a number of new features.
Also, a number of mostly minor bugs have been fixed. See the full list
of changes below.
You can get it from
http://cran.r-project.org/src/base/R-2/R-2.12.0.tar.gz
or wait for it to be mirrored at a CRAN site nearer to you.
Binaries for various platforms will appear in
2010 Oct 15
0
R 2.12.0 is released
I've rolled up R-2.12.0.tar.gz a short while ago. This is a development
release which contains a number of new features.
Also, a number of mostly minor bugs have been fixed. See the full list
of changes below.
You can get it from
http://cran.r-project.org/src/base/R-2/R-2.12.0.tar.gz
or wait for it to be mirrored at a CRAN site nearer to you.
Binaries for various platforms will appear in
2010 May 04
1
aregImpute (Hmisc package) : error in matxv(X, xcof)...
Dear r-help list,
I'm trying to use multiple imputation for my MSc thesis.
Having good exemples using the Hmisc package, I tried the aregImpute function. But with my own dataset, I have the following error :
Erreur dans matxv(X, xcof) : columns in a (51) must be <= length of b (50)
De plus : Warning message:
In f$xcoef[, 1] * f$xcenter :
la taille d'un objet plus long n'est pas
2011 Jun 06
1
Reference Classes: shortcut like 'isS4' for Ref Classes?
Dear list,
is there a shortcut-function to check whether a class is a Reference
Class or not? There's something like this for S4 classes
('isS4(object)'), but I couldn't find anything regarding Ref Classes.
Currently, I'm doing it this way, which is a bit clumsy:
A <- setRefClass("A", fields=list(X="numeric"))
a <- A$new()
isRefClass <-
2011 Jun 03
2
S4 Slot assignment within function
Is there a simple way to assign values to S4 slots from within a function?
Doing this doesn't work:
> assign_slot<-function(x){
assign("OBJECT at slot",x,envir=parent.env(environment())
}
>assign_slot(x)
All I get from this is a new object with the name OBJECT at slot, the slot
assignment of OBJECT doesn't change.
I have thought about solutions such as
2012 Feb 21
1
Private Variables in R5-Classes possible?
Hi list,
is there a way to define some kind of private Variable?
I would like to prevent the user from manipulating fields on his own, in
order to not destroy data structures.
The problem is, that as soon as the variable exists in the environment
it is accessible via t$secret_value.
test <- setRefClass("test", fields=list(
secret = function(value){
cat("the function was
2011 Jul 11
1
Spectral Coherence
Greetings,
I would like to estimate a spectral coherence between
two timeseries. The stats : spectrum() returns a coh matrix
which estimates coherence (squared).
A basic test which from which i expect near-zero coherence:
x = rnorm(500)
y = rnorm(500)
xts = ts(x, frequency = 10)
yts = ts(y, frequency = 10)
gxy = spectrum( cbind( xts, yts ) )
plot( gxy $ freq, gxy $