R-Fellow Travellers: Asked from the perspective of a software development amateur ... Suppose one wishes to create data structures that have both data and metadata -- e.g. a data.frame and details about where, when, and by whom the data were gathered (specifics not important here). 1. Is there any inherent processing advantage in R in representing this as a list that contains both the data and metadata as components vs as a data.frame with the metadata as attributes? 2. Is there a compelling software architecture argument to favor one vs the other? I suspect the answer is no in both cases, but I thought I'd ask. This seems to be mainly relevant for S3 programming, as in S4 one might stick the info into different slots (if one wishes to dispatch on them). Cheers to all, Bert Gunter Genentech [[alternative HTML version deleted]]
The key difference is inheritance. Objects consisting of data frames with attributes, including a class attribute such as c("myclass", "data.frame), can inherit data frame methods but a list with a data frame component will require entirely new methods to be constructed for everything. On Wed, May 14, 2008 at 2:15 PM, Bert Gunter <gunter.berton at gene.com> wrote:> R-Fellow Travellers: > > Asked from the perspective of a software development amateur ... > > Suppose one wishes to create data structures that have both data and > metadata -- e.g. a data.frame and details about where, when, and by whom the > data were gathered (specifics not important here). > > 1. Is there any inherent processing advantage in R in representing this as a > list that contains both the data and metadata as components vs as a > data.frame with the metadata as attributes? > > 2. Is there a compelling software architecture argument to favor one vs the > other? > > I suspect the answer is no in both cases, but I thought I'd ask. This seems > to be mainly relevant for S3 programming, as in S4 one might stick the info > into different slots (if one wishes to dispatch on them). > > Cheers to all, > > Bert Gunter > Genentech > > > > > > > > > [[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. >
On Wed, 14 May 2008, Bert Gunter wrote:> R-Fellow Travellers: > > Asked from the perspective of a software development amateur ... > > Suppose one wishes to create data structures that have both data and > metadata -- e.g. a data.frame and details about where, when, and by whom the > data were gathered (specifics not important here). > > 1. Is there any inherent processing advantage in R in representing this as a > list that contains both the data and metadata as components vs as a > data.frame with the metadata as attributes? > > 2. Is there a compelling software architecture argument to favor one vs the > other? > > I suspect the answer is no in both cases, but I thought I'd ask. This seems > to be mainly relevant for S3 programming, as in S4 one might stick the info > into different slots (if one wishes to dispatch on them).The architecture is not designed for large numbers of attributes (and that includes slots in the current implementation) since they are stored as pairlists -- easy to grow, slow to search. So if you have many (thousands or more) items of metadata, store them in a single character vector rather than as separate attributes. Otherwise what is convenient for your way of working should win out.> > Cheers to all, > > Bert Gunter > Genentech > > > > > > > > > [[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. >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Maybe Matching Threads
- Left censored responses in mixed effects models
- High breakdown/efficiency statistics -- was RE: Rosner's test [Broadcast]
- \alias{} --> rather \concept{} for conceptual "links" to help pages
- FW: FW: Unable to Plot using headers (converting to Numeric)
- Non linear programming: choose R that minimizes corr(y, x^R)