Changeset: e176282521f7 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e176282521f7 Added Files: clients/R/monet.frame/DESCRIPTION clients/R/monet.frame/NAMESPACE clients/R/monet.frame/NEWS clients/R/monet.frame/db.tests/monetframe.test.R Modified Files: clients/R/MonetDB.R/DESCRIPTION clients/R/MonetDB.R/NAMESPACE clients/R/MonetDB.R/NEWS clients/R/MonetDB.R/R/monetdb.R clients/R/MonetDB.R/man/MonetDB.R.Rd clients/R/monet.frame/R/monetframe.R clients/R/monet.frame/man/aggregatef.Rd clients/R/monet.frame/man/as.data.frame.Rd clients/R/monet.frame/man/as.list.Rd clients/R/monet.frame/man/mf.Rd clients/R/monet.frame/man/monet.frame.Rd clients/R/monet.frame/man/sample.Rd clients/R/monet.frame/man/sd.Rd clients/R/monet.frame/man/set.debug.Rd clients/R/monet.frame/man/tabulate.Rd clients/R/monet.frame/man/tabulate.monet.frame.Rd clients/R/monet.frame/man/var.Rd Branch: default Log Message:
Merge heads. diffs (truncated from 324 to 300 lines): diff --git a/clients/R/MonetDB.R/DESCRIPTION b/clients/R/MonetDB.R/DESCRIPTION --- a/clients/R/MonetDB.R/DESCRIPTION +++ b/clients/R/MonetDB.R/DESCRIPTION @@ -1,11 +1,11 @@ Package: MonetDB.R -Version: 0.8.0 -Date: 2013-10-13 +Version: 0.8.2 +Date: 2013-10-16 Title: Connect MonetDB to R Authors@R: c(person("Hannes Muehleisen", role = c("aut", "cre"),email = "han...@cwi.nl"), person("Thomas Lumley", role = "ctb"), person("Anthony Damico", role = "ctb")) -Depends: DBI (>= 0.2-5), digest (>= 0.6.0), methods, utils, stats +Depends: DBI (>= 0.2-5), digest (>= 0.6.0),methods Description: Allows to pull data from MonetDB into R License: MPL (== 1.1) URL: http://monetr.r-forge.r-project.org diff --git a/clients/R/MonetDB.R/NAMESPACE b/clients/R/MonetDB.R/NAMESPACE --- a/clients/R/MonetDB.R/NAMESPACE +++ b/clients/R/MonetDB.R/NAMESPACE @@ -1,4 +1,4 @@ -import(DBI,utils,stats,digest,methods) +import(DBI,digest,methods) # export only driver constructor, everything else is DBI stuff.. export(MonetDB,MonetR,MonetDBR,MonetDB.R) @@ -8,78 +8,14 @@ exportMethods(dbSendUpdate,dbSendUpdateA export(monetdbGetTransferredBytes) export(monetdbRtype) -# monet.frame things, this is an S3 class -# constructors -export(monet.frame) -export(mf) -export(set.debug) - # shorthand for db connections export(mc) -# conversion to native R -S3method(as.list,monet.frame) -S3method(as.data.frame,monet.frame) -S3method(as.vector,monet.frame) -export(av) -export(adf) - -# inspection -S3method(str,monet.frame) -S3method(print,monet.frame) -S3method(Summary,monet.frame) -S3method(summary,monet.frame) -S3method(names,monet.frame) -S3method(dim,monet.frame) -S3method(length,monet.frame) -S3method(na.fail,monet.frame) - -# subsetting -S3method(head,monet.frame) -S3method(tail,monet.frame) -S3method("[",monet.frame) -S3method("$",monet.frame) -S3method(subset,monet.frame) -S3method(na.omit,monet.frame) -S3method(sample, monet.frame) -S3method(sample, default) -export(sample) - - - -# math/stats -S3method(Ops,monet.frame) -S3method(Math,monet.frame) -S3method(mean,monet.frame) -S3method(sd, monet.frame) -S3method(sd, default) -export(sd) -S3method(var, monet.frame) -S3method(var, default) -export(var) -S3method(quantile,monet.frame) -S3method(median,monet.frame) -S3method(aggregate,monet.frame) -export(aggregatef) # temp! - -export(tabulate) -S3method(tabulate, monet.frame) -S3method(tabulate, default) - -S3method(unique, monet.frame) -S3method(range, monet.frame) - -# reorganization -S3method(rbind,monet.frame) -S3method(merge,monet.frame) -S3method(sort,monet.frame) - # control.R export(monetdb.server.setup) export(monetdb.server.start) export(monetdb.server.stop) - useDynLib(MonetDB.R) 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,3 +1,7 @@ +0.8.1 +- fixed bug in dbWriteTable() where VARCHAR(255) was used for character data instead of STRING +- moved monet.frame into separate package + 0.8 - New All-C socket code (Thanks, Windows) - new dbConnect() parameter organization (!) diff --git a/clients/R/MonetDB.R/R/monetdb.R b/clients/R/MonetDB.R/R/monetdb.R --- a/clients/R/MonetDB.R/R/monetdb.R +++ b/clients/R/MonetDB.R/R/monetdb.R @@ -239,13 +239,13 @@ setMethod("dbWriteTable", "MonetDBConnec }) -setMethod("dbDataType", signature(dbObj="MonetDBConnection", obj = "ANY"), def = function(dbObj, obj, ...) { +setMethod("dbDataType", signature(dbObj="MonetDBConnection", obj = "ANY"), def=function(dbObj, obj, ...) { if (is.logical(obj)) "BOOLEAN" else if (is.integer(obj)) "INTEGER" else if (is.numeric(obj)) "DOUBLE PRECISION" else if (is.raw(obj)) "BLOB" - else "VARCHAR(255)" + else "STRING" }, valueClass = "character") diff --git a/clients/R/MonetDB.R/man/MonetDB.R.Rd b/clients/R/MonetDB.R/man/MonetDB.R.Rd --- a/clients/R/MonetDB.R/man/MonetDB.R.Rd +++ b/clients/R/MonetDB.R/man/MonetDB.R.Rd @@ -31,7 +31,7 @@ \seealso{ \code{\link[DBI]{dbConnect}} for documentation how to invoke the driver - \code{\link[MonetDB.R]{monet.frame}} for a \code{data.frame()}-like interface to the DB +% \code{\link[MonetDB.R]{monet.frame}} for a \code{data.frame()}-like interface to the DB \code{\link[=control]{monetdb.server.setup}} to set up and start a local MonetDB server from R } diff --git a/clients/R/monet.frame/DESCRIPTION b/clients/R/monet.frame/DESCRIPTION new file mode 100644 --- /dev/null +++ b/clients/R/monet.frame/DESCRIPTION @@ -0,0 +1,13 @@ +Package: monet.frame +Version: 0.1 +Date: 2013-10-16 +Title: Connect MonetDB to R +Authors@R: c(person("Hannes Muehleisen", role = c("aut", "cre"),email = "han...@cwi.nl"), + person("Thomas Lumley", role = "ctb"), + person("Anthony Damico", role = "ctb")) +Depends: MonetDB.R (>= 0.8.2), methods, utils, stats +Description: Virtual Data Object for MonetDB +License: MPL (== 1.1) +URL: http://monetr.r-forge.r-project.org +Maintainer: Hannes Muehleisen <han...@cwi.nl> +SystemRequirements: MonetDB installation, available at http://www.monetdb.org diff --git a/clients/R/monet.frame/NAMESPACE b/clients/R/monet.frame/NAMESPACE new file mode 100644 --- /dev/null +++ b/clients/R/monet.frame/NAMESPACE @@ -0,0 +1,65 @@ +import(MonetDB.R,utils,stats,methods) + +# monet.frame things, this is an S3 class +# constructors +export(monet.frame) +export(mf) +export(set.debug) + +# conversion to native R +S3method(as.list,monet.frame) +S3method(as.data.frame,monet.frame) +S3method(as.vector,monet.frame) +export(av) +export(adf) + +# inspection +S3method(str,monet.frame) +S3method(print,monet.frame) +S3method(Summary,monet.frame) +S3method(summary,monet.frame) +S3method(names,monet.frame) +S3method(dim,monet.frame) +S3method(length,monet.frame) +S3method(na.fail,monet.frame) + +# subsetting +S3method(head,monet.frame) +S3method(tail,monet.frame) +S3method("[",monet.frame) +S3method("$",monet.frame) +S3method(subset,monet.frame) +S3method(na.omit,monet.frame) +S3method(sample, monet.frame) +S3method(sample, default) +export(sample) + + + +# math/stats +S3method(Ops,monet.frame) +S3method(Math,monet.frame) +S3method(mean,monet.frame) +S3method(sd, monet.frame) +S3method(sd, default) +export(sd) +S3method(var, monet.frame) +S3method(var, default) +export(var) +S3method(quantile,monet.frame) +S3method(median,monet.frame) +S3method(aggregate,monet.frame) +export(aggregatef) # temp! + +export(tabulate) +S3method(tabulate, monet.frame) +S3method(tabulate, default) + +S3method(unique, monet.frame) +S3method(range, monet.frame) + +# reorganization +S3method(rbind,monet.frame) +S3method(merge,monet.frame) +S3method(sort,monet.frame) + diff --git a/clients/R/monet.frame/NEWS b/clients/R/monet.frame/NEWS new file mode 100644 --- /dev/null +++ b/clients/R/monet.frame/NEWS @@ -0,0 +1,2 @@ +0.1 +- moved monet.frame into its own package diff --git a/clients/R/monet.frame/db.tests/monetframe.test.R b/clients/R/monet.frame/db.tests/monetframe.test.R new file mode 100644 --- /dev/null +++ b/clients/R/monet.frame/db.tests/monetframe.test.R @@ -0,0 +1,75 @@ +library(MonetDB.R) + +con <- dbConnect(dbDriver("MonetDB"), "monetdb://localhost:50000/acs", "monetdb", "monetdb",timeout=100) + +table <- "monetframetest" + + +fcmp <- function(f1,f2,epsilon) { + abs(f1-f2) < epsilon +} + +# basic MAPI/SQL test +stopifnot(identical(dbGetQuery(con,"SELECT 'DPFKG!'")[[1]],"DPFKG!")) + +if (!dbExistsTable(con,table)) { + data(iris) + dbWriteTable(con,table,iris, overwrite=TRUE) +} +stopifnot(identical(dbExistsTable(con,table),TRUE)) + +# aight +frame <- monet.frame(con,table) +stopifnot(identical(class(frame)[[1]],"monet.frame")) + +# we should get the very same from monet.frame and dbReadTable +plaindata <- dbReadTable(con,table) +stopifnot(identical(as.data.frame(frame),plaindata)) + +# do as.vector / $ work? +stopifnot(identical(as.vector(frame$sepal_width),plaindata$sepal_width)) + +# does [] work? +stopifnot(identical(as.data.frame(frame[1:10,c("sepal_length","species")]),plaindata[1:10,c("sepal_length","species")])) + +# names(), dim() +stopifnot(identical(names(frame),c("sepal_length","sepal_width","petal_length","petal_width","species"))) +stopifnot(dim(frame)[[1]] == 150) +stopifnot(dim(frame)[[2]] == 5) + +# Ops +stopifnot(identical(plaindata$sepal_width*plaindata$sepal_length,as.vector(frame$sepal_width*frame$sepal_length))) +stopifnot(identical(plaindata$sepal_width*42,as.vector(frame$sepal_width*42))) +stopifnot(identical(42*plaindata$sepal_length,as.vector(42*frame$sepal_length))) +stopifnot(identical(plaindata$sepal_length > 1.4,as.vector(frame$sepal_length > 1.4))) + +# Summary +stopifnot(identical(min(plaindata$sepal_length),min(frame$sepal_length))) +stopifnot(identical(max(plaindata$sepal_length),max(frame$sepal_length))) +stopifnot(identical(round(mean(plaindata$sepal_length),2),round(mean(frame$sepal_length),2)[[1]])) + +# Math +stopifnot(identical(signif(plaindata$sepal_length*1000,2),as.vector(signif(frame$sepal_length * 1000,2)))) _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list