Skip to content

Commit

Permalink
Database functions have been moved to the sqlutils package.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbryer committed Nov 20, 2012
1 parent 7cc7f8f commit 5eb6a10
Show file tree
Hide file tree
Showing 14 changed files with 6 additions and 278 deletions.
3 changes: 2 additions & 1 deletion .Rbuildignore
@@ -1 +1,2 @@
^\.Rproj\.user$
^\.Rproj\.user$
^.*\.Rproj$
5 changes: 3 additions & 2 deletions DESCRIPTION
Expand Up @@ -13,10 +13,11 @@ Depends:
xtable,
psych,
reshape,
utils
utils,
stringr,
roxygen2
Collate:
'age.R'
'dbaccess.R'
'irutils-package.R'
'saveIPEDStoDB.R'
'LocalRepos.R'
Expand Down
8 changes: 0 additions & 8 deletions NAMESPACE
@@ -1,23 +1,15 @@
S3method(xtable,demographics)
export(adjustedTableLaTeX)
export(cacheQuery)
export(createLocalRepos)
export(demographics)
export(execQuery)
export(getAge)
export(getAgeGroups)
export(getAgeGroupsIPEDS)
export(getParameters)
export(getQueries)
export(getQuery)
export(getQueryDesc)
export(getSQLRepos)
export(local.available.packages)
export(local.install.packages)
export(lsos)
export(pie)
export(saveIPEDStoDB)
export(setSQLRepos)
export(updateLocalRepos)
export(xtable.demographics)
import(ggplot2)
Expand Down
123 changes: 0 additions & 123 deletions R/dbaccess.R

This file was deleted.

6 changes: 1 addition & 5 deletions R/irutils-package.R
Expand Up @@ -17,9 +17,5 @@ cranMain <- 'http://cran.r-project.org' #Main CRAN
cranExtra <- 'http://www.stats.ox.ac.uk/pub/RWin' #Windows Binaries for some packages

.onAttach <- function(libname, pkgname) {
pkgEnv = pos.to.env(match('package:irutils', search()))
assign("sqlrepos",
value=paste(system.file(package='irutils'), '/data', sep=''),
envir=pkgEnv)
#sqlrepos <<- NULL
pkgEnv = pos.to.env(match('package:irutils', search()))
}
16 changes: 0 additions & 16 deletions man/cacheQuery.Rd

This file was deleted.

19 changes: 0 additions & 19 deletions man/execQuery.Rd

This file was deleted.

14 changes: 0 additions & 14 deletions man/getParameters.Rd

This file was deleted.

14 changes: 0 additions & 14 deletions man/getQueries.Rd

This file was deleted.

13 changes: 0 additions & 13 deletions man/getQuery.Rd

This file was deleted.

13 changes: 0 additions & 13 deletions man/getQueryDesc.Rd

This file was deleted.

13 changes: 0 additions & 13 deletions man/getSQLRepos.Rd

This file was deleted.

13 changes: 0 additions & 13 deletions man/setSQLRepos.Rd

This file was deleted.

24 changes: 0 additions & 24 deletions vignettes/irutils.Rnw
Expand Up @@ -63,30 +63,6 @@ ls('package:irutils')



\section{Database Access}

For many Institutional Research offices the institutions student information system (SIS) is the most common source of data. Since virtually all SIS systems are backed by a database, extracting data requires extracting data using queries. Typically the language used to extract data is called structured query language (SQL) regardless if the database is provided by Oracle, Microsoft, or an open source options such as MySQL and PostgreSQL. There are a number of functions in this package that will faciliate extracting data from these databases directly into R.

The database access functions provide an interface to a directory of SQL scripts. SQL scripts are simply a plain text file containing the query. The directory containing these files can be determined or set using the \texttt{getSQLRepos} and \texttt{setSQLRepos} functions, repsectively.

<<getSQLRepos,eval=TRUE>>=
getSQLRepos()
@

By convention, all SQL files must use a \texttt{.sql} file extension. The \texttt{getQueries} function will return a list of all the queries available in the current reposistory.

<<getQueries,eval=TRUE>>=
getQueries()
@

The \texttt{getQueryDesc} and \texttt{getParameters} functions will provide some details about the query in question. In particular, the latter will return the parameters that are required for the query to execute.

<<eval=TRUE>>=
getQueryDesc('TestQuery')
getParameters('TestQuery')
@

There are two functions available for executing the query. The \texttt{execQuery} will execute the query and return a data frame. The \texttt{cacheQuery} however, will first look in the specified directory (by default the \texttt{dir} parameter is set to \texttt{getwd()}) for a CSV file that matches the currently request query. That is, the file name (which is returned when this function is executed) is built using a combination of the query name and parameters to uniquely identify it. This is useful when using Sweave and \LaTeX for document preparation where the function may be executed multiple times but the data does not change. It is considerably faster to read data from a flat file then it is to query the database each time.

\subsection{Creating Your Own Query}

Expand Down

0 comments on commit 5eb6a10

Please sign in to comment.