[R] r data structures
David Winsemius
dwinsemius at comcast.net
Thu Aug 16 22:42:25 CEST 2012
On Aug 16, 2012, at 11:49 AM, Schumacher, Jay S wrote:
>
>
> hi,
> i'm trying to understand r data structures. i see that vectors,
> matrix, factors and arrays have a "dimension."
> there seems to be no mention of dimensionality anywhere for lists
> or dataframes. can i consider lists and frames to be of fixed
> dimension 2?
About half of what you have deduced is wrong. Matrices, arrays, and
dataframes do have dimensions, at least in technical R parlance,
namely they have an attribute which can be queried with dim(). By
definition matrices and dataframes have 2 dimensions. Arrays and
matrices can be redimensioned, but dataframes cannot.
Factors, lists, and atomic vectors do not have "dimensions", but they
do have "lengths". An appropriately structured list (one with vectors
all the same length) can be coerced to a dataframe with as.data.frame().
--
David Winsemius, MD
Alameda, CA, USA
More information about the R-help
mailing list