read table problem

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

read table problem

Chua Tock Hing
Hi

 

I have a file saved in R, named agrexp.Rdata, shown below

 

> agrdata

  fert yield

1   25    84

2   50    80

3   75    90

4  100   154

5  125   148

 

If I double clicked on this file, the data is displayed without problem.

However if I tried to import using:

> agrdata<-read.table("agrexp.Rdata")   or

> agrdata<-read.table("agrexp.Rdata",header=TRUE)  or

> agrdata<-read.table("agrexp.Rdata",header=TRUE,row.names=1)  or

> agrdata<-read.table("agrexp.Rdata",sep="")

 

I get an error message

"Warning message:

incomplete final line found by readTableHeader on 'agrexp.Rdata'"

 

or if I used:

> data(agrexp)

I get Warning message:

data set 'agrexp' not found in: data(agrexp)

 

Can anybody please help? I am a new user!

 

Thank you

 

CHUA TH


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: read table problem

Prof Brian Ripley
Files save()d in R should be read back with load().
.RData or .rda are common extensions for such files.

On Fri, 24 Feb 2006, Chua Tock Hing wrote:

> Hi
>
>
>
> I have a file saved in R, named agrexp.Rdata, shown below
>
>
>
>> agrdata
>
>  fert yield
>
> 1   25    84
>
> 2   50    80
>
> 3   75    90
>
> 4  100   154
>
> 5  125   148
>
>
>
> If I double clicked on this file, the data is displayed without problem.
>
> However if I tried to import using:
>
>> agrdata<-read.table("agrexp.Rdata")   or
>
>> agrdata<-read.table("agrexp.Rdata",header=TRUE)  or
>
>> agrdata<-read.table("agrexp.Rdata",header=TRUE,row.names=1)  or
>
>> agrdata<-read.table("agrexp.Rdata",sep="")
>
>
>
> I get an error message
>
> "Warning message:
>
> incomplete final line found by readTableHeader on 'agrexp.Rdata'"
>
>
>
> or if I used:
>
>> data(agrexp)
>
> I get Warning message:
>
> data set 'agrexp' not found in: data(agrexp)
>
>
>
> Can anybody please help? I am a new user!
>
>
>
> Thank you
>
>
>
> CHUA TH
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

--
Brian D. Ripley,                  [hidden email]
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html