[R] read.table issue

jim holtman jholtman at gmail.com
Sun Oct 10 06:26:20 CEST 2010


The problem is that you have an unbalanced quote (') in your input .
you need to specifiy quote = '' in read.table:

> tempTxt <- "103272;Canara Robeco Fortune '94;30.07;30.07;30.75;02-Apr-2007
+ "
> read.table(textConnection(tempTxt), sep=';', quote = '')
      V1                        V2    V3    V4    V5          V6
1 103272 Canara Robeco Fortune '94 30.07 30.07 30.75 02-Apr-2007

The quote is '94 in the string.

On Sat, Oct 9, 2010 at 10:05 PM, Santosh Srinivas
<santosh.srinivas at gmail.com> wrote:
> Dear R-Group,
>
> I am getting this error message "incomplete final line found by
> readTableHeader" in the code below.
>
> It seems to me that the error message is because of quote in the text data.
> Is there any easy way to handle this? Or should I do a substitute.
>
>
>> tempTxt <- "100589;Canara Robeco Expo-Income
> Plan;18.92;18.92;19.35;02-Apr-2007
> + "
>> read.table(textConnection(tempTxt), sep=';')
>      V1                             V2    V3    V4    V5          V6
> 1 100589 Canara Robeco Expo-Income Plan 18.92 18.92 19.35 02-Apr-2007
>> tempTxt <- "103272;Canara Robeco Fortune '94;30.07;30.07;30.75;02-Apr-2007
> + "
>> read.table(textConnection(tempTxt), sep=';')
> Error in read.table(textConnection(tempTxt), sep = ";") :
>  incomplete final line found by readTableHeader on 'tempTxt'
>
> Thanks,
> Santosh
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?



More information about the R-help mailing list