[R-SIG-Mac] morley object?
Steven McKinney
smckinney at bccrc.ca
Sat Nov 23 02:16:52 CET 2013
Hi Ann
Looks like a typo - I see "moreley.tab" that should be "morley.tab".
Works for me after correcting that.
> filepath <- system.file("data", "moreley.tab", package="datasets")
> filepath
[1] ""
>
> filepath <- system.file("data", "morley.tab", package="datasets")
> filepath
[1] "C:/PROGRA~1/R/R-30~1.1/library/datasets/data/morley.tab"
> mm <- read.table(filepath)
> head(mm)
Expt Run Speed
001 1 1 850
002 1 2 740
003 1 3 900
004 1 4 1070
005 1 5 930
006 1 6 850
>
Steven McKinney
Statistician
Molecular Oncology and Breast Cancer Program
British Columbia Cancer Research Centre
> -----Original Message-----
> From: r-sig-mac-bounces at r-project.org [mailto:r-sig-mac-bounces at r-
> project.org] On Behalf Of Ann Summy
> Sent: November-22-13 4:56 PM
> To: r-sig-mac; r-help
> Subject: [R-SIG-Mac] morley object?
>
> Brand new to R and not a sys admin or programmer type. I am trying to work
> through the intro tutorial in the sample session here
> http://cran.r-project.org/doc/manuals/R-intro.html#A-sample-session.
>
> I have an error when following the instructions below:
>
> > The next section will look at data from the classical experiment of
> > Michelson to measure the speed of light. This dataset is available in the
> > morley object, but we will read it to illustrate the read.table function.
> > filepath <- system.file("data", "morley.tab" ,
> package="datasets")filepath
> >
> > Get the path to the data file.
> > file.show(filepath)
> >
> > Optional. Look at the file.
> > mm <- read.table(filepath)mm
> >
> > Read in the Michelson data as a data frame, and look at it. There are
> five
> > experiments (column Expt) and each has 20 runs (column Run) and sl is the
> > recorded speed of light, suitably coded.
> >
> Here is my result:
>
> > > filepath <- system.file("data", "moreley.tab", package="datasets")
>
> > filepath
>
> [1] ""
>
> > file.show(filepath)
>
> > mm <- read.table(filepath)
>
> Error in read.table(filepath) : no lines available in input
>
> In addition: Warning message:
>
> In file(file, "rt") :
>
> file("") only supports open = "w+" and open = "w+b": using the former
>
>
> Is it because I am missing this "morley object"? How do I see a list of
> what objects I have installed? I installed
> R-2.15.3.pkg<http://cran.r-project.org/bin/macosx/old/R-2.15.3.pkg>,
> because
> I am teaching myself on a 32-bit Macbook.
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
More information about the R-SIG-Mac
mailing list