similar to: Testing for a reference class object

Displaying 20 results from an estimated 1000 matches similar to: "Testing for a reference class object"

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 <-
2012 Jun 19
1
Reference classes and memory consumption
Dear All, It seems that reference classes consume a lot of memory which became a problem for my rather extensive simulation. I prepared a small example. An instance of this minimal class uses about 20K on disk. rm(list=ls(all=TRUE)); MySmallClass = setRefClass("MySmallClass", fields = list( myField = "numeric" ), methods = list( initialize =
2010 Nov 23
1
Reference Classes: removing methods -> implications for objects/instances of that class
Dear list, just to make sure that I understand 'unregistering' methods for S4 reference classes correctly: If I registered a method and want to 'unregister' (i.e. remove) this method again, objects/instance created of the respective class still feature the removed method until I do an explicit reassign ('my.instance <- getRefClass("Classname")$new()'), right?
2010 Nov 17
2
Reference classes: accessor functions via 'getRefClass(...)$accessors(...)'
Hi there, I''d like to choose between an "static" and "dynamic" access of a reference class field, say ''a''. myObj <- getRefClass("Blabla")$new() Static: myObj$a Dynamic: myObj$a.get() where the function retrieves the data from a database (or some other location), stores it to a buffer and
2005 Feb 24
4
r: functions
hi all i have a function that uses two inputs, say xdata and ydata. An example is the following, simple1<-function(xdata,ydata) { ofit<-lm(ydata~xdata) list(ofit) } say i use arbitray number for xdata and ydata such that D = x1 x2 y 1 1 10 2 6 6 3 10 7 x<-D[,1:2] and y<-D[,3] if one uses these inputs and rund the program we get the following: >simple(xdata=x,ydata=y)
2011 Jun 29
1
Ref Classes: bug with using '.self' within initialize methods?
Dear list, I'm wondering if the following error I'm getting is a small bug in the Reference Class paradigm or if it makes perfect sense. When you write an explicit initialize method for a Ref Class, can you then make use of '.self' WITHIN this initialize method just as you would once an object of the class has actually been initialized? Because it seems to me that you can not.
2008 Dec 18
1
using jackknife in linear models
Hi R-experts, I want to use the jackknife function from the bootstrap package onto a linear model. I can't figure out how to do that. The manual says the following: # To jackknife functions of more complex data structures, # write theta so that its argument x # is the set of observation numbers # and simply pass as data to jackknife the vector 1,2,..n. # For example, to jackknife #
2012 Dec 27
2
Bootstrap
Hola, buenas tardes estoy intentando hacer un bootstrap de un modelo, pero me da el siguiente error: "Error in FUN(newX[, i], ...) : unused argument(s) (list(age = c(33, 47, 49, 56, 60, 64, 64, 66, 68, 69, 71, 71, 72, 73, 74, 75, 75, 76, 78, 81, 83, 83, 36, 43, 46, 47, 49, 49, 51, 51, 52, 52, 53, 54, 54, 54, 55, 56, 56, 57, 57, 58, 58, 58, 58, 59, 59, 60, 61, 62, 63, 64, 65, 65, 66, 66,
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
2008 Sep 10
3
writing simple function through script
Hi all, I try to write a simple function in a script. The script is as follows yo<-function(Xdata) { n<-length(Xdata[,1]) Lgm<-nls(formula=LgmFormula, data=Xdata, start=list(a=1500,b=0.1),weights=Xdata$Qe) return(Lgm) } After the execution of the script, when I call the function yo on data called NC60.DATA I get an error. #yo(NC60.DATA) Erreur dans eval(expr, envir, enclos)
2011 Jun 06
1
How can I write methods for 'as()'?
Dear list, I wonder how to write methods for the function 'as' in the sense that I can call 'as(object, Class, strict=TRUE, ext)' and let method dispatch figure out the correct method. AFAIU, there is a difference between, e.g. 'as.data.frame' and the methods of 'as()' as stated above since the former depends on arg 'x' instead of 'object',
2012 Oct 04
1
identical() fails to compare isS4(<S4 instance>) to TRUE
> setClass("A", "integer") > isS4(new("A")) [1] TRUE > identical(isS4(new("A")), TRUE) [1] FALSE > sessionInfo() R Under development (unstable) (2012-10-04 r60876) Platform: x86_64-unknown-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5]
2012 Sep 13
1
[LLVMdev] Parsing C++ template parameters using cindex.py
Hi, I am parsing a C++ file using cindex.py and want to get the template parameters to a specific node. However, the tree seems to be different depending on if the template parameter is a struct/class or a simple type such as int or float. In the first case the template type is appended as a child to the VAR_DECL node (the TYPE_REF node seen in the example below), but this is not the case with
2011 Feb 03
2
Creating a reference class object from a class definition in a package fails
Hi, I'm trying to create a package that contains reference class definitions from which users can create reference objects, but there seems to be something awry. My toy example creates an empty package via package.skeleton('TestClass') to which I add the following R code: TestClass <- setRefClass('TestClass',fields=c('name')) Unfortunately my R console output
2008 Jun 24
2
persp plot
I have a set of data in the form x1, y1, z1 x1, y2, z2 ... x1, yN, zN x2, y1, z(N+1) x2, y2, z(N+2) ... x2, yN, z(2N) ...and so on... xM, yN, val(M*N) I have been trying to figure out how to get R to use this data in a persp plot. So far the only thing that I can figure out to do is to break the data file into three different files. The first file contains the x-coordinate data: x1 x2
2009 Jun 25
2
Error: system is computationally singular: reciprocal condition number
I get this error while computing partial correlation. *Error in solve.default(Szz) : system is computationally singular: reciprocal condition number = 4.90109e-18* Why is it?Can anyone give me some idea ,how do i get rid it it? This is the function i use for calculating partial correlation. pcor.mat <- function(x,y,z,method="p",na.rm=T){ x <- c(x) y <- c(y)
2011 May 27
1
Reference Classes/S4 Classes: can method dispatch check superclasses BEFORE resorting to method for "ANY"?
Dear list, is it possible that method dispatch checks for superclasses/virtual classes before checking "ANY"? I'd like to build a generic initialization method for all my Reference Class (say "MyDataFrame") objects by having them inherit from class, say "MyRefClassVirtual" (which would have to be a virtual S4 class; there are no virtual Reference Classes,
2012 Feb 11
1
object not found - Can not figure out why I get this error: Error in NROW(yCoordinatesOfLines) : object 'low' not found
Hi, I have been using R for over a year now. I am a very happy user. Thank you for making this happen. This is my first question to this list. I trying to add some functions to quantmod that would enable me to draw arbitrary lines and text and make sure they are redrawn. I have created following function: require(quantmod) # Add horizontal line to graph produced by quantmod::chart_Series()
2009 May 05
2
Stepwise logistic Regression with significance testing - stepAIC
Hello R-Users,   I have one binary dependent variable and a set of independent variables (glm(formula,…,family=”binomial”) ) and I am using the function stepAIC (“MASS”) for choosing an optimal model. However I am not sure if stepAIC considers significance properties like Likelihood ratio test and Wald test (see example below).     > y <- rbinom(30,1,0.4) > x1 <- rnorm(30) > x2
2012 Aug 28
3
date in plot, can't add regression line
Hello all, I have been using R for about 3 weeks and I am frustrated by a problem. I have read R in a nutshell, scoured the internet for help but I either am not understanding examples or am missing something completely basic. Here is the problem: I want to plot data that contains dates on the x axis. Then I want to fit a line to the data. I have been unable to do it. This is an example of