Re: [R] Help with objects

From: Duncan Murdoch <murdoch.duncan_at_gmail.com>
Date: Mon, 25 Apr 2011 14:20:47 -0400

Russ Abbott wrote:
> Hi all,
>
> I would appreciate some help in understanding how to find out about objects.
> For example, to the extent that I understand R it seems to treat everything
> as an object even without declaring them as objects.

That's correct.

  Everything has
> attributes, for example, which are like instance variables in objects.

That's not quite true. There are a few special kinds of objects which can't have attributes. The NULL object is the only one you're likely to meet in regular code.

  In
> addition, there are S3 and S3 category objects. Is there a good
> introductory description of how these are different from standard R objects
> and how they are different from each other?

S3 and S4 are layers put on top of the regular system for handling objects. S3 objects just have a class attribute, which causes some functions to handle them specially; this is introduced in An Introduction to R, and more fully described in the R Language Definition. S4 is a more complex system, partly described in the ?Methods help topic, more completely in the references listed on that page.

Duncan Murdoch

> Also, how does one find out more about how objects are declared. For
> example, Data Mining with
> R<http://www.liaad.up.pt/~ltorgo/DataMiningWithR/code3.html>uses the
> quantmod package. I am used to Java's JavaDoc where one can see how
> classes are declared, what the instance variables and methods are, etc. I
> don't see anything similar for this package. How, for example, would one
> find out what the instance variables are in a quantmod object and what the
> methods are that are defined on quantmod objects? I know that there is the
> standard quantmod documentation, but that doesn't seem
> to distinguish between standard functions and class-based methods. Nor, as
> far as I can see, does it describe the instance variables in a quantmod
> object.
>
> Thanks.
>
> *-- Russ Abbott*
> *_____________________________________________*
> *** Professor, Computer Science*
> * California State University, Los Angeles*
>
> * Google voice: 747-*999-5105
> * blog: *http://russabbott.blogspot.com/
> vita: http://sites.google.com/site/russabbott/
> *_____________________________________________*
>
> [[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.



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. Received on Mon 25 Apr 2011 - 18:23:33 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 25 Apr 2011 - 18:40:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive