> Date: Wed, 8 Mar 2000 09:02:13 -0800
> From: Clayton Springer <csprin at brandybuck.ca.sandia.gov>
> To: r-help at stat.math.ethz.ch
> Subject: [R] Trouble with data dim
>
> Dear R users,
>
> I am a novice user working through V & R. My first question stems
> from p20 of the second edition.:
>
> I perform the following actions:
>
> > mydata <- c(2.9,3.4,3.4,3.7,3.7,2.8,2.8,2.5,2.4,2.4)
> > names(mydata) <-
c('c','j','b','e','i','h','g','d','f','a')
> > mydata
> c j b e i h g d f a
> 2.9 3.4 3.4 3.7 3.7 2.8 2.8 2.5 2.4 2.4
>
> This is good and as V & R says it should be. Then I ...
>
> > dim (mydata) <- c(2,5)
> > mydata
> [,1] [,2] [,3] [,4] [,5]
> [1,] 2.9 3.4 3.7 2.8 2.4
> [2,] 3.4 3.7 2.8 2.5 2.4
> >
> The book says I should get the additional lines:
>
> attr(,"names")
> [1] "c" "j" "b" "e" "i"
"h" "g" "d" "f" "a"
>
> What haven't I done?
Used an up-to-date edition! V&R2 describes S-PLUS 3.x: see its preface.
V&R3 attempts to cover later versions of S-PLUS, and as far as possible R
(although R has changed a lot since Jan 1999 when that went to the
publishers).
Incidentally, S-PLUS 5.x acts differently here too.
--
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 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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 at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._