Request for showWarnings parameter for write.table

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Request for showWarnings parameter for write.table

Leif Kirschenbaum-4
Madams & Sirs,
  I use write.table to write CSV files to generate reports for my colleagues to open in their spreadsheet application of choice.  I often append data of dissimilar structure to the same file, i.e. a few summary lines and then additional data of some number of columns.

Normally write.table produces:
> write.table(etest[,writevars],file=fname,row.names=FALSE,col.names=TRUE,
        append=TRUE,sep=",")
Warning message:
appending column names to file in: write.table(etest[, writevars], file = fname, row.names = FALSE,  


Therefore I resort to:

> options(warn=-1)
> write.table(etest[,writevars],file=fname,row.names=FALSE,col.names=TRUE,append=TRUE,sep=",")
> options(warn=0)


However I thought that perhaps a parameter such as included for dir.create would be more elegant:
> write.table(etest[,writevars],file=fname,row.names=FALSE,col.names=TRUE,
        append=TRUE,sep=",",showWarnings=FALSE)


where showWarnings would default to TRUE.

Please cc: replies to [hidden email]

Thank you.


Leif Kirschenbaum
Senior Yield Engineer
Reflectivity, Inc.
(408) 737-8100 x307
[hidden email]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Request for showWarnings parameter for write.table

Gabor Grothendieck
You might also check out suppressWarnings, e.g.

suppressWarnings(write.table(...whatevever...))



On 2/27/06, Leif Kirschenbaum <[hidden email]> wrote:

> Madams & Sirs,
>  I use write.table to write CSV files to generate reports for my colleagues to open in their spreadsheet application of choice.  I often append data of dissimilar structure to the same file, i.e. a few summary lines and then additional data of some number of columns.
>
> Normally write.table produces:
> > write.table(etest[,writevars],file=fname,row.names=FALSE,col.names=TRUE,
>        append=TRUE,sep=",")
> Warning message:
> appending column names to file in: write.table(etest[, writevars], file = fname, row.names = FALSE,
>
>
> Therefore I resort to:
>
> > options(warn=-1)
> > write.table(etest[,writevars],file=fname,row.names=FALSE,col.names=TRUE,append=TRUE,sep=",")
> > options(warn=0)
>
>
> However I thought that perhaps a parameter such as included for dir.create would be more elegant:
> > write.table(etest[,writevars],file=fname,row.names=FALSE,col.names=TRUE,
>        append=TRUE,sep=",",showWarnings=FALSE)
>
>
> where showWarnings would default to TRUE.
>
> Please cc: replies to [hidden email]
>
> Thank you.
>
>
> Leif Kirschenbaum
> Senior Yield Engineer
> Reflectivity, Inc.
> (408) 737-8100 x307
> [hidden email]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel