Changeset: e842192a8cc6 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e842192a8cc6
Modified Files:
        clients/R/MonetDB.R/NEWS
        clients/R/MonetDB.R/R/dbi.R
        clients/R/MonetDB.R/man/monetdb.read.csv.Rd
Branch: default
Log Message:

R Connector: CRAN changes pt. 2


diffs (71 lines):

diff --git a/clients/R/MonetDB.R/NEWS b/clients/R/MonetDB.R/NEWS
--- a/clients/R/MonetDB.R/NEWS
+++ b/clients/R/MonetDB.R/NEWS
@@ -1,7 +1,7 @@
-0.9.7
-- monetdb.read.csv TODO (thanks, Duncan)
-- deprecated nrows parameter to monetdb.read.csv, not neccessary any more 
because of upgrades to MonetDB
-- Fixed non-ASCII character handling (thanks, Roman!)
+0.9.6
+- monetdb.read.csv new create= parameter (Thanks, Duncan)
+- deprecated nrows parameter to monetdb.read.csv, not neccessary any more 
because of changes to MonetDB
+- Fixed non-ASCII character handling (Thanks, Roman)
 - Fully removed C-based socket code
 - support for dplyr verbs sample_n() and sample_frac()
 
diff --git a/clients/R/MonetDB.R/R/dbi.R b/clients/R/MonetDB.R/R/dbi.R
--- a/clients/R/MonetDB.R/R/dbi.R
+++ b/clients/R/MonetDB.R/R/dbi.R
@@ -522,12 +522,11 @@ setMethod("dbFetch", signature(res="Mone
   # if our tuple cache in res@env$data does not contain n rows, we fetch from 
server until it does
   while (length(res@env$data) < n) {
     cresp <- .mapiParseResponse(.mapiRequest(res@env$conn, paste0("Xexport ", 
.mapiLongInt(info$id), 
-                                                                  " ", 
.mapiLongInt(info$index), " ", 
.mapiLongInt(min(10000,n-length(res@env$data))))))
+                                                                  " ", 
.mapiLongInt(info$index), " ", .mapiLongInt(n-length(res@env$data)))))
     stopifnot(cresp$type == Q_BLOCK && cresp$rows > 0)
     
     res@env$data <- c(res@env$data, cresp$tuples)
     info$index <- info$index + cresp$rows
-    #print(paste0(length(res@env$data), " of ", info$rows));
     # if (getOption("monetdb.profile", T))  
.profiler_progress(length(res@env$data), n)
   }
   
@@ -619,7 +618,8 @@ setMethod("dbGetInfo", "MonetDBResult", 
 
 # adapted from RMonetDB, no java-specific things in here...
 monet.read.csv <- monetdb.read.csv <- function(conn, files, tablename, 
nrows=NA, header=TRUE, 
-                                               locked=FALSE, na.strings="", 
nrow.check=500, delim=",", newline="\\n", quote="\"", ...){
+                                               locked=FALSE, na.strings="", 
nrow.check=500, 
+                                               delim=",", newline="\\n", 
quote="\"", create=TRUE, ...){
   
   if (length(na.strings)>1) stop("na.strings must be of length 1")
   headers <- lapply(files, read.csv, sep=delim, na.strings=na.strings, 
quote=quote, nrows=nrow.check, 
@@ -638,7 +638,7 @@ monet.read.csv <- monetdb.read.csv <- fu
     if(!all(types==types[, 1])) stop("Files have different variable types")
   } 
   
-  dbWriteTable(conn, tablename, headers[[1]][FALSE, ])
+  if (create) dbWriteTable(conn, tablename, headers[[1]][FALSE, ])
   
   delimspec <- paste0("USING DELIMITERS '", delim, "','", newline, "','", 
quote, "'")
   
diff --git a/clients/R/MonetDB.R/man/monetdb.read.csv.Rd 
b/clients/R/MonetDB.R/man/monetdb.read.csv.Rd
--- a/clients/R/MonetDB.R/man/monetdb.read.csv.Rd
+++ b/clients/R/MonetDB.R/man/monetdb.read.csv.Rd
@@ -11,7 +11,7 @@
 \usage{
    monetdb.read.csv (conn, files, tablename, nrows, header=TRUE, 
   locked=FALSE, na.strings="", nrow.check=500, delim=",",
-  newline = "\\\\n", quote = "\"", ...)
+  newline = "\\\\n", quote = "\"", create=TRUE, ...)
 }
 \arguments{
   \item{conn}{A MonetDB.R database connection. Created using 
\code{\link[DBI]{dbConnect}} with the 
@@ -29,6 +29,7 @@
    \item{delim}{Field separator in CSV file.}
    \item{newline}{Newline in CSV file, usually \\n for UNIX-like systems and 
\\r\\r on Windows.}
    \item{quote}{Quote character(s) in CSV file.}
+  \item{create}{Create table before importing?}
  }
  
 \value{
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to