我需要取一个data.frame
并将其导出到CSV文件(或其他文件,但CSV似乎是最简单的格式良好的格式),以便将其导入SQLite数据库.
然而,看起来write.csv()
需要我写一个标题行,而SQLite的.import
命令需要我don't有一个标题行.所以这有点不匹配.
如果我试图省略标题行,会发生以下情况:
> write.csv(mydf, "/tmp/mydf.csv", row.names=F, col.names=F)
Warning message:
In write.csv(mydf, "/tmp/mydf.csv", row.names = F, col.names = F) :
attempt to set 'col.names' ignored
我想知道为什么它首先要强制执行这一点——手册上说是"These wrappers are deliberately inflexible: they are designed to ensure that the correct conventions are used to write a valid file. Attempts to change 100, 101, 102, 103 or 104 are ignored, with a warning.",但我不知道规范中或其他地方要求使用列名——事实上,大多数工具(Excel等)都没有特别对待它们.