Learn R Programming

MonetDB.R (version 0.8.0)

monetdb.read.csv: Import a CSV file into MonetDB

Description

Instruct MonetDB to read a CSV file, optionally also create the table for it.

Usage

monetdb.read.csv (conn, files, tablename, nrows, header=TRUE, 
  locked=FALSE, na.strings="", ..., nrow.check=500, delim=",")

Arguments

conn
A MonetDB.R database connection. Created using dbConnect with the MonetDB.R database driver.
files
A single string or a vector of strings containing the absolute file names of the CSV files to be imported.
tablename
Name of the database table the CSV files should be imported in. Created if necessary.
nrows
Total number of rows to import. Can be an upper bound.
header
Whether or not the CSV files contain a header line.
locked
Whether or not to disable transactions for import. Setting this to TRUE can greatly improve the import performance.
na.strings
Which string value to interpret as NA value.
...
Additional parameters. Currently not in use.
nrow.check
Amount of rows that should be read from the CSV when the table is being created to determine column types.
delim
Field separator in CSV file.

Value

  • Returns the number of rows imported if successful.

See Also

dbWriteTable in DBIConnection-class

Examples

Run this code
# connect to MonetDB
conn <- dbConnect(MonetDB.R(), "monetdb://localhost/demo")
# write test data to temporary CSV file
data(iris)
file <- tempfile()
write.table(iris, file, sep=",")
# create table and import CSV
monetdb.read.csv(conn, file, "iris", 150)

Run the code above in your browser using DataLab