From plroebuck at mdanderson.org  Mon Oct 27 05:58:33 2008
From: plroebuck at mdanderson.org (Paul Roebuck)
Date: Sun, 26 Oct 2008 23:58:33 -0500 (CDT)
Subject: [Rd] write.csv(..., col.names = FALSE) (PR#13202)
In-Reply-To: <20081024123008.3E08E282C769@mail.pubhealth.ku.dk>
References: <20081024123008.3E08E282C769@mail.pubhealth.ku.dk>
Message-ID: <Pine.OSF.4.58.0810262349370.479523@wotan.mdacc.tmc.edu>

On Fri, 24 Oct 2008 stefan.albrecht at allianz.com wrote:

> in write.csv() it is not possible to set both
> row.names = FALSE, col.names = FALSE
> since the col.names = FALSE gets overwritten:
>
> > write.csv
> function (...)
> {
>     Call <- match.call(expand.dots = TRUE)
>     for (argname in c("col.names", "sep", "dec", "qmethod")) if
> (!is.null(Call[[argname]]))
>         warning(gettextf("attempt to set '%s' ignored", argname),
>             domain = NA)
>     rn <- eval.parent(Call$row.names)
>     Call$col.names <- if (is.logical(rn) && !rn)
>         TRUE
>     else NA
>     Call$sep <- ","
>     Call$dec <- "."
>     Call$qmethod <- "double"
>     Call[[1]] <- as.name("write.table")
>     eval.parent(Call)
> }
> <environment: namespace:utils>
> >
>
> This is not documented and should be changed, as it is
> an unintended reaction.

?write.csv

> write.csv and write.csv2 provide convenience wrappers
> for writing CSV files. They set sep, dec and qmethod,
> and col.names to NA if row.names=TRUE and TRUE otherwise.

Seems documented to me.

Note that write.csv is just a wrapper for write.table.
If you don't like the wrapper, you could always call
write.table with its arguments set just as you want.

----------------------------------------------------------
SIGSIG -- signature too long (core dumped)



[Rd] write.csv(..., col.names = FALSE) (PR#13202)
Paul Roebuck