[R] expected behavior when parsing lines with special characters

Peter Ehlers ehlers at ucalgary.ca
Tue Feb 15 18:44:07 CET 2011


On 2011-02-15 09:25, Peter Langfelder wrote:
> On Tue, Feb 15, 2011 at 9:21 AM, Robert M. Flight<rflight79 at gmail.com>  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?
>
> Yes, use argument quote="\"" or even quote="" to disable quoting altogether.

Proving once again that it's a pretty good idea to check the
help pages (where the 'quote' argument is well defined)
before jumping to 'bug' conclusions.

Do also consider read.delim() for tab-separated files.

Peter Ehlers

> See ?read.table
>
> Peter
>
> ______________________________________________
> 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.



More information about the R-help mailing list