Dear help, 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 with :
length(edits) <<- length(edits) - 1 #(and not - 2)
- and for coherence, 'edit' should store modifications in an 'append'-style :
edits <<- c(edits,list(backup)) #as opposed to c(list(backup),edits)
I hope I'm not wrong.
As a complementary question, suppose one kept 'c(edits,list(backup))', does
anyone know how todiscard first element(s) of a list? For a vector :
vedits<<-vedits[-1]
But lists can't be selected that way ( edits<<- edits [[-1]] #wrong )
Bye.
Marc
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.