Displaying 20 results from an estimated 7000 matches similar to: "Reference classes"
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
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
2010 Nov 21
1
reference classes: question on inheritance
Dear list,
I have a reference class which should act as a "generic" superclass for
other classes. I've read the respective section at ?setRefClass and put the
name of the superclass to the 'contains' argument of an example subclass
(see class defs below). Classnames are set in a way that shouldn't result in
collation issues (virtual def sourced before superclass def
2011 Dec 08
1
Reference class finalize() fails with 'attempt to apply non-function'
This bug appears intermittently in R CMD check when reference classes
have finalize methods. The problem is that garbage collection can be run
after the methods package is no longer available. It affects
(periodically) the Bioconductor AnnotationDbi package as well as
packages that contain Rcpp classes. To reproduce:
library(methods)
a = setRefClass("A",
2012 Aug 05
1
setting invalid fields on reference classes sometimes allowed
I've found that reference class objects tend to behave like plain old
environments wrt field access, unless a method on e.g. $<- is explicitly
defined.
Here is a code snippet:
library(methods)
Foo <- setRefClass("Foo")
foo <- Foo$new()
foo$a <- 2 # why does this succeed? not a valid field!
## set a silly $<- method
setReplaceMethod("$", "Foo",
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 =
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,
2007 Jun 12
1
Route Regex Requirement not working properly
I''m trying to get my routes to work properly. Here''s how I''m defining
one of my routes:
map.downloads '':category/downloads'', :controller => ''downloads'', :action
=> ''list_downloads_for_category'', :requirements => {:category =>
DownloadableFileCategory.category_regex}
And here''s the method
2003 Oct 01
1
PATCH: option to ignore case in filenames
I have two DOS filesystems mounted on Linux as "vfat" which I want to rsync.
(They are on flash cards, so that they are also small). rsync gets tricked
because the filesystem treats names differing in only case as the same.
Thus, when it tries to sync "FOO123" with "foO123", it copies over the
"new" file, and then renames it over the old one (which it
2006 Mar 17
1
Autocompleter.Local problem/desparate plea for help...
I have been trying to write a selector function for Autocompleter.Local that
will show a predefined Array and will scroll automatically to the first
match. I have had success with with getting my list to populate and show
all of the choices, however I cannot get it to scroll to the first match.
Since I build the JS Array I can know exactly how many items are in the list
going into my selector,
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 =
2011 May 04
1
General "nil" reference class object
Dear John and others,
I've been wondering about whether there's any way to indicate a "nil"
reference class object, which will represent "no value", and be tested
for, but not fail the internal type checking. NULL is the obvious
choice (or seems so to me), but can only be used if an explicit class
union is created:
> Foo <- setRefClass("Foo")
> Bar
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 May 04
1
Reference Classes: replacing '.self' with an .Rda image of '.self' from within a method? (was replacing '.self' with an .Rda image of '.self' from within a method?)
Sorry guys,
but I chose a really stupid name before (no "reference classes").
Hope it's okay to re-post.
Cheers,
Janko
>>> ORIGINAL MESSAGE <<<
Dear list,
Is it possible to update or reassign '.self' with an image of '.self'
(e.g. a locally stored .Rda file) from within a method?
I know that this might sound akward, but here's the use
2018 Dec 08
2
Solr
After some testsing, I managed to get proper functionning
- The schema.xml is attached below (quite different from the one
provided on teh wiki) (in bold the core differences) (NGramFilterFactory
is the class that replace the fts_squat "partial=3 full=15", everything
else is just a big hammer to smash a tiny fly)
- One need to remove the "managed-schema" file in the
2018 Dec 15
2
Solr
here my latest schema.xml (remove the "long" type hich seems to be very
deprecated in 7.x)
<?xml version="1.0" encoding="UTF-8"?>
<schema name="dovecot" version="2.0">
<uniqueKey>id</uniqueKey>
<types>
<fieldType name="string" class="solr.StrField" />
<fieldType name="gjlong"
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 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
2011 Apr 30
1
Reference Classes: Accessing methods via [[...]], bug?
I've been trying to use methods for reference classes via the notation "[[...]]" (X[["doSomething"]] rather than X$doSomething), but it failed to work. However, I did find that if you use the usual "$" notation first, "[[...]]" can be used afterwards. The following simple example illustrates the point:
> setRefClass("Number", + fields =
2011 Dec 07
1
Possible bug in 'new()' for Reference Classes
Dear list,
I think I stumbled across a little bug with respect to the standard
initialization routine for Reference Classes.
It seems that a field 'self' is treated as if it's name would be '.self'
(which we know is reserved for the self reference of the instantiated
object itself) and thus an error is thrown.
If the field value is assigned in an explicit call after the