Togaware DATA MINING
Desktop Survival Guide
by Graham Williams
Google

Arrays

An array is a vector that in addition has attributes associated with it. Attributes are used in R to record additional information about an object. Consider the simple example of a sequence of numbers (which is a simple vector by default):

> seqv <- 1:20
> is.vector(seqv)
[1] TRUE
> is.array(seqv)
[1] FALSE

> seqa <- as.array(1:20)
> is.array(seqa)
[1] TRUE
> is.vector(seqa)
[1] FALSE

> attributes(seqv)
NULL
> attributes(seqa)
$dim
[1] 20

> seqv@dim
Error: cannot get a slot ("dim") from an object of type "integer"

> seqa@dim
[1] 20



Copyright © 2004-2010 Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
The PDF version is a formatted comprehensive draft book (with over 800 pages).
Brought to you by Togaware. This page generated: Sunday, 22 August 2010