[R] Suppress 'x' when appending to a csv file

John Kane jrkrideau at yahoo.ca
Sat Sep 8 21:29:06 CEST 2007


Thanks Marc. It works.  I had not thought of using
col.names = FALSE as I wanted to keep the colnames. I
see that I will just have to do another write.table
command to do this.  Humm, actually it took a a bit of
juggling to do the names but it's looking fine now.



--- Marc Schwartz <marc_schwartz at comcast.net> wrote:

> On Sat, 2007-09-08 at 11:41 -0400, John Kane wrote:
> > Is there any convenient way to supress the x that
> > appears in csv export files?  I would like to be
> able
> > to export a file and add a comment to it yet still
> be
> > able to read it back into R.  I don't see any way
> to
> > get rid of the x that seperates the different
> appended
> > parts.
> > 
> > Thanks
> > 
> > EXAMPLE
> > 
> > x
> > 1
> > 2
> > 3
> > 4
> > 5
> > x
> > #Results from file SSS.r
> > 
> > R.2.5.1 Windows XP
> 
> John,
> 
> Try this:
> 
> > write.table(head(iris), sep = ",", 
>               row.names = FALSE, col.names = FALSE)
> 5.1,3.5,1.4,0.2,"setosa"
> 4.9,3,1.4,0.2,"setosa"
> 4.7,3.2,1.3,0.2,"setosa"
> 4.6,3.1,1.5,0.2,"setosa"
> 5,3.6,1.4,0.2,"setosa"
> 5.4,3.9,1.7,0.4,"setosa"
> 
> 
> You may need to explicitly adjust other arguments
> that are otherwise set
> to defaults when using write.csv().
> 
> HTH,
> 
> Marc Schwartz
> 
> 
>



More information about the R-help mailing list