Package stacomirtools

Similar documents
Package stacomirtools

Package RODBCext. July 31, 2017

Package imgur. R topics documented: December 20, Type Package. Title Share plots using the imgur.com image hosting service. Version 0.1.

Package MDSGUI. February 19, 2015

Package datasets.load

Package TinnR. February 15, 2013

Package gsalib. R topics documented: February 20, Type Package. Title Utility Functions For GATK. Version 2.1.

Package orderbook. R topics documented: February 20, Type Package Title Orderbook visualization/charting software

Package iterators. December 12, 2017

Package TSzip. February 15, 2013

Package clipr. June 23, 2018

Package ETLUtils. February 15, 2013

Package lmesplines. R topics documented: February 20, Version

Package gcite. R topics documented: February 2, Type Package Title Google Citation Parser Version Date Author John Muschelli

Package sqliter. August 29, 2016

Package snpstatswriter

Package GetHFData. November 28, 2017

Package superbiclust

Package logitnorm. R topics documented: February 20, 2015

Package geojsonsf. R topics documented: January 11, Type Package Title GeoJSON to Simple Feature Converter Version 1.3.

Package rsdmx. September 21, 2018

Package AnDE. R topics documented: February 19, 2015

Package MicroStrategyR

Package eulerian. February 19, Index 5

Package AWR.Kinesis. February 26, 2017

Package aqr. February 15, Version 0.2. Date Title Interface methods to use with an ActiveQuant Master Server

Package smoother. April 16, 2015

Package dostats. R topics documented: August 29, Version Date Title Compute Statistics Helper Functions

Package recoder. R topics documented: July 10, Type Package Title A Simple and Flexible Recoder

Package ProgGUIinR. February 19, 2015

Package truncreg. R topics documented: August 3, 2016

Package knitlatex. August 29, 2016

Package RYoudaoTranslate

Package narray. January 28, 2018

Package datetimeutils

Package reval. May 26, 2015

Package kirby21.base

Package calpassapi. August 25, 2018

Package poplite. R topics documented: October 12, Version Date

Package gifti. February 1, 2018

Package Ohmage. R topics documented: February 19, 2015

Package RobustRankAggreg

Package R.rsp. January 11, 2018

Package RODBCDBI. August 29, 2016

Package gtrendsr. August 4, 2018

Package ptinpoly. February 20, 2015

Package genelistpie. February 19, 2015

Package promote. November 15, 2017

Package condusco. November 8, 2017

Package hypercube. December 15, 2017

Package IgorR. May 21, 2017

Package assertive.code

Package curry. September 28, 2016

Package dat. January 20, 2018

Package oasis. February 21, 2018

Package scraep. November 15, Index 6

Package simtool. August 29, 2016

Package datamap. February 19, 2015

Package gpdtest. February 19, 2015

Package QCAtools. January 3, 2017

Package rrdf. R topics documented: February 15, Type Package

Package tester. R topics documented: February 20, 2015

Package jstree. October 24, 2017

ODBC Setup MS Access 2007 Overview Microsoft Access 2007 can be utilized to create ODBC connections. This page will show you the steps to create an

Package APSIM. July 24, 2017

Package githubinstall

Package globalgsa. February 19, 2015

Package tmcn. June 12, 2017

Package wethepeople. March 3, 2013

Package raker. October 10, 2017

Package JGR. September 24, 2017

Package harvestr. R topics documented: August 29, 2016

Package egonet. February 19, 2015

Package MmgraphR. R topics documented: September 14, Type Package

Package FrF2.catlg128

Package gwfa. November 17, 2016

Package implyr. May 17, 2018

Package JBTools. R topics documented: June 2, 2015

Package wikitaxa. December 21, 2017

Package rngsetseed. February 20, 2015

Package dbx. July 5, 2018

Package hkclustering

Package snplist. December 11, 2017

Package postgistools

Package tibble. August 22, 2017

Package Segmentor3IsBack

Package mixexp. February 15, 2013

Package ezknitr. September 16, 2016

Package calibrar. August 29, 2016

Package labelvector. July 28, 2018

Package sessioninfo. June 21, 2017

Package scraep. July 3, Index 6

Package lvec. May 24, 2018

Package exporkit. R topics documented: May 5, Type Package Title Expokit in R Version Date

Package ggsubplot. February 15, 2013

Package mdftracks. February 6, 2017

Package pairsd3. R topics documented: August 29, Title D3 Scatterplot Matrices Version 0.1.0

Package influxdbr. January 10, 2018

Package horizon. R topics documented: July 3, Type Package Title Horizon Search Algorithm Version 1.2 Date Author Jasper Van doninck

Package postal. July 27, 2018

Transcription:

Package stacomirtools February 15, 2013 Type Package Title stacomi ODBC connection class Version 0.3 Date 2013-01-07 Author Cedric Briand Maintainer Cedric Briand<cedric.briand00@gmail.com> S4 class wrappers for ODBC connection. License GPL (>= 2) Collate ConnectionODBC.r RequeteODBC.r RequeteODBCwhere.r RequeteODBCwheredate.r utilitaires.r LazyLoad yes Depends RODBC,xtable,methods Repository CRAN Repository/R-Forge/Project stacomir Repository/R-Forge/Revision 113 Repository/R-Forge/DateTimeStamp 2013-01-07 09:14:52 Date/Publication 2013-01-07 17:56:02 NeedsCompilation no 1

2 chnames R topics documented: stacomirtools-package................................... 2 chnames........................................... 2 connect-methods...................................... 3 ConnectionODBC-class................................... 4 ex.............................................. 5 funhtml........................................... 5 induk............................................ 6 is.even............................................ 6 is.odd............................................ 7 killfactor........................................... 7 RequeteODBC-class.................................... 8 RequeteODBCwhere-class................................. 9 RequeteODBCwheredate-class............................... 10 tab2df............................................ 12 Index 13 stacomirtools-package RODBC connector class and some utilities Details This package contains S4 wrappers for ODBC connection and some utilities Package: stacomirtools Type: Package Version: 0.3 Date: 2012-12-23 License: GPL (>= 2) LazyLoad: yes chnames This function replaces the variable names in a data.frame

connect-methods 3 This function replaces the variable names in a data.frame Value chnames(objet, old_variable_name, new_variable_name) objet a data frame old_variable_name a character vector with old variables names new_variable_name a character vector with new variables names objet connect-methods Methods for Function connect see individual.r files for help and examples Methods signature(objet = "ConnectionODBC") connect an ODBC database,and eventually leaves it open for further queries, the connection may send message in the native language if stacomir package is in use signature(objet = "RequeteODBC") connect an ODBC database,performs an sql request signature(objet = "RequeteODBCwhere") connect an ODBC database,performs an sql request with where clause signature(objet = "RequeteODBCwheredate") connect an ODBC database,performs an sql request with where clause for an interval Examples showmethods("connect") ## #objet<-new("requeteodbcwhere") #connect(objet)

4 ConnectionODBC-class ConnectionODBC-class Class "ConnectionODBC" Mother class for connection, opens the connection but does not shut it Objects from the Class Slots Objects can be created by calls of the form new("connectionodbc",...). baseodbc: Object of class "vector" The database silent: Object of class "logical" The mode etat: Object of class "character" The state connection: Object of class "ANY" The connection baseodbc: Object of class "vector" The database silent: Object of class "logical" The mode etat: Object of class "character" The state connection: Object of class "ANY" The connection Methods Note connect signature(objet = "ConnectionODBC"): Connection to the database Opens the connection but does not close it. This function is intended to be used with stacomir package, where the error message are collected from the database It has also been programmed to work without the stacomir package, as it will test for the existence of envir_stacomi environment. cedric.briand"at"eptb-vilaine.fr Examples showclass("connectionodbc") ## Not run: # this is the mother class, you don t have to use it, please use requeteodbc and daughter class instead objet<-new("connectionodbc") objet@baseodbc<-c("myodbcconnection","myusername","mypassword") objet@silent<-false objet<-connect(objet) odbcclose(objet@connection) ## End(Not run)

ex 5 ex ex fonction to write to the clipboard ex fonction to write to the clipboard ex(d = NULL) d a dataframe funhtml function used to print the html tables of output (see xtable documentation) see xtable for further description, an xtable is created and printed to html format funhtml(data,caption=null,top=true,outfile=null,clipboard=false,append=true,digits=null,...) data a data frame caption the caption top a logical, if true the caption is placed on top outfile the path to the file clipboard if clipboard TRUE, a copy to the clipboard is made append is the file appended to the previous one? digits the number of digits... additional parameters to be passed to the function

6 is.even Value an xtable induk unique values of a vector returns the index of values appearing only once in a vector : match(unique(a),a), replicated values are not returned on their second occurence induk(a) a a vector Value the index unique values within a vector is.even is.even function modified from package sma is.even function modified from package sma (which did not verify that the entry was indeed an integer) is.even(x) x integer

is.odd 7 Value a logical Adapted from Henrik Bengtsson is.odd id.odd function modified from package sma id.odd function modified from package sma (which did not verify that the entry was indeed an integer) is.odd(x) x integer Value a logical Adapted from Henrik Bengtsson killfactor very usefull function remove factor that appear, noticeably after loading with ODBC function used to remove factors that appear, noticeably after loading with ODBC killfactor(df) df a data.frame

8 RequeteODBC-class Value df RequeteODBC-class Class "RequeteODBC" ODBC Query. This class enables to retrieve data from the database. This class is inherited by RequeteODBCwhere and RequeteODBCwheredate Objects from the Class Extends Objects can be created by calls of the form new("requeteodbc", sql=character(), query=data.frame()). baseodbc: Object of class "vector" The name, user and password of the database connection: Object of class "ANY" The connection etat: Object of class "character" The state of the query (Connecting, successful,...) silent: Object of class "logical" True if the query must be executed silently, FALSE sql: Object of class "character" The query query: Object of class "data.frame" The result of the query open: Object of class "logical" Should the connection remain open, choosing this ensures more rapid multiple queries Class "ConnectionODBC", directly. Methods Note connect signature(objet = "RequeteODBC"): Connection to the database Inherits from ConnectionODBC See Also cedric.briand"at"eptb-vilaine.fr ConnectionODBC RequeteODBCwhere RequeteODBCwheredate

RequeteODBCwhere-class 9 Examples showclass("requeteodbc") ## Not run: objet=new("requeteodbc") objet@open=true # this will leave the connection open, by default it closes after the query is sent #the following will work only if you have configured and ODBC link objet@baseodbc=c("myodbcconnection","myusername","mypassword") objet@sql= "select * from mytable limit 100" objet<-connect(objet) odbcclose(objet@connection) envir_stacomi=new.env() # While testing I like to see the output of sometimes complex queries generated by the program assign("showmerequest",1,envir_stacomi) # can be anything just tests the existence of "showmerequest" in envir objet=new("requeteodbc") objet@baseodbc=c("myodbcconnection","myusername","mypassword") objet@sql= "select * from mytable limit 100" objet<-connect(objet) # the connection is already closed, the query is printed ## End(Not run) RequeteODBCwhere-class Class "RequeteODBCwhere" SQL Query with WHERE and ORDER BY clauses. Objects from the Class Objects can be created by calls of the form new("requeteodbcwhere", where=character(),and=vector(),order_by=ch select: Object of class "character" The "SELECT" part of the query where: Object of class "character" The "WHERE" part of the query and: Object of class "vector" The "AND" part of the query order_by: Object of class "character" The "ORDER BY" part of the query sql: Object of class "character" The query built by aggregating "select","where","and", and "order_by" slots query: Object of class "data.frame" The result of the query open: Object of class "logical" Should the connection remain open, choosing this ensures more rapid multiple queries baseodbc: Object of class "vector" The name, user and password of the database silent: Object of class "logical" TRUE if the query must be executed silently, FALSE else etat: Object of class "character" The state of the query (Connecting, successful,...) connection: Object of class "ANY" The database connection

10 RequeteODBCwheredate-class Extends Class "RequeteODBC", directly. Class "ConnectionODBC", by class "RequeteODBC", distance 2. Methods connect signature(objet = "RequeteODBCwhere"): Connect to the database Note Inherits from RequeteODBC the syntax is where="where..." and =vector("and...","and...") order_by="order BY.." The query will syntax will be printed upon failure. cedric.briand"at"eptb-vilaine.fr See Also ConnectionODBC RequeteODBC RequeteODBCwheredate Examples showclass("requeteodbcwhere") ## Not run: test<-0 objet=new("requeteodbcwhere") objet@baseodbc=c("myodbcconnection","myusername","mypassword") objet@select= "select * from mytable limit 100" # assuming mycol, mycol1 and mycol2 are numeric objet@where=paste(" where mycol>",test,sep="") objet@and=paste(" and mycol2>",test," and mycol3<",test,sep="") objet@order_by=" order by mycol1" objet<-connect(objet) # now objet@sql contains the syntax of the query. By changing the test variable, one can see how the # function might be usefull # objet@query contains the resulting data.frame ## End(Not run) RequeteODBCwheredate-class Class "RequeteODBCwheredate" Query with WHERE condition and overlaping dates clause.

RequeteODBCwheredate-class 11 Objects from the Class Slots Extends Objects can be created by calls of the form new("requeteodbcwheredate", datedebut="posixlt",datefin="posixlt", datedebut: Object of class "POSIXlt" ~ The starting date datefin: Object of class "POSIXlt" ~ The ending date colonnedebut: Object of class "character" ~ The name begin column colonnefin: Object of class "character" ~ The name end column datedebut: Object of class "POSIXlt" ~ The starting date datefin: Object of class "POSIXlt" ~ The ending date colonnedebut: Object of class "character" ~ The name of the begin column colonnefin: Object of class "character" ~ The name of the end column where: Object of class "character" ~ The WHERE clause and: Object of class "vector" ~ The AND clause order_by: Object of class "character" ~ The ORDER BY clause sql: Object of class "character" ~ The SELECT clause query: Object of class "data.frame" ~ The result of the query baseodbc: Object of class "vector" ~ The database silent: Object of class "logical" ~ The mode etat: Object of class "character" ~ The state connection: Object of class "ANY" ~ The connection Class "RequeteODBCwhere", directly. Class "RequeteODBC", by class "RequeteODBCwhere", distance 2. Class "ConnectionODBC", by class "RequeteODBCwhere", distance 3. Methods Note connect signature(objet = "RequeteODBCwheredate"): Connexion to the database Inherits from RequeteODBCwhere and uses its connect method with a new SetAs. This function is only usefull in databases supporting the "overlaps" statement. See Also cedric.briand"at"eptb-vilaine.fr ConnectionODBC RequeteODBC RequeteODBCwhere

12 tab2df Examples showclass("requeteodbcwheredate") tab2df Function to transform a ftable into dataframe but just keeping the counts, works with ftable of dim 2 Function to transform a ftable into dataframe but just keeping the counts works with ftable of dim 2 tab2df(tab) tab a flat table

Index Topic classes ConnectionODBC-class, 4 RequeteODBC-class, 8 RequeteODBCwhere-class, 9 Topic methods connect-methods, 3 Topic package stacomirtools-package, 2 stacomirtools-package, 2 tab2df, 12 chnames, 2 connect (connect-methods), 3 connect,connectionodbc-method (connect-methods), 3 connect,requeteodbc-method (connect-methods), 3 connect,requeteodbcwhere-method (connect-methods), 3 connect,requeteodbcwheredate-method (connect-methods), 3 connect-methods, 3 ConnectionODBC, 8, 10, 11 ConnectionODBC (ConnectionODBC-class), 4 ConnectionODBC-class, 4 ex, 5 funhtml, 5 induk, 6 is.even, 6 is.odd, 7 killfactor, 7 RequeteODBC, 10, 11 RequeteODBC (RequeteODBC-class), 8 RequeteODBC-class, 8 RequeteODBCwhere, 8, 11 RequeteODBCwhere-class, 9 RequeteODBCwheredate, 8, 10 RequeteODBCwheredate-class, 10 13