[R] obvious answer

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Fri Feb 1 00:42:05 CET 2002


myotis at cix.compulink.co.uk (Graham Smith) writes:

> I apologise for this question, as I'm sure the answer has got to be 
> obvious, but I am trying to follow the John Maindonald tutorial and have 
> stumbled at the first page. 

Link? (I suppose that I could find it, but it is you problem...)

> I have sussed out that I need to use the source command rather than the 
> read.table command as illustrated in the tutorial, but the data isn't 
> reading in properly with additional names at the beginning and end of the 
> data. $value and $visible. I am obviously missing something here and would 
> appreciate some help on what I'm doing wrong.
> 
> Many thanks,
> 
> Graham S
> 
> 
> > austpop<- source ("austpop.r")
> > austpop
> $value
>   Year  NSW Vic.  Qld   SA   WA Tas.  NT ACT Aust.
> 1 1917 1904 1409  683  440  306  193   5   3  4941
> 2 1927 2402 1727  873  565  392  211   4   8  6182
> 3 1937 2693 1853  993  589  457  233   6  11  6836
> 4 1947 2985 2055 1106  646  502  257  11  17  7579
> 5 1957 3625 2656 1413  873  688  326  21  38  9640
> 6 1967 4295 3274 1700 1110  879  375  62 103 11799
> 7 1977 5002 3837 2130 1286 1204  415 104 214 14192
> 8 1987 5617 4210 2675 1393 1496  449 158 265 16264
> 9 1997 6274 4605 3401 1480 1798  474 187 310 18532
> 
> $visible
> [1] FALSE

You don't normally assign the result of source(). Are you sure that you
don't just need 

source("austpop.r")

?

Otherwise, maybe try

austpop <- source ("austpop.r")$value

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list