Displaying 12 results from an estimated 12 matches for "initfields".
2011 Aug 05
1
initFields() method no longer coerces arguments in R-devel
Dear all,
I've just had a package update bounced from CRAN because of a recent
change in R-devel which seems to affect the behaviour of the
initFields() reference class method. (The change must be very recent
because I tested the package on a week-old build of R-devel.) It seems
that the method no longer coerces its arguments to the expected type
of each field. For a simple example:
> Foo <- setRefClass("Foo", fields=list(number=...
2013 Mar 28
1
Ref classes initFields has incorrect environment?
As suggested by the following code:
A <- setRefClass("A", fields = list(x = "logical"),
methods = list(initialize = function(...) {
x <<- FALSE
initFields(...)
}))
A$new()
# Works as expected
quote <- as.character
A$new()
# Error in function (value) :
# invalid replacement for field ?x?, should be from class ?logical?
or a subclass (was class ?character?)
I get the same error in:
* R version 2.15.2 (2012-10-26)
* R version 2.15.3 (2013-03-01)...
2010 Oct 28
2
Reference Classes: Generalizing Reference Class Generator objects?
Is it possible to override the $new(...) in the reference class
generator? I have tried adding a "new" method to the methods of the
class, but that is obviously not correct. I have also tried adding it to
the class generator, but the class generator still uses the default
constructor.
As a simple example, this is the current interface:
TestClass <- setRefClass
2013 Apr 02
1
R 14.0, ggplot2: could not find function "initRefFields"
...a decent graphical system). This
plugin requires R 14.0 (14.2 or 15 does not work).
When I install R it gives an warning:
> library(ggplot2)
Warning message:
package ‘ggplot2’ was built under R version 2.14.2
After that, when i use gplot2:
> ggplot()+geom_bar(aes(x=factor(1),y=10))
Error in initFields(scales = scales) :
could not find function "initRefFields"
I found on internet that the solution for this problem is upgrading to a
newer version of R (and indeed, on 2.15 or 3.0 ggplot2 works fine). spss
needs 2.14.0, however.
Does anyone know a solution?
Thanks
Frans
[[alternative...
2010 Nov 21
1
Ref classes: can I register fields as I register methods?
...hat "inherit" from that class. If I
follow the usual inheritance paradigm I would have to actually define those
new "subclasses" and let them inherit from the superclass (contains
argument(, right? But can I get around that by sort of registering new
fields? Maybe with ''initFields(.)''?
Thanks for any info on that,
Janko
##### SYSTEM INFO #####
Windows XP SP3
R 2.12.0
Eclipse 3.6.1 (Helios)
StatET 0.9.1
#####################
[[alternative HTML version deleted]]
2011 May 04
1
General "nil" reference class object
...it would be better to have a value specifically
designed for this purpose.
> nilObject <- Foo$new()
> is.nilObject <- function (x) identical(x,nilObject)
> Bar <- setRefClass("Bar", fields=list(foo="Foo"), methods=list(
+ initialize=function (foo=nilObject) { initFields(foo=foo) }))
> is.nilObject(Bar$new()$foo)
[1] TRUE
Is there already something like this that I'm not aware of? If not,
would it be possible and generally desirable to create it?
All the best,
Jon
--
Jonathan D Clayden, PhD
Lecturer in Neuroimaging and Biophysics
Imaging and Biophysics U...
2012 Nov 08
1
Dabbling with R5 setRefClass - Inheritance problems
...like so:
> rcfdpsuperclass <- setRefClass(
> Class="rcfdpsuperclass",
> fields = list(
> RcfpdVersion = "character"),
> methods = list(
> initialize = function(){
> 'Populates fields with defaults and lock as appropriate'
> initFields(
> RcfpdVersion = as.character(packageVersion("RCFPD")))
> lockBinding(sym="RcfpdVersion",env=.self)
> }))
And a second one like this:
> sequencesuperclass <- setRefClass(
> Class="sequencesuperclass",
> fields = list(
>...
2011 Jun 01
1
possibly invalid assertion in setRefClass?
> setRefClass("Foo", fields = list())
Error in setRefClass("Foo", fields = list()) :
A list argument for fields must have nonempty names for all the fields
In my opinion, the above should not fail. There are no fields.
Thanks,
Michael
[[alternative HTML version deleted]]
2012 Jun 25
1
Very simple question R5 setRefClass and Initialize
Hi,
New to this list, and glad I found R5 which si a great improvement to R
for my work.
Something seems odd anyway, when I do a setRefClass, the initialize
method execute at the class definition.
I would like it to execute only when an instance is created.
How can I do that? I found no way to test if the code execution is when
the class definition happens or when a $new instance is created.
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
2011 Oct 31
1
Question about copying reference objects using the initialize method
Dears,
I have a question about copying reference objects using the initialize method.
1) If the latter has no arguments, there is no problem to copy an object.
myClass = setRefClass("myClass", fields = list(value = "numeric") )
myClass$methods(initialize = function(...){
? value <<- 1
? callSuper(...)
})
newObject = myClass$new()
newObject$value = 2
copyObject =
2016 Jan 18
2
Segmentation Fault Asterisk 13.7.0-rc2 (libmysqlclient?)
Hi everyone,
I am getting a segmentation fault (seems to occur randomly) using Asterisk 13.7.0-rc2 with PJProject 2.4.5. It appears to be something that libmysqlclient is complaining about when doing a query in ps_endpoint_id_ips. We are using Asterisk Realtime. This also seems to occur in Asterisk 13.5.0.
Below is a backtrace that might help a little. I have looked through the change log for