Export CSV without col.names Export CSV without col.names r r

Export CSV without col.names


If you can't beat 'em, join 'em.

If you switch to write.table() (which write.csv() calls anyway) you're golden:

R> write.table(trees, file="/tmp/trees.csv", +              row.names=FALSE, col.names=FALSE, sep=",")R> system("head /tmp/trees.csv")8.3,70,10.38.6,65,10.38.8,63,10.210.5,72,16.410.7,81,18.810.8,83,19.711,66,15.611,75,18.211.1,80,22.611.2,75,19.9R>


You can directly import it into SQLite. The following imports the built in data frame BOD into the SQLite database my.db (creating my.db if it does not already exist).

library(RSQLite)con <- dbConnect(SQLite(), dbname = "my.db")dbWriteTable(con, "BOD", BOD, row.names = FALSE)dbDisconnect(con)


Use write.table() instead like so:

write.table(mydf, "/tmp/mydf.csv", row.names=F, col.names=F, sep=",")