Hello,
I don't manage to see if you have already focussed on this point in some
previous messages so I post my question:
I have a little problem with the S4 style of programming.
I tried to formalize my question: please consider the following example
that you can run I think:
#------------------
setClass("my.class1",
representation(
my.list = "list"),
prototype=prototype(
my.list =list()))
#------------------
setClass("my.class2",
representation(
my.slot = "numeric"),
prototype=prototype(
my.slot =as.numeric(1:10)))
#------------------
a.class <- new("my.class1")
[EMAIL PROTECTED] <- new("my.class2")
[EMAIL PROTECTED] <- new("my.class2")
using indexation, using my class definitions, how could I avoid the
following FOR-loop (for performance purpose if it changes something) to
get straightforward for example result = c(1:10,1:10) ?
result <-NULL
for (i in 1:length([EMAIL PROTECTED]))
{
result <- c(result, [EMAIL PROTECTED]@my.slot)
}
this following code doesn't work:
[EMAIL PROTECTED]:[EMAIL PROTECTED]
I hope I have been clear,
Thank you,
Regards,
--
--------------------------------------------------------
François Bastardie
French Research Institute for the Development of the Sea (IFREMER)
Ecologie et Modèles pour l'Halieutique
Rue de l'Ile d'Yeu
BP 21105
44311 NANTES Cedex 03 - France
Tél : 02 40 37 41 64
Fax : 02 40 37 40 75
E-mail : [EMAIL PROTECTED]
______________________________________________
[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