Changeset: 267980fddca2 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=267980fddca2
Added Files:
        clients/R/MonetDB.R/DESCRIPTION
        clients/R/MonetDB.R/NAMESPACE
        clients/R/MonetDB.R/NEWS
        clients/R/MonetDB.R/R/control.R
        clients/R/MonetDB.R/R/monetdb.R
        clients/R/MonetDB.R/R/monetframe.R
        clients/R/MonetDB.R/man/MonetDB.R.Rd
        clients/R/MonetDB.R/man/aggregatef.Rd
        clients/R/MonetDB.R/man/as.data.frame.Rd
        clients/R/MonetDB.R/man/as.list.Rd
        clients/R/MonetDB.R/man/control.Rd
        clients/R/MonetDB.R/man/dbSendUpdate.Rd
        clients/R/MonetDB.R/man/mf.Rd
        clients/R/MonetDB.R/man/monet.frame.Rd
        clients/R/MonetDB.R/man/monetdb.read.csv.Rd
        clients/R/MonetDB.R/man/monetdbGetTransferredBytes.Rd
        clients/R/MonetDB.R/man/monetdbRtype.Rd
        clients/R/MonetDB.R/man/sample.Rd
        clients/R/MonetDB.R/man/sd.Rd
        clients/R/MonetDB.R/man/set.debug.Rd
        clients/R/MonetDB.R/man/tabulate.Rd
        clients/R/MonetDB.R/man/tabulate.monet.frame.Rd
        clients/R/MonetDB.R/man/var.Rd
        clients/R/MonetDB.R/src/Makevars.win
        clients/R/MonetDB.R/src/mapi.c
        clients/R/MonetDB.R/src/mapisplit.c
Branch: default
Log Message:

Import R Connector


diffs (truncated from 3697 to 300 lines):

diff --git a/clients/R/MonetDB.R/DESCRIPTION b/clients/R/MonetDB.R/DESCRIPTION
new file mode 100644
--- /dev/null
+++ b/clients/R/MonetDB.R/DESCRIPTION
@@ -0,0 +1,13 @@
+Package: MonetDB.R
+Version: 0.8.0
+Date: 2013-09-17
+Title: Connect MonetDB to R
+Authors@R: c(person("Hannes Muehleisen", "Developer", role = c("aut", 
"cre"),email = "han...@cwi.nl"),
+       person("Thomas Lumley", "Contributor", role = "ctb"),
+       person("Anthony Damico", "Contributor", role = "ctb"))
+Depends: DBI (>= 0.2-5), bitops (>= 1.0-4.2), digest (>= 0.6.0), methods, 
utils, stats
+Description: Allows to pull data from MonetDB into R
+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
\ No newline at end of file
diff --git a/clients/R/MonetDB.R/NAMESPACE b/clients/R/MonetDB.R/NAMESPACE
new file mode 100644
--- /dev/null
+++ b/clients/R/MonetDB.R/NAMESPACE
@@ -0,0 +1,86 @@
+import(DBI,utils,stats)
+
+# export only driver constructor, everything else is DBI stuff..
+export(MonetDB,MonetR,MonetDBR,MonetDB.R)
+export(monet.read.csv,monetdb.read.csv)
+# this one is not in the DBI
+exportMethods(dbSendUpdate,dbSendUpdateAsync)
+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
new file mode 100644
--- /dev/null
+++ b/clients/R/MonetDB.R/NEWS
@@ -0,0 +1,112 @@
+0.8
+- New All-C socket code (Thanks, Windows)
+- new dbConnect() parameter organization (!)
+- new mc() shorthand method for db connections
+
+0.7.10
+- More tip-toeing around in dbConnect()
+- More error-tolerant MAPI parsing
+
+0.7.9
+- Changes in dbConnect() error handling
+
+0.7.8
+- fix for [, large offsets are not translated to SQL correctly
+
+0.7.7
+- fix for aggregatef(), formula arguments were not evaluated in the right 
direction
+- support for mathematical operations on boolean columns
+
+0.7.6
+- fix for C implementation for line splitting
+
+0.7.5
+- more fetch() fixes
+
+0.7.4
+- string to line splitting to c, NA handling to C as well
+
+0.7.3
+- c implementation of very expensive function
+
+0.7.2
+- fetch() performance enhancements and bug fixes
+
+0.7.1
+- minor fixes to fetch() function from basic DBI
+
+0.7
+- some cran compatibility changes
+
+0.6.4
+- tabulate() support
+- unique() support
+- bugfix in subset()
+
+0.6.3
+- Quieter startup
+- dbSendQuery() now fails if the query is bogus
+- implemented dbGetException()
+
+0.6.2
+- subset() is back!
+
+0.6
+- merge() support from Anthony
+- CRAN cleanup
+- MonetDB control code for UNIX-like systems
+
+0.5.16
+- bugfixes in monet.frame
+
+0.5.15
+- rbind() support on monet.frame from Anthony
+
+0.5.14
+- sample() support on monet.frame
+
+0.5.13
+- bugfix in server control code from Anthony
+
+0.5.12
+- integrated formula-based aggregation from Anthony
+
+0.5.11
+- fixed a bug in aggregate() to allow count-aggregation on non-numeric columns
+
+0.5.10
+- MonetDB server control code (Windows) from Anthony Damico
+
+0.5.9
+- Increased default socket timeout to 24h. Rationale: Import jobs may take 
this long, and all operations can always be cancelled with CTRL-C
+
+0.5.8
+- aggregate() support in DB
+
+0.5.5
+- Column name, type and dimension hints for monet.frame, makes it faster
+
+0.5.4
+- Initial support for sort(), head(), tail(), summary(), var(), sd(), 
quantile() and median() in monet.frame
+- Changed str() implementation to not show sample data but column names/types 
instead
+
+0.5
+- first release aimed at CRAN publication
+- monet.frame virtual data object
+- various bugfixes
+- documentation
+- port in monetdb:// URI now optional, defaults to 50000
+
+0.4
+- make dbColumnInfo return the R-side data type as well as the Monet-side one.
+
+0.3
+- write support in dbSendQuery, new functions dbWriteTable and dbSendUpdate
+
+0.2
+- fixed handling of boolean values, now have proper R types
+- new parameter to dbConnect to specify connection timeout
+- check for empty responses in .mapiRead, now stop()s with a warning and some 
help
+
+0.1
+- initial version, basic read support
diff --git a/clients/R/MonetDB.R/R/control.R b/clients/R/MonetDB.R/R/control.R
new file mode 100644
--- /dev/null
+++ b/clients/R/MonetDB.R/R/control.R
@@ -0,0 +1,239 @@
+monetdb.server.start <-
+  function( bat.file ){
+    
+    if ( .Platform$OS.type == "unix" ) {
+      if( !file.exists( bat.file ) ) stop( paste( bat.file , "does not exist. 
Run monetdb.server.setup() to create a batch file." ) )
+      
+      # uugly, find path of pid file again by parsing shell script.
+      sc <- read.table(bat.file,sep="\n",stringsAsFactors=F)
+      pidfile <- substring(sc[[2,1]],11)
+      
+      # run script
+      system(bat.file,wait=T)
+      
+      # read pid from file
+      pid <- scan(pidfile,what=integer(),n=1)
+      return(pid)
+    } 
+    if ( .Platform$OS.type == "windows" ) {
+      
+      # capture the result of a `tasklist` system call
+      before.win.tasklist <- system2( 'tasklist' , stdout = TRUE )
+      
+      # store all pids before running the process
+      before.pids <- substr( before.win.tasklist[ -(1:3) ] , 27 , 35 )
+      
+      # run the process
+      shell.exec( bat.file )
+      
+      # start with an empty process id
+      correct.pid <- character( 0 )
+      
+      # keep trying until a new `mserver` process appears
+      while( length( correct.pid ) == 0 ){
+        
+        # capture the result of a `tasklist` system call
+        after.win.tasklist <- system2( 'tasklist' , stdout = TRUE )
+        
+        # store all tasks after running the process
+        after.tasks <- substr( after.win.tasklist[ -(1:3) ] , 1 , 25 )
+        
+        # store all pids after running the process
+        after.pids <- substr( after.win.tasklist[ -(1:3) ] , 27 , 35 )
+        
+        # store the number in the task list containing the PIDs you've just 
initiated
+        initiated.pid.positions <- which( !( after.pids %in% before.pids ) )
+        
+        # remove whitespace
+        after.tasks <- gsub( " " , "" , after.tasks )
+        
+        # find the pid position that matches the executable file name
+        correct.pid.position <- 
+          intersect(
+            grep( "mserver" , after.tasks ) ,
+            initiated.pid.positions 
+          )
+        
+        
+        # remove whitespace
+        correct.pid <- gsub( " " , "" , after.pids[ correct.pid.position ] )
+        
+      }
+      
+      # return the correct process ID
+      return( correct.pid )
+      # the process ID will then be used inside monet.kill() to end the 
mserver5.exe from within R
+    }
+    
+  }
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to