Or use read.csv() followed by dbWriteTable from package RSQLite.

Or read.DIF() as the case may be (the DIF format for spreadsheets being simpler 
than XLS).


Today, Gabor Grothendieck wrote:
>
> Here is how to do it in R.  Download, install and start R and then
> paste the following code into R.
>
> Uncomment the first line (the line starting with  a hash) if you
> don't already have sqldf installed.  This not only installs sqldf
> but also the RSQLite driver and SQLite itself.
>
> The code assumes that mytable.csv is the input file, DF is the table
> name to create and db  is the name of the SQLite database to use
> (or create).  Change these as needed.   It will use the first line
> of the input file as the column names and will automatically
> determine the types of  columns by examining the first few
> data rows of the input.
>
> # install.packages("sqldf")
>
> library(sqldf)
> DF <- read.csv("mytable.csv")
> sqldf(c("attach db as new", "create table new.DF as select * from DF"))
>
>

Reply via email to