[R] problem with read.table

Charilaos Skiadas skiadas at hanover.edu
Wed May 23 04:07:59 CEST 2007


On May 22, 2007, at 9:41 PM, Alex Tsoi wrote:

> Dear all,
>
> I  try to use read.table to get the data from a tab delimited file,  
> and some
> of the data is shown below:

[snip]
>
> and it means that whenever read.table reads  '  , it skips the next  
> line,
> until it reads  '   again....
>
> Could anyone  show me how to solve this kind of problem ?
>
> I greatly appreciate for any suggestion.  Thanks.

You might want to have a look at ?read.table for more details, but  
the following should do it:

test <- read.table("data.txt", colClasses = "character", sep="\t",  
quote="\"")

Essentially by default read.table sees both " and ' as quote  
delimiters. In your data, you only want " as a quote delimiter.

> Alex Tsoi-

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College



More information about the R-help mailing list