[R] write.table with append=T after using cat on same file
Mark Sharp
msharp at txbiomed.org
Mon Jul 27 22:46:38 CEST 2015
I do not get an error with R-3.2.1 on Mac OS. You may have done something prior to this code so that perhaps F is not FALSE or T is not TRUE.
R. Mark Sharp, Ph.D.
msharp at TxBiomed.org
> On Jul 27, 2015, at 3:32 PM, Waichler, Scott R <Scott.Waichler at pnnl.gov> wrote:
>
> Hi,
>
> For years I've been writing text to the beginning of files with cat(append=F) , then following that text with data written by write.table(append=T). It is now giving me an error message. I'm using R-3.1.2. What gives?
>
> df <- data.frame(x = 1, y = 1:10, z = 10:1)
> cat(file="junk.txt", sep="", "# An introductory note.\n")
> write.table(df, file="junk.txt", sep=",", append=T, quote=F, row.names=F, col.names=F)
>
> Error in file(file, ifelse(append, "a", "w")) : invalid 'open' argument
>
> Thanks,
> Scott Waichler
> Pacific Northwest National Laboratory
> Richland, WA USA
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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