An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130215/73374b8f/attachment.pl>
Iterating through slots of an S4 object
2 messages · Scott Robinson, Duncan Murdoch
On 13-02-15 6:14 PM, Scott Robinson wrote:
I want to loop through slots of an S4 object and am unsure how to do so since the only way I can find to access them is individually in the form 'object at slotName'. I have guessed at a few possibilities which did not work and I have read some S4 object tutorials and things but still unsuccessful.
See ?slotNames. For example,
for (slot in slotNames(x)) {
cat(slot, ":\n")
print(slot(x, slot))
}
Duncan Murdoch
I presume it is possible though? Any help would be much appreciated, Scott [[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org 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.