Re: R-beta: A vector of lists == Data Frame?

Ross Ihaka (ihaka@stat.auckland.ac.nz)
Mon, 3 Nov 1997 09:30:00 +1300 (NZDT)


Date: Mon, 3 Nov 1997 09:30:00 +1300 (NZDT)
From: Ross Ihaka <ihaka@stat.auckland.ac.nz>
Message-Id: <199711022030.JAA01736@stat1.stat.auckland.ac.nz>
To: BHutto@IBM.Net, r-help@stat.math.ethz.ch
Subject: Re: R-beta: A vector of lists == Data Frame?

> What is the most common R/S idiom for creating a vector of lists and 
> then adding new lists to it? To be more specific, if "CreatePerson" 
> is a function that returns a list characterising that person, how do 
> I implement the following pseudo-code in R
>
> Person[ i ] <- CreatePerson( param1, param2 )

As you observe, the focus in this kind of language is on "variables"
rather than on "cases".  I think that this is because statistics tends
to be about building models with collections of observations, rather
than answering queries about individual observations.  Many computations
in R/S take advantage of this variable/vector structure.

Trying to work using record-like ideas is at best awkward in S/R, and
it will probably be very inefficient.  When records are of fixed size,
you can get the same effect by using data frames, but you have to think
variable-wise rather than case-wise.

I think the reason that S has caught on among statisticians is that we
have been trained to think in terms on "modeling with variables".  It
seems like the most natural thing in world to us.  Similarly, MATLAB
users probably like MATLAB because they have been trained to see
everything as a matrix problem and this is the framework that MATLAB
presents.  It is always interesting to encounter someone from a different
background who doesn't see things the same way.

If you are really interested in casewise processing I would suggest
that XLispStat or some other Lisp/Scheme may be a better choice.

	Ross
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=