Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: R Array [was: Mata for data management]


From   "Joseph Coveney" <[email protected]>
To   "Statalist" <[email protected]>
Subject   Re: st: R Array [was: Mata for data management]
Date   Sat, 2 Feb 2008 14:55:15 +0900

Gabi Huiber wrote:

I can't think of any example, but up until last year I have been using
only Stata for all my data analysis needs, so I am biased. I can only
speculate that arrays accommodate a style of programming that's more
mainstream. I base this on a very brief tinkering experience. Last
summer I picked up R and PHP. Then I took an online class on C++
through my local community college. I didn't know much about computer
programming, so I didn't know what to expect, but I found all kinds of
common traits between these languages and they all had arrays; so I
just figured that arrays must be a general language construct because
R, PHP and C++ are not designed to do the same thing. So, once I got
to use arrays I liked them. If Stata offered them I could use them
here too, but I don't really miss them, if that's what you're getting
at. I have been using Stata for so long that its ways feel natural to
me.

--------------------------------------------------------------------------------

Stata's class programming--which has been around since Release 8--has arrays
whose elements can be numeric, string and other arrays.  From the latter,
you can create ragged arrays, just as touted for R, for what it's worth.
(I've toyed with creating a dataset class, primarily to explore ways of
overcoming Stata's 244-character string-variable limit.  But there's too
much re-inventing the wheel in writing data-management methods, you don't
get command vectorizing that Stata's conventional dataset offers, and as
Nick Cox and Sergiy Radyakin mention in a contemporaneous thread, there are
better ways to deal with long strings.)

You could also look into Mata's structs or a Mata matrix of pointers if
you're interested in array-like data structures of arbitrary dimension and
that can take both numeric and (long) string data types.  They probably
aren't so convenient as arrays are in R, I suppose, but with the advent of
Mata, Stata is becoming more full-fledged from a programming standpoint.
Take a look at the reserved word list for Mata:  there might come a day when
even R's advocates have to acknowledge Stata's strengths for statistical
programming.

Joseph Coveney


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index