On Tue, Feb 15, 2011 at 12:21:18PM -0500, Robert M. Flight wrote:
> Say I have a tab-delimited table I want to read into R. What should I
> expect to happen if some of the entries contain the character " ' "? I
> thought it would read the file fine, but that is not what happens.
> Instead, all the values in between two " ' "s get read into one field,
> and things are just seriously messed up. Is this a bug, and besides
> removing the offending characters, is there a fix?
>
> Example Input file:
>
> testFile.txt:
> 3499 9031 424823 COP'B2 118094989 XP_422637.2
> 3499 7955 114454 copb2 50080158 NP_001001940.1
> 3499 7227 45757 betaCop 24584107 NP_524836.2
> ...
>
> testDat <- read.table('testFile.txt',sep='\t')
> testDat
I believe you want to use:
testDat <- read.table('testFile.txt',sep='\t',quote="")
Ref.:
quote: the set of quoting characters. To disable quoting altogether,
use 'quote = ""'. See 'scan' for the behaviour on quotes
embedded in quotes. Quoting is only considered for columns
read as character, which is all of them unless 'colClasses'
is specified.
>...
Peace,
david
--
David H. Wolfskill [email protected]
Depriving a girl or boy of an opportunity for education is evil.
See http://www.catwhisker.org/~david/publickey.gpg for my public key.
pgpZ0dUFTInK9.pgp
Description: PGP signature
______________________________________________ [email protected] 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.

