To add to what David said ...

Of course, there are already S3 "getters" and "setters" methods for data
frames ("[.data.frame" and "[<-.data.frame" )*. These could clearly be
extended -- i.e. the data.frame class could be extended and appropriate S3
methods written. Whether you use S3 or S4 depends on the degree of control,
type checking, reuse etc. you want/need. David's suggestion to look at
Bioconductor is a good one.
Cheers,
Bert
*If you are unfamiliar with the S3 extract methods, consult the R Language
Definition Manual.

On Fri, Aug 31, 2012 at 8:14 AM, David Winsemius <dwinsem...@comcast.net>wrote:

>
> On Aug 31, 2012, at 5:57 AM, Ramiro Barrantes wrote:
>
> > Hello,
> >
> > I have again a "good practices"/programming theory question regarding
> data.frames.
> >
> > One of the fundamental objects that I use is the data frame with a
> particular set of columns that I would fill or get information from, and an
> entire system would revolve around getting information from or putting
> information to such data.frame.
> >
> > On a different OOP programming language I would be tempted to create a
> class that would "wrap-around" that data.frame and create "getters" and
> "setters" methods that would return whatever information I need. I started
> doing that using S4.
> >
> > Does anyone have examples of packages that use that approach or any
> suggestions?  It just seems to me that a class/object would be a better
> idea because it would create a single, hopefully well validated way to
> access information and edit the fundamental data.frame object, which would
> be helpful if there are several programmers on the team and/or if some of
> the data.frame manipulations are not straightforward and are best left
> encapsulated in a method of a class, and then have people use that method.
>  I would just like to know if there are reasons not do it that way and if
> there are any examples of packages that use that approach and that I can
> learn from.
>
> You could argue that the entire BioConductor project represents such an
> effort. It makes extensive use of S4 methods. I'm not a user so cannot
> readily point to examples of S4 functions that have set. and get. methods
> for particular sorts of dataframes, but I suspect you can pose the same
> question on the BioC mailing list and get a more informed answer.
>
> --
> David Winsemius, MD
> Alameda, CA, USA
>
> ______________________________________________
> R-help@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.
>



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to