As question, I found that I can use .import
in sqlite shell, but seems it is not working in R environment, any suggestions?
相关问题
- R - Quantstart: Testing Strategy on Multiple Equit
- Using predict with svyglm
- Reshape matrix by rows
- Extract P-Values from Dunnett Test into a Table by
- split data frame into two by column value [duplica
相关文章
- SQLite不能创建表
- 小型数据库(SQLite,Derby,H2)可以存储多少数据?
- sqlite char数据类型 长度问题
- How to convert summary output to a data frame?
- How to plot smoother curves in R
- Paste all possible diagonals of an n*n matrix or d
- ess-rdired: I get this error “no ESS process is as
- How to use doMC under Windows or alternative paral
You can use
read.csv.sql
in thesqldf
package. It is only one line of code to do the read. Assuming you want to create a new database, testingdb, and then read a file into it try this:The above uses sqldf which uses RSQLite. You can also use RSQLite directly. See
?dbWriteTable
in RSQLite. Note that there can be problems with line endings if you do it directly withdbWriteTable
thatsqldf
will automatically handle (usually).If your intention was to read the file into R immediately after reading it into the database and you don't really need the database after that then see:
http://code.google.com/p/sqldf/#Example_13._read.csv.sql_and_read.csv2.sql
I tend to do that with the sqldf package: Quickly reading very large tables as dataframes in R
Keep in mind that in the above example I read the csv into a temp sqlite db. You'll obviously need to change that bit.