Changeset: 2e8ec251aa90 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2e8ec251aa90 Modified Files: clients/R/monet.frame/R/monetframe.R clients/R/monet.frame/db.tests/monetframe.test.R Branch: default Log Message:
R Connector: Fix for summary() and min()/max() used for quantile(col,0.0) and quantile(col,1.0), respectively diffs (41 lines): diff --git a/clients/R/monet.frame/R/monetframe.R b/clients/R/monet.frame/R/monetframe.R --- a/clients/R/monet.frame/R/monetframe.R +++ b/clients/R/monet.frame/R/monetframe.R @@ -609,7 +609,7 @@ summary.monet.frame <- function (object, doneSth <- FALSE value <- if (attr(col,"rtypes")[[1]] == "numeric") { qq <- quantile(nncol,printDots=FALSE) - qq <- signif(c(qq[1L:3L], mean(nncol), qq[4L:5L]), digits) + qq <- signif(unlist(c(qq[1L:3L], mean(nncol), qq[4L:5L])), digits) names(qq) <- c("Min.", "1st Qu.", "Median", "Mean", "3rd Qu.", "Max.") @@ -1143,7 +1143,18 @@ quantile.monet.frame <- function(x, prob # TODO: move this to generic functions, like wrapSelect etc. query <- getQuery(x) col <- sub("(select )(.*?)( from.*)","\\2",query,ignore.case=TRUE) - nexpr <- paste0("QUANTILE((",col,"),",probs,")",collapse=",") + #nexpr <- paste0("QUANTILE((",col,"),",probs,")",collapse=",") + # sprintf because of the slightly braindamaged way the value is interpreted without a decimal + + # very dirty hack, this will use min/max for quantiles 0 and 1, respectively + nexpr <- paste0( + ifelse(probs == 0, + paste0("MIN(\"",col,"\")"), + ifelse(probs==1, + paste0("MAX(\"",col,"\")"), + sprintf("QUANTILE(\"%s\",%.02f)",col, probs))) + ,collapse=",") + nquery <- sub("select (.*?) from",paste0("SELECT ",nexpr," FROM"),query,ignore.case=TRUE) if (.is.debug(x)) cat(paste0("EX: '",nquery,"'\n",sep="")) ret <- as.vector(dbGetQuery(attr(x,"conn"),nquery)[1,]) diff --git a/clients/R/monet.frame/db.tests/monetframe.test.R b/clients/R/monet.frame/db.tests/monetframe.test.R --- a/clients/R/monet.frame/db.tests/monetframe.test.R +++ b/clients/R/monet.frame/db.tests/monetframe.test.R @@ -1,4 +1,4 @@ -library(MonetDB.R) +library(monet.frame) con <- dbConnect(dbDriver("MonetDB"), "monetdb://localhost:50000/acs", "monetdb", "monetdb",timeout=100) _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list