[R] exporting data to csv file -problem with column names
David Winsemius
dwinsemius at comcast.net
Mon Jun 1 14:01:26 CEST 2009
On Jun 1, 2009, at 3:19 AM, Steven Matthew Anderson wrote:
> I have a data.frame with three columns + the row number
>
> Sample MidPoint Count
> [1,] 1 0.025 1
> [2,] 1 0.075 3
> [3,] 1 0.125 15
> [4,] 1 0.175 12
> [5,] 1 0.225 5
> [6,] 1 0.275 8
>
> When I export the data to a csv the column names are shifted because
> the row numbers are being exported as well.
>
> Sample MidPoint Count
> 1 1 0.025 1
> 2 1 0.075 3
> 3 1 0.125 15
>
> Is there a way to exclude the row numbers from the exported csv file?
> Or add a column name for row number to keep this from happening?
?write.table
Try setting row.names=FALSE in the write.table call.
> I obvisouly can go into each csv file and shift the column names over
> - but there are going to be a large number of csv files so I with to
> automate this.
>
> [[alternative HTML version deleted]]
And learn to send plain text to r-help.
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
More information about the R-help
mailing list