From bolker at zoo.ufl.edu  Tue Oct 10 15:45:43 2006
From: bolker at zoo.ufl.edu (Ben Bolker)
Date: Tue, 10 Oct 2006 13:45:43 +0000 (UTC)
Subject: [Rd] read.table versus read.csv (PR#9284)
References: <20061010133025.CD1274C89A@slim.kubism.ku.dk>
Message-ID: <loom.20061010T153843-813@post.gmane.org>

 
Arnost.Komarek <at> med.kuleuven.be> writes:
> 
> Dear R Core Team,
> 
> Help to 'read.table' claims that
> 'read.csv' is identical to 'read.table' except for the defaults.

  Pedantically speaking, the claim is true: the difference is
in the default for the quote= argument.

> 
> However, 'read.table' seems to have problems when reading character =20
> variables containing single quotes (') whereas 'read.csv' does not. 

  This behavior is documented, if perhaps not obvious.

from ?read.table:

read.table(file, header = FALSE, sep = "", quote = "\"'",
 [snip]
     read.csv(file, header = TRUE, sep = ",", quote="\"", dec=".",
              fill = TRUE, comment.char="", ...)

Both single and double quotes are included in the default quote=
argument for read.table(), only double quotes are included
in the default for read.csv().

  To make read.csv() behave like read.table() in this respect, specify

read.csv(...,quote="\"'")

  a brief search in svn logs, RSiteSearch, etc., doesn't shed any
light on *why* this difference is there ...

  Ben Bolker




[Rd] read.table versus read.csv (PR#9284)
Ben Bolker