additional error on read.table function

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

additional error on read.table function

oliver wee
hi,

thanks to the feedback of some people I was able to
solve my problem of reading data using the read.table
function by using the file.choose function inside the
method of the read.table function.

Unfortunately, I encountered a new error message after
I chose my file.
After I unputted
data = read.table(file.choose(), header = TRUE)

I got an error saying:

Error in scan(file = file, what = what, sep = sep,
quote = quote, dec = dec,  :
        line 1 did not have 11 elements
In addition: Warning message:
incomplete final line found by readTableHeader on
'D:\Oliver\Professional\Studies\Time Series
Analysis\spdc2693.data.txt'

my time series data looks like this...

------------
Standard and Poor's 500 Index closing values from 1926
to 1993.

  Date       Index
  260101     12.76
  260108     12.78
  260115     12.52
  260122     12.45
  260129     12.74
  260205     12.87
  260212     12.87
  260219     12.74
  260226     12.18
  260305     11.99
  260312     12.15
  260319     11.64
  260326     11.46
...
(and so on)
----------

Should I insert additional attributes besides header =
TRUE?

thanks.

______________________________________________
[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: additional error on read.table function

Gabor Grothendieck
You can use the skip= argument to skip over the indicated
number of lines of junk at the beginning of your file.  See
?read.table

On 1/29/06, oliver wee <[hidden email]> wrote:

> hi,
>
> thanks to the feedback of some people I was able to
> solve my problem of reading data using the read.table
> function by using the file.choose function inside the
> method of the read.table function.
>
> Unfortunately, I encountered a new error message after
> I chose my file.
> After I unputted
> data = read.table(file.choose(), header = TRUE)
>
> I got an error saying:
>
> Error in scan(file = file, what = what, sep = sep,
> quote = quote, dec = dec,  :
>        line 1 did not have 11 elements
> In addition: Warning message:
> incomplete final line found by readTableHeader on
> 'D:\Oliver\Professional\Studies\Time Series
> Analysis\spdc2693.data.txt'
>
> my time series data looks like this...
>
> ------------
> Standard and Poor's 500 Index closing values from 1926
> to 1993.
>
>  Date       Index
>  260101     12.76
>  260108     12.78
>  260115     12.52
>  260122     12.45
>  260129     12.74
>  260205     12.87
>  260212     12.87
>  260219     12.74
>  260226     12.18
>  260305     11.99
>  260312     12.15
>  260319     11.64
>  260326     11.46
> ...
> (and so on)
> ----------
>
> Should I insert additional attributes besides header =
> TRUE?
>
> thanks.
>
> ______________________________________________
> [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
>

______________________________________________
[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