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

Description Usage Arguments Value See Also Examples

Description

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

Usage

1
2
3
4
   monetdb.read.csv (conn, files, tablename, header=TRUE, 
  locked=FALSE, best.effort=FALSE, na.strings="", nrow.check=500, delim=",",
  newline = "\\n", quote = "\"", col.names=NULL, lower.case.names=FALSE, 
  sep=delim, ...)

Arguments

conn

A MonetDBLite database connection. Created using dbConnect with the MonetDBLite 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.

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.

best.effort

Use best effort flag when reading csv files and continue importing even if parsing of fields/lines fails.

na.strings

Which string value to interpret as NA value.

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.

newline

Newline in CSV file, usually \n for UNIX-like systems and \r\r on Windows.

quote

Quote character(s) in CSV file.

lower.case.names

Convert all column names to lowercase in the database?

col.names

Optional column names in case the ones from CSV file should not be used

sep

alias for delim

...

Additional parameters. Currently not in use.

Value

Returns the number of rows imported if successful.

See Also

dbWriteTable in DBIConnection-class

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# initiate a MonetDBLite server
library(DBI)
dbdir <- file.path( tempdir() , 'readcsv' )
con <- dbConnect( MonetDBLite::MonetDBLite() , dbdir )

# write test data to temporary CSV file
file <- tempfile()
write.table(iris, file, sep=",", row.names=FALSE)

# create table and import CSV
monetdb.read.csv(con, file, "iris")

dbDisconnect(con, shutdown=TRUE)

MonetDBLite documentation built on July 28, 2018, 1:02 a.m.