Skip to content

read.table with special chars

4 messages · Marc Noguera, Jim Lemon

#
Hi all,
I am just starting with R and I have come across a problem which I guess
it is easy to solve. I am reading a table with read.table function.
This table contains chars which seem to be problematic when reading them
such as "'" and "#", if I remove these characters fromt the table by
hand the problem disappears. Otherwise, the whole table is not read,
since reading stops at the problematic tuple.
I have been looking in the ?read.table manual but have not found
anything. Is there any option to make R not interpret these characters?

Thanks in advance
Marc
#
On 01/19/2010 07:41 PM, Marc Noguera wrote:
Hi Marc,
Try changing the "quote" argument to "\"" and the comment.char argument 
to "".

Jim
#
Thanks Jim,
I've tried that but still no luck. Some other suggestions?

Thanks again
Marc
Jim Lemon wrote:

  
    
#
On 01/19/2010 08:26 PM, Marc Noguera wrote:
The comment.char change should have worked, as others have reported that 
it did. The single quote problem came up a few weeks ago and the answer 
then was to remove the single quotes. Perhaps these are more difficult 
to ignore than comment characters. It is probably a good idea to try 
globally removing or substituting these, as they will probably cause 
trouble later even if they can be read in.

Jim