incomplete final line found by readTableHeader

Hi, I need your support concerning the following error

In read.table("C:/Users/canu/Documents/R/MS_Toolbox_Daniela/MS_Toolbox_Daniela/vs_TD/Sample_Report_V0100011.xls", :
incomplete final line found by readTableHeader on 'C:/Users/canu/Documents/R/MS_Toolbox_Daniela/MS_Toolbox_Daniela/vs_TD/Sample_Report_V0100011.xls'

This error comes when I try to open a .xls file on which I have previously worked on (filtered data out, reoved some columns etc).

Options like Place the cursor the end of that line, press enter, copy-paste and then save in another .xls file have not worked.

Any help?

can you use Excel to mock up a fake tiny xls file that reproduces the error when you read.table it in R ?

I am not sure how to do that...

can you take your sample_report_v... and delete almost all the rows, and still face the problem ?

I'm really asking whats the smallest amount of copy and paste you can do that still demonstrates the problem ?

problem persists even when I delete almost all rows (just let 3 rows).

Is the data public enough that you would be permitted to share this small file with us ?

I can do it (but I am not allowed to upload a .xls file)

I found that the forum does support the uploading of arbitrary files if the file is renamed to an extension it tolerates (and doesnt investigate, i.e. pdf)

https://community.rstudio.com/t/fitting-lmer-model-help/52160/12?u=nirgrahamuk

Sample_Report__V0100031.xls.pdf (3.9 MB)

I see a lot more than 3 records my friend :slight_smile:
No harm though, I found the issue.
read.table is good for reading in csv's not xls files, which are complex binaries.
You will need a package, I recommend readxl

install.packages("readxl")       # <-- only need to run this once in your console, not in your script
library(readxl)
readxl::read_xls("Sample_Report__V0100031.xls"  )
# A tibble: 20,776 x 11
   Session_Name_ Trial_Index_ TIMESTAMP LEFT_GAZE_X LEFT_GAZE_Y RIGHT_GAZE_X RIGHT_GAZE_Y RESOLUTION_X RESOLUTION_Y LEFT_INTEREST_A~
   <chr>                <dbl> <chr>     <chr>       <chr>       <chr>        <chr>        <chr>        <chr>        <chr>           
 1 V0100031                 5 1859620,~ 985,90      569,70      950,00       555,20       60,10        60,20        RECTANGLE_INTER~
 2 V0100031                 5 1859621,~ 986,10      569,30      950,00       555,30       60,10        60,20        RECTANGLE_INTER~
 3 V0100031                 5 1859622,~ 986,20      569,20      950,00       555,30       60,10        60,20        RECTANGLE_INTER~
 4 V0100031                 5 1859623,~ 986,30      569,00      949,90       555,40       60,10        60,20        RECTANGLE_INTER~
 5 V0100031                 5 1859624,~ 986,30      568,90      949,80       555,80       60,10        60,20        RECTANGLE_INTER~
 6 V0100031                 5 1859625,~ 986,40      568,80      949,70       556,30       60,10        60,20        RECTANGLE_INTER~
 7 V0100031                 5 1859626,~ 986,50      569,00      949,80       556,70       60,10        60,20        RECTANGLE_INTER~
 8 V0100031                 5 1859627,~ 986,40      569,20      950,00       557,30       60,10        60,20        RECTANGLE_INTER~
 9 V0100031                 5 1859628,~ 986,10      569,50      950,20       558,10       60,10        60,20        RECTANGLE_INTER~
10 V0100031                 5 1859629,~ 985,90      569,60      950,20       558,90       60,10        60,20        RECTANGLE_INTER~
# ... with 20,766 more rows, and 1 more variable: RIGHT_INTEREST_AREA_LABEL <chr>

I know that option but whenever I used read_xls I got the error

libxls error: Unable to open file

ok, can you run the code you have to the point of error (trying readxl approach).
Share here the failing code line, and then share the output from sessionInfo() please ?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.