Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added PostgreSQL support

  • Loading branch information...
commit df78bdc8361f0f9048e0a6c8e66873e8aee1e4fc 1 parent 11b8a04
@johnmyleswhite authored
Showing with 750 additions and 510 deletions.
  1. +1 −0  .gitignore
  2. +7 −0 ChangeLog
  3. +4 −3 DESCRIPTION
  4. BIN  ProjectTemplate_0.3-5.tar.gz
  5. BIN  ProjectTemplate_0.3-6.tar.gz
  6. +30 −1 R/extensions.dispatch.table.R
  7. +1 −5 R/spss.reader.R
  8. +23 −2 R/sql.reader.R
  9. +1 −0  TODO.markdown
  10. +12 −13 man/ProjectTemplate.Rd
  11. +17 −11 man/arff.reader.Rd
  12. +16 −13 man/cache.Rd
  13. +14 −11 man/cache.name.Rd
  14. +9 −8 man/cache.project.Rd
  15. +14 −12 man/clean.variable.name.Rd
  16. +26 −20 man/create.project.Rd
  17. +19 −13 man/csv.reader.Rd
  18. +19 −13 man/db.reader.Rd
  19. +19 −13 man/dbf.reader.Rd
  20. +19 −13 man/epiinfo.reader.Rd
  21. +1 −6 man/extensions.dispatch.table.Rd
  22. +21 −14 man/file.reader.Rd
  23. +9 −8 man/load.project.Rd
  24. +19 −13 man/mp3.reader.Rd
  25. +19 −14 man/mtp.reader.Rd
  26. +19 −13 man/octave.reader.Rd
  27. +19 −13 man/ppm.reader.Rd
  28. +19 −13 man/r.reader.Rd
  29. +19 −13 man/rdata.reader.Rd
  30. +9 −8 man/reload.project.Rd
  31. +10 −9 man/run.project.Rd
  32. +9 −8 man/show.project.Rd
  33. +19 −13 man/spss.reader.Rd
  34. +25 −14 man/sql.reader.Rd
  35. +19 −13 man/stata.reader.Rd
  36. +9 −8 man/stub.tests.Rd
  37. +19 −13 man/systat.reader.Rd
  38. +9 −8 man/test.project.Rd
  39. +14 −12 man/translate.dcf.Rd
  40. +19 −13 man/tsv.reader.Rd
  41. +21 −14 man/url.reader.Rd
  42. +19 −13 man/wsv.reader.Rd
  43. +19 −13 man/xls.reader.Rd
  44. +19 −13 man/xlsx.reader.Rd
  45. +19 −13 man/xport.reader.Rd
  46. +2 −0  roxygenate.R
  47. +1 −0  website/TODO.html
  48. +2 −1  website/index.html
  49. +2 −1  website/index.markdown
  50. BIN  website/logging.jpg
  51. +45 −32 website/mastering.html
  52. +44 −33 website/mastering.markdown
  53. BIN  website/mastering1.jpg
  54. BIN  website/mastering2.jpg
  55. BIN  website/mastering3.jpg
  56. BIN  website/mastering4.jpg
  57. BIN  website/mastering5.jpg
  58. BIN  website/mastering6.jpg
  59. BIN  website/mastering7.jpg
  60. BIN  website/philapd.db.zip
  61. BIN  website/unit_tests.jpg
View
1  .gitignore
@@ -6,3 +6,4 @@ data_examples
ideas
website/README.markdown
website/TODO.markdown
+db
View
7 ChangeLog
@@ -1,3 +1,10 @@
+2011-07-13 John Myles White <jmw@johnmyleswhite.com>
+
+* v0.3-6
+* Added Postgres support through RPostgreSQL
+* Assume '.dat' files are '.wsv' files.
+* Revised documentation.
+
2011-07-08 John Myles White <jmw@johnmyleswhite.com>
* v0.3-5
View
7 DESCRIPTION
@@ -2,8 +2,8 @@ Package: ProjectTemplate
Type: Package
Title: Automates the creation of new statistical analysis
projects.
-Version: 0.3-5
-Date: 2011-07-08
+Version: 0.3-6
+Date: 2011-07-13
Author: John Myles White
Maintainer: John Myles White <jmw@johnmyleswhite.com>
Description: ProjectTemplate provides functions to
@@ -31,7 +31,8 @@ Suggests:
RODBC,
tuneR,
pixmap,
- data.table
+ data.table,
+ RPostgreSQL
URL: http://projecttemplate.net
Collate:
'arff.reader.R'
View
BIN  ProjectTemplate_0.3-5.tar.gz
Binary file not shown
View
BIN  ProjectTemplate_0.3-6.tar.gz
Binary file not shown
View
31 R/extensions.dispatch.table.R
@@ -4,6 +4,29 @@
#' extensions for the file types supported by ProjectTemplate to the
#' reader functions that implement autoloading for those formats. Any
#' new file type must be appended to this dispatch table.
+#'
+#' @include R/arff.reader.R
+#' @include R/csv.reader.R
+#' @include R/db.reader.R
+#' @include R/dbf.reader.R
+#' @include R/epiinfo.reader.R
+#' @include R/file.reader.R
+#' @include R/mp3.reader.R
+#' @include R/mtp.reader.R
+#' @include R/octave.reader.R
+#' @include R/ppm.reader.R
+#' @include R/r.reader.R
+#' @include R/rdata.reader.R
+#' @include R/spss.reader.R
+#' @include R/sql.reader.R
+#' @include R/stata.reader.R
+#' @include R/systat.reader.R
+#' @include R/tsv.reader.R
+#' @include R/url.reader.R
+#' @include R/wsv.reader.R
+#' @include R/xls.reader.R
+#' @include R/xlsx.reader.R
+#' @include R/xport.reader.R
extensions.dispatch.table <- list("\\.csv$" = ProjectTemplate:::csv.reader,
"\\.csv.bz2$" = ProjectTemplate:::csv.reader,
"\\.csv.zip$" = ProjectTemplate:::csv.reader,
@@ -46,4 +69,10 @@ extensions.dispatch.table <- list("\\.csv$" = ProjectTemplate:::csv.reader,
"\\.db$" = ProjectTemplate:::db.reader,
"\\.file$" = ProjectTemplate:::file.reader,
"\\.mp3$" = ProjectTemplate:::mp3.reader,
- "\\.ppm$" = ProjectTemplate:::ppm.reader)
+ "\\.ppm$" = ProjectTemplate:::ppm.reader,
+ "\\.xpt$" = ProjectTemplate:::xport.reader,
+ "\\.dat$" = ProjectTemplate:::wsv.reader,
+ "\\.dat.bz2$" = ProjectTemplate:::wsv.reader,
+ "\\.dat.zip$" = ProjectTemplate:::wsv.reader,
+ "\\.dat.gz$" = ProjectTemplate:::wsv.reader)
+
View
6 R/spss.reader.R
@@ -18,11 +18,7 @@ spss.reader <- function(data.file, filename, variable.name)
{
library('foreign')
- #assign(variable.name,
- # read.spss(filename),
- # envir = .GlobalEnv)
-
assign(variable.name,
- as.data.frame(read.spss(filename)),
+ read.spss(filename, to.data.frame = TRUE),
envir = .GlobalEnv)
}
View
25 R/sql.reader.R
@@ -32,6 +32,14 @@
#' dbname: /path/to/sample_database
#' table: *
#'
+#' Example 5
+#' type: postgres
+#' user: sample_user
+#' password: sample_password
+#' host: localhost
+#' dbname: sample_database
+#' table: sample_table
+#'
#' @param data.file The name of the data file to be read.
#' @param filename The path to the data set to be loaded.
#' @param variable.name The name to be assigned to in the global environment.
@@ -46,9 +54,9 @@ sql.reader <- function(data.file, filename, variable.name)
{
database.info <- ProjectTemplate:::translate.dcf(filename)
- if (! (database.info[['type']] %in% c('mysql', 'sqlite', 'odbc')))
+ if (! (database.info[['type']] %in% c('mysql', 'sqlite', 'odbc', 'postgres')))
{
- warning('Only databases reachable through RMySQL, RSQLite and RODBC are currently supported.')
+ warning('Only databases reachable through RMySQL, RSQLite, RODBC or RPostgreSQL are currently supported.')
assign(variable.name,
NULL,
envir = .GlobalEnv)
@@ -66,6 +74,7 @@ sql.reader <- function(data.file, filename, variable.name)
assign(variable.name,
results,
envir = .GlobalEnv)
+ return()
}
if (database.info[['type']] == 'mysql')
@@ -89,6 +98,18 @@ sql.reader <- function(data.file, filename, variable.name)
dbname = database.info[['dbname']])
}
+ if (database.info[['type']] == 'postgres')
+ {
+ library('RPostgreSQL')
+ mysql.driver <- dbDriver("PostgreSQL")
+
+ connection <- dbConnect(mysql.driver,
+ user = database.info[['user']],
+ password = database.info[['password']],
+ host = database.info[['host']],
+ dbname = database.info[['dbname']])
+ }
+
# Added support for queries.
# User should specify either a table name or a query to execute, but not both.
table <- database.info[['table']]
View
1  TODO.markdown
@@ -43,6 +43,7 @@
* Make `data.table` integration more powerful.
* Integrate `sqldf`?
* Integrate `bigmemory` or `ff`?
+* Automatic date conversion using lubridate.
## Cache Changes?
* Invalidate a file in `cache` if the matching file in `data` is more recently modified?
View
25 man/ProjectTemplate.Rd
@@ -1,25 +1,24 @@
+\docType{package}
\name{ProjectTemplate}
+\alias{"package-ProjectTemplate"}
+\alias{ProjectTemplate}
\title{Automates the creation of new statistical analysis projects.}
-
\description{
- Automates the creation of new statistical analysis
- projects.
-}
-
-\details{
ProjectTemplate provides functions to automatically build
a directory structure for a new R project. Using this
structure, ProjectTemplate automates data loading,
preprocessing, library importing and unit testing.
}
-\references{This code is inspired by the skeleton structure used by
-Ruby on Rails.}
-\docType{package}
-\alias{ProjectTemplate}
-\alias{package-ProjectTemplate}
-\examples{library('ProjectTemplate')
+\examples{
+library('ProjectTemplate')
#create.project('project_name')
#setwd('project_name')
-#load.project()}
+#load.project()
+}
+\references{
+ This code is inspired by the skeleton structure used by
+ Ruby on Rails.
+}
+
View
28 man/arff.reader.Rd
@@ -1,20 +1,26 @@
\name{arff.reader}
\alias{arff.reader}
\title{Read the Weka file format.}
-\usage{arff.reader(data.file, filename, variable.name)}
-
-\description{
- Read the Weka file format.
+\usage{
+ arff.reader(data.file, filename, variable.name)
}
+\arguments{
+ \item{data.file}{The name of the data file to be read.}
-\details{
+ \item{filename}{The path to the data set to be loaded.}
+
+ \item{variable.name}{The name to be assigned to in the
+ global environment.}
+}
+\value{
+ No value is returned; this function is called for its
+ side effects.
+}
+\description{
This function will load a data set stored in the Weka
file format into the specified global variable binding.
}
-\value{No value is returned; this function is called for its side effects.}
-\arguments{
- \item{data.file}{The name of the data file to be read.}
- \item{filename}{The path to the data set to be loaded.}
- \item{variable.name}{The name to be assigned to in the global environment.}
+\examples{
+#arff.reader('example.arff', 'data/example.arff', 'example')
}
-\examples{#arff.reader('example.arff', 'data/example.arff', 'example')}
+
View
29 man/cache.Rd
@@ -1,25 +1,26 @@
\name{cache}
\alias{cache}
\title{Cache a data set for faster loading.}
-\usage{cache(variable)}
-
-\description{
- Cache a data set for faster loading.
+\usage{
+ cache(variable)
}
-
-\details{
+\arguments{
+ \item{variable}{A character vector containing the name of
+ the variable to be saved.}
+}
+\value{
+ No value is returned; this function is called for its
+ side effects.
+}
+\description{
This function will store a copy of the named data set in
the \code{cache} directory. This cached copy of the data
set will then be given precedence at load time when
calling \code{\link{load.project}}. Cached data sets are
stored as \code{.RData} files.
}
-\value{No value is returned; this function is called for its side effects.}
-\arguments{
- \item{variable}{A character vector containing the name of the variable to
-be saved.}
-}
-\examples{library('ProjectTemplate')
+\examples{
+library('ProjectTemplate')
#create.project('tmp-project')
#setwd('tmp-project')
@@ -28,4 +29,6 @@ be saved.}
#cache('dataset1')
#setwd('..')
-#unlink('tmp-project')}
+#unlink('tmp-project')
+}
+
View
25 man/cache.name.Rd
@@ -1,20 +1,23 @@
\name{cache.name}
\alias{cache.name}
\title{Translate a variable name into a file name for caching.}
-\usage{cache.name(data.filename)}
-
-\description{
- Translate a variable name into a file name for caching.
+\usage{
+ cache.name(data.filename)
}
-
-\details{
+\arguments{
+ \item{data.filename}{The variable name to be translated
+ into a filename.}
+}
+\value{
+ A translated variable name.
+}
+\description{
This function will translate a variable name into a form
that is suitable as a filename on most OS's.
}
-\value{A translated variable name.}
-\arguments{
- \item{data.filename}{The variable name to be translated into a filename.}
+\examples{
+library('ProjectTemplate')
+
+#cache.name('example.1')
}
-\examples{library('ProjectTemplate')
-#cache.name('example.1')}
View
17 man/cache.project.Rd
@@ -1,12 +1,11 @@
\name{cache.project}
\alias{cache.project}
\title{Cache a project's data sets in binary format.}
-
-\description{
- Cache a project's data sets in binary format.
+\value{
+ No value is returned; this function is called for its
+ side effects.
}
-
-\details{
+\description{
This function will cache all of the data sets that were
loaded by the \code{\link{load.project}} function in a
binary format that is easier to load quickly. This is
@@ -14,8 +13,10 @@
during a slow munging process that does not need to be
repeated.
}
-\value{No value is returned; this function is called for its side effects.}
-\examples{library('ProjectTemplate')
+\examples{
+library('ProjectTemplate')
#load.project()
-#cache.project()}
+#cache.project()
+}
+
View
26 man/clean.variable.name.Rd
@@ -1,24 +1,26 @@
\name{clean.variable.name}
\alias{clean.variable.name}
\title{Translate a file name into a valid R variable name.}
-\usage{clean.variable.name(variable.name)}
-
-\description{
- Translate a file name into a valid R variable name.
+\usage{
+ clean.variable.name(variable.name)
}
-
-\details{
+\arguments{
+ \item{variable.name}{A character vector containing a
+ variable's proposed name that should be standardized.}
+}
+\value{
+ A translated variable name.
+}
+\description{
This function will translate a file name into a name that
is a valid variable name in R. Non-alphabetic characters
on the boundaries of the file name will be stripped;
non-alphabetic characters inside of the file name will be
replaced with dots.
}
-\value{A translated variable name.}
-\arguments{
- \item{variable.name}{A character vector containing a variable's proposed
-name that should be standardized.}
+\examples{
+library('ProjectTemplate')
+
+#clean.variable.name('example_1')
}
-\examples{library('ProjectTemplate')
-#clean.variable.name('example_1')}
View
46 man/create.project.Rd
@@ -1,14 +1,30 @@
\name{create.project}
\alias{create.project}
\title{Create a new project.}
-\usage{create.project(project.name="new-project", minimal=FALSE,
- dump=FALSE)}
-
-\description{
- Create a new project.
+\usage{
+ create.project(project.name = "new-project", minimal =
+ FALSE, dump = FALSE)
}
+\arguments{
+ \item{project.name}{A character vector containing the
+ name for this new project. Must be a valid directory name
+ for your file system.}
-\details{
+ \item{minimal}{A boolean value indicating whether to
+ create a minimal project or a full project. A minimal
+ project contains only the directories strictly necessary
+ to use ProjectTemplate and does not provide template code
+ for profiling, unit testing or documenting your project.}
+
+ \item{dump}{A boolean value indicating whether the entire
+ functionality of ProjectTemplate should be written out to
+ flat files in the current project.}
+}
+\value{
+ No value is returned; this function is called for its
+ side effects.
+}
+\description{
This function will create all of the scaffolding for a
new project. It will set up all of the relevant
directories and their initial contents. For those who
@@ -19,19 +35,9 @@
directory for extensive customization, the \code{dump}
argument can be set to \code{TRUE}.
}
-\value{No value is returned; this function is called for its side effects.}
-\arguments{
- \item{project.name}{A character vector containing the name for this new
-project. Must be a valid directory name for your file system.}
- \item{minimal}{A boolean value indicating whether to create a minimal
-project or a full project. A minimal project contains only the
-directories strictly necessary to use ProjectTemplate and does not
-provide template code for profiling, unit testing or documenting your
-project.}
- \item{dump}{A boolean value indicating whether the entire functionality
-of ProjectTemplate should be written out to flat files in the current
-project.}
+\examples{
+library('ProjectTemplate')
+
+#create.project('MyProject')
}
-\examples{library('ProjectTemplate')
-#create.project('MyProject')}
View
32 man/csv.reader.Rd
@@ -1,22 +1,28 @@
\name{csv.reader}
\alias{csv.reader}
-\title{Read a comma separated values (...}
-\usage{csv.reader(data.file, filename, variable.name)}
-
-\description{
- Read a comma separated values (.csv) file.
+\title{Read a comma separated values (.csv) file.}
+\usage{
+ csv.reader(data.file, filename, variable.name)
}
+\arguments{
+ \item{data.file}{The name of the data file to be read.}
-\details{
+ \item{filename}{The path to the data set to be loaded.}
+
+ \item{variable.name}{The name to be assigned to in the
+ global environment.}
+}
+\value{
+ No value is returned; this function is called for its
+ side effects.
+}
+\description{
This function will load a data set stored in the CSV file
format into the specified global variable binding.
}
-\value{No value is returned; this function is called for its side effects.}
-\arguments{
- \item{data.file}{The name of the data file to be read.}
- \item{filename}{The path to the data set to be loaded.}
- \item{variable.name}{The name to be assigned to in the global environment.}
+\examples{
+library('ProjectTemplate')
+
+#csv.reader('example.csv', 'data/example.csv', 'example')
}
-\examples{library('ProjectTemplate')
-#csv.reader('example.csv', 'data/example.csv', 'example')}
View
32 man/db.reader.Rd
@@ -1,25 +1,31 @@
\name{db.reader}
\alias{db.reader}
-\title{Read a SQlite3 database with a (...}
-\usage{db.reader(data.file, filename, variable.name)}
-
-\description{
- Read a SQlite3 database with a (.db) file extension.
+\title{Read a SQlite3 database with a (.db) file extension.}
+\usage{
+ db.reader(data.file, filename, variable.name)
}
+\arguments{
+ \item{data.file}{The name of the data file to be read.}
-\details{
+ \item{filename}{The path to the data set to be loaded.}
+
+ \item{variable.name}{The name to be assigned to in the
+ global environment.}
+}
+\value{
+ No value is returned; this function is called for its
+ side effects.
+}
+\description{
This function will load all of the data sets stored in
the SQlite3 database into the global environment. If you
want to specify a single table or query to execute
against the database, move it elsewhere and use a .sql
file interpreted by \code{\link{sql.reader}}.
}
-\value{No value is returned; this function is called for its side effects.}
-\arguments{
- \item{data.file}{The name of the data file to be read.}
- \item{filename}{The path to the data set to be loaded.}
- \item{variable.name}{The name to be assigned to in the global environment.}
+\examples{
+library('ProjectTemplate')
+
+#db.reader('example.db', 'data/example.db', 'example')
}
-\examples{library('ProjectTemplate')
-#db.reader('example.db', 'data/example.db', 'example')}
View
32 man/dbf.reader.Rd
@@ -1,22 +1,28 @@
\name{dbf.reader}
\alias{dbf.reader}
-\title{Read an XBASE file with a...}
-\usage{dbf.reader(data.file, filename, variable.name)}
-
-\description{
- Read an XBASE file with a .dbf file extension.
+\title{Read an XBASE file with a .dbf file extension.}
+\usage{
+ dbf.reader(data.file, filename, variable.name)
}
+\arguments{
+ \item{data.file}{The name of the data file to be read.}
-\details{
+ \item{filename}{The path to the data set to be loaded.}
+
+ \item{variable.name}{The name to be assigned to in the
+ global environment.}
+}
+\value{
+ No value is returned; this function is called for its
+ side effects.
+}
+\description{
This function will load all of the data sets stored in
the specified XBASE file into the global environment.
}
-\value{No value is returned; this function is called for its side effects.}
-\arguments{
- \item{data.file}{The name of the data file to be read.}
- \item{filename}{The path to the data set to be loaded.}
- \item{variable.name}{The name to be assigned to in the global environment.}
+\examples{
+library('ProjectTemplate')
+
+#dbf.reader('example.dbf', 'data/example.dbf', 'example')
}
-\examples{library('ProjectTemplate')
-#dbf.reader('example.dbf', 'data/example.dbf', 'example')}
View
32 man/epiinfo.reader.Rd
@@ -1,22 +1,28 @@
\name{epiinfo.reader}
\alias{epiinfo.reader}
-\title{Read an Epi Info file with a...}
-\usage{epiinfo.reader(data.file, filename, variable.name)}
-
-\description{
- Read an Epi Info file with a .rec file extension.
+\title{Read an Epi Info file with a .rec file extension.}
+\usage{
+ epiinfo.reader(data.file, filename, variable.name)
}
+\arguments{
+ \item{data.file}{The name of the data file to be read.}
-\details{
+ \item{filename}{The path to the data set to be loaded.}
+
+ \item{variable.name}{The name to be assigned to in the
+ global environment.}
+}
+\value{
+ No value is returned; this function is called for its
+ side effects.
+}
+\description{
This function will load all of the data sets stored in
the specified Epi Info file into the global environment.
}
-\value{No value is returned; this function is called for its side effects.}
-\arguments{
- \item{data.file}{The name of the data file to be read.}
- \item{filename}{The path to the data set to be loaded.}
- \item{variable.name}{The name to be assigned to in the global environment.}
+\examples{
+library('ProjectTemplate')
+
+#epiinfo.reader('example.rec', 'data/example.rec', 'example')
}
-\examples{library('ProjectTemplate')
-#epiinfo.reader('example.rec', 'data/example.rec', 'example')}
View
7 man/extensions.dispatch.table.Rd
@@ -1,16 +1,11 @@
\name{extensions.dispatch.table}
\alias{extensions.dispatch.table}
\title{Maps file types to the reader functions used to autoload them.}
-
\description{
- Maps file types to the reader functions used to autoload
- them.
-}
-
-\details{
This list stores a mapping from regular expressions that
match file extensions for the file types supported by
ProjectTemplate to the reader functions that implement
autoloading for those formats. Any new file type must be
appended to this dispatch table.
}
+
View
35 man/file.reader.Rd
@@ -1,19 +1,29 @@
\name{file.reader}
\alias{file.reader}
-\title{Read an arbitrary file described in a...}
-\usage{file.reader(data.file, filename, variable.name)}
-
-\description{
- Read an arbitrary file described in a .file file.
+\title{Read an arbitrary file described in a .file file.}
+\usage{
+ file.reader(data.file, filename, variable.name)
}
+\arguments{
+ \item{data.file}{The name of the data file to be read.}
-\details{
+ \item{filename}{The path to the data set to be loaded.}
+
+ \item{variable.name}{The name to be assigned to in the
+ global environment.}
+}
+\value{
+ No value is returned; this function is called for its
+ side effects.
+}
+\description{
This function will load all of the data sets described in
the specified .file file into the global environment. A
.file file must contain DCF that specifies the path to
the data set and which extension should be used from the
dispatch table to load the data set.
-
+}
+\details{
Examples of the DCF format and settings used in a .file
file are shown below:
@@ -21,12 +31,9 @@
http://www.johnmyleswhite.com/ProjectTemplate/sample_data.csv
extension: csv
}
-\value{No value is returned; this function is called for its side effects.}
-\arguments{
- \item{data.file}{The name of the data file to be read.}
- \item{filename}{The path to the data set to be loaded.}
- \item{variable.name}{The name to be assigned to in the global environment.}
+\examples{
+library('ProjectTemplate')
+
+#file.reader('example.file', 'data/example.file', 'example')
}
-\examples{library('ProjectTemplate')
-#file.reader('example.file', 'data/example.file', 'example')}
View
17 man/load.project.Rd
@@ -1,16 +1,17 @@
\name{load.project}
\alias{load.project}
\title{Automatically load data and packages for a project.}
-
-\description{
- Automatically load data and packages for a project.
+\value{
+ No value is returned; this function is called for its
+ side effects.
}
-
-\details{
+\description{
This function automatically load all of the data and
packages used by the project from which it is called.
}
-\value{No value is returned; this function is called for its side effects.}
-\examples{library('ProjectTemplate')
+\examples{
+library('ProjectTemplate')
+
+#load.project()
+}
-#load.project()}
View
32 man/mp3.reader.Rd
@@ -1,23 +1,29 @@
\name{mp3.reader}
\alias{mp3.reader}
-\title{Read an MP3 file with a...}
-\usage{mp3.reader(data.file, filename, variable.name)}
-
-\description{
- Read an MP3 file with a .mp3 file extension.
+\title{Read an MP3 file with a .mp3 file extension.}
+\usage{
+ mp3.reader(data.file, filename, variable.name)
}
+\arguments{
+ \item{data.file}{The name of the data file to be read.}
-\details{
+ \item{filename}{The path to the data set to be loaded.}
+
+ \item{variable.name}{The name to be assigned to in the
+ global environment.}
+}
+\value{
+ No value is returned; this function is called for its
+ side effects.
+}
+\description{
This function will load the specified MP3 file into
memory using the tuneR package. This is useful for
working with music files as a data set.
}
-\value{No value is returned; this function is called for its side effects.}
-\arguments{
- \item{data.file}{The name of the data file to be read.}
- \item{filename}{The path to the data set to be loaded.}
- \item{variable.name}{The name to be assigned to in the global environment.}
+\examples{
+library('ProjectTemplate')
+
+#mp3.reader('example.mp3', 'data/example.mp3', 'example')
}
-\examples{library('ProjectTemplate')
-#mp3.reader('example.mp3', 'data/example.mp3', 'example')}
View
33 man/mtp.reader.Rd
@@ -1,23 +1,28 @@
\name{mtp.reader}
\alias{mtp.reader}
-\title{Read a Minitab Portable Worksheet with an...}
-\usage{mtp.reader(data.file, filename, variable.name)}
-
-\description{
- Read a Minitab Portable Worksheet with an .mtp3 file
- extension.
+\title{Read a Minitab Portable Worksheet with an .mtp3 file extension.}
+\usage{
+ mtp.reader(data.file, filename, variable.name)
}
+\arguments{
+ \item{data.file}{The name of the data file to be read.}
-\details{
+ \item{filename}{The path to the data set to be loaded.}
+
+ \item{variable.name}{The name to be assigned to in the
+ global environment.}
+}
+\value{
+ No value is returned; this function is called for its
+ side effects.
+}
+\description{
This function will load the specified Minitab Portable
Worksheet into memory.
}
-\value{No value is returned; this function is called for its side effects.}
-\arguments{
- \item{data.file}{The name of the data file to be read.}
- \item{filename}{The path to the data set to be loaded.}
- \item{variable.name}{The name to be assigned to in the global environment.}
+\examples{
+library('ProjectTemplate')
+
+#mtp.reader('example.mtp', 'data/example.mtp', 'example')
}
-\examples{library('ProjectTemplate')
-#mtp.reader('example.mtp', 'data/example.mtp', 'example')}
View
32 man/octave.reader.Rd
@@ -1,22 +1,28 @@
\name{octave.reader}
\alias{octave.reader}
-\title{Read an Octave file with a...}
-\usage{octave.reader(data.file, filename, variable.name)}
-
-\description{
- Read an Octave file with a .m file extension.
+\title{Read an Octave file with a .m file extension.}
+\usage{
+ octave.reader(data.file, filename, variable.name)
}
+\arguments{
+ \item{data.file}{The name of the data file to be read.}
-\details{
+ \item{filename}{The path to the data set to be loaded.}
+
+ \item{variable.name}{The name to be assigned to in the
+ global environment.}
+}
+\value{
+ No value is returned; this function is called for its
+ side effects.
+}
+\description{
This function will load the specified Octave file into
memory.
}
-\value{No value is returned; this function is called for its side effects.}
-\arguments{
- \item{data.file}{The name of the data file to be read.}
- \item{filename}{The path to the data set to be loaded.}
- \item{variable.name}{The name to be assigned to in the global environment.}
+\examples{
+library('ProjectTemplate')
+
+#octave.reader('example.m', 'data/example.m', 'example')
}
-\examples{library('ProjectTemplate')
-#octave.reader('example.m', 'data/example.m', 'example')}
View
32 man/ppm.reader.Rd
@@ -1,23 +1,29 @@
\name{ppm.reader}
\alias{ppm.reader}
-\title{Read a PPM file with a...}
-\usage{ppm.reader(data.file, filename, variable.name)}
-
-\description{
- Read a PPM file with a .ppm file extension.
+\title{Read a PPM file with a .ppm file extension.}
+\usage{
+ ppm.reader(data.file, filename, variable.name)
}
+\arguments{
+ \item{data.file}{The name of the data file to be read.}
-\details{
+ \item{filename}{The path to the data set to be loaded.}
+
+ \item{variable.name}{The name to be assigned to in the
+ global environment.}
+}
+\value{
+ No value is returned; this function is called for its
+ side effects.
+}
+\description{
This function will load the specified PPM file into
memory using the pixamp package. This is useful for
working with image files as a data set.
}
-\value{No value is returned; this function is called for its side effects.}
-\arguments{
- \item{data.file}{The name of the data file to be read.}
- \item{filename}{The path to the data set to be loaded.}
- \item{variable.name}{The name to be assigned to in the global environment.}
+\examples{
+library('ProjectTemplate')
+
+#ppm.reader('example.ppm', 'data/example.ppm', 'example')
}
-\examples{library('ProjectTemplate')
-#ppm.reader('example.ppm', 'data/example.ppm', 'example')}
View
32 man/r.reader.Rd
@@ -1,24 +1,30 @@
\name{r.reader}
\alias{r.reader}
-\title{Read an R source file with a...}
-\usage{r.reader(data.file, filename, variable.name)}
-
-\description{
- Read an R source file with a .R file extension.
+\title{Read an R source file with a .R file extension.}
+\usage{
+ r.reader(data.file, filename, variable.name)
}
+\arguments{
+ \item{data.file}{The name of the data file to be read.}
-\details{
+ \item{filename}{The path to the data set to be loaded.}
+
+ \item{variable.name}{The name to be assigned to in the
+ global environment.}
+}
+\value{
+ No value is returned; this function is called for its
+ side effects.
+}
+\description{
This function will call source on the specified R file,
executing the code inside of it as a way of generating
data sets dynamically, as in many Monte Carlo
applications.
}
-\value{No value is returned; this function is called for its side effects.}
-\arguments{
- \item{data.file}{The name of the data file to be read.}
- \item{filename}{The path to the data set to be loaded.}
- \item{variable.name}{The name to be assigned to in the global environment.}
+\examples{
+library('ProjectTemplate')
+
+#r.reader('example.R', 'data/example.R', 'example')
}
-\examples{library('ProjectTemplate')
-#r.reader('example.R', 'data/example.R', 'example')}
View
32 man/rdata.reader.Rd
@@ -1,23 +1,29 @@
\name{rdata.reader}
\alias{rdata.reader}
-\title{Read an RData file with a...}
-\usage{rdata.reader(data.file, filename, variable.name)}
-
-\description{
- Read an RData file with a .rdata or .rda file extension.
+\title{Read an RData file with a .rdata or .rda file extension.}
+\usage{
+ rdata.reader(data.file, filename, variable.name)
}
+\arguments{
+ \item{data.file}{The name of the data file to be read.}
-\details{
+ \item{filename}{The path to the data set to be loaded.}
+
+ \item{variable.name}{The name to be assigned to in the
+ global environment.}
+}
+\value{
+ No value is returned; this function is called for its
+ side effects.
+}
+\description{
This function will load the specified RData file into
memory using the \code{\link{load}} function. This may
generate many data sets simultaneously.
}
-\value{No value is returned; this function is called for its side effects.}
-\arguments{
- \item{data.file}{The name of the data file to be read.}
- \item{filename}{The path to the data set to be loaded.}
- \item{variable.name}{The name to be assigned to in the global environment.}
+\examples{
+library('ProjectTemplate')
+
+#rdata.reader('example.RData', 'data/example.RData', 'example')
}
-\examples{library('ProjectTemplate')
-#rdata.reader('example.RData', 'data/example.RData', 'example')}
View
17 man/reload.project.Rd
@@ -1,20 +1,21 @@
\name{reload.project}
\alias{reload.project}
\title{Reload a project from scratch.}
-
-\description{
- Reload a project from scratch.
+\value{
+ No value is returned; this function is called for its
+ side effects.
}
-
-\details{
+\description{
This function will clear the global environment and
reload a project from scratch. This is useful when you've
updated your data sets or changed your preprocessing
scripts.
}
-\value{No value is returned; this function is called for its side effects.}
-\examples{library('ProjectTemplate')
+\examples{
+library('ProjectTemplate')
#load.project()
-#reload.project()}
+#reload.project()
+}
+
View
19 man/run.project.Rd
@@ -1,19 +1,20 @@
\name{run.project}
\alias{run.project}
-\title{Run all of the analyses in the src directory.}
-
-\description{
- Run all of the analyses in the \code{src} directory.
+\title{Run all of the analyses in the \code{src} directory.}
+\value{
+ No value is returned; this function is called for its
+ side effects.
}
-
-\details{
+\description{
This function will run each of the analyses in the
\code{src} directory in separate processes. At present,
this is done serially, but future versions of this
function will provide a means of running the analyses in
parallel.
}
-\value{No value is returned; this function is called for its side effects.}
-\examples{library('ProjectTemplate')
+\examples{
+library('ProjectTemplate')
+
+#run.project()
+}
-#run.project()}
View
17 man/show.project.Rd
@@ -1,12 +1,11 @@
\name{show.project}
\alias{show.project}
\title{Show information about the current project.}
-
-\description{
- Show information about the current project.
+\value{
+ No value is returned; this function is called for its
+ side effects.
}
-
-\details{
+\description{
This function will show the user all of the information
that ProjectTemplate has about the current project. This
information is gathered when \code{\link{load.project}}
@@ -17,9 +16,11 @@
autoloaded data sets is used by the
\code{\link{cache.project}} function.
}
-\value{No value is returned; this function is called for its side effects.}
-\examples{library('ProjectTemplate')
+\examples{
+library('ProjectTemplate')
#load.project()
-#show.project()}
+#show.project()
+}
+
View
32 man/spss.reader.Rd
@@ -1,24 +1,30 @@
\name{spss.reader}
\alias{spss.reader}
-\title{Read an SPSS file with a...}
-\usage{spss.reader(data.file, filename, variable.name)}
-
-\description{
- Read an SPSS file with a .sav file extension.
+\title{Read an SPSS file with a .sav file extension.}
+\usage{
+ spss.reader(data.file, filename, variable.name)
}
+\arguments{
+ \item{data.file}{The name of the data file to be read.}
-\details{
+ \item{filename}{The path to the data set to be loaded.}
+
+ \item{variable.name}{The name to be assigned to in the
+ global environment.}
+}
+\value{
+ No value is returned; this function is called for its
+ side effects.
+}
+\description{
This function will load the specified SPSS file into
memory. It will convert the resulting list object into a
data frame before inserting the data set into the global
environment.
}
-\value{No value is returned; this function is called for its side effects.}
-\arguments{
- \item{data.file}{The name of the data file to be read.}
- \item{filename}{The path to the data set to be loaded.}
- \item{variable.name}{The name to be assigned to in the global environment.}
+\examples{
+library('ProjectTemplate')
+
+#spss.reader('example.sav', 'data/example.sav', 'example')
}
-\examples{library('ProjectTemplate')
-#spss.reader('example.sav', 'data/example.sav', 'example')}
View
39 man/sql.reader.Rd
@@ -1,20 +1,30 @@
\name{sql.reader}
\alias{sql.reader}
-\title{Read a database described in a...}
-\usage{sql.reader(data.file, filename, variable.name)}
-
-\description{
- Read a database described in a .sql file.
+\title{Read a database described in a .sql file.}
+\usage{
+ sql.reader(data.file, filename, variable.name)
}
+\arguments{
+ \item{data.file}{The name of the data file to be read.}
-\details{
+ \item{filename}{The path to the data set to be loaded.}
+
+ \item{variable.name}{The name to be assigned to in the
+ global environment.}
+}
+\value{
+ No value is returned; this function is called for its
+ side effects.
+}
+\description{
This function will load data from a SQL database based on
configuration information found in the specified .sql
file. The .sql file must specify a database to be
accessed. All tables from the database, one specific
tables or one specific query against any set of tables
may be executed to generate a data set.
-
+}
+\details{
Examples of the DCF format and settings used in a .sql
file are shown below:
@@ -30,13 +40,14 @@
Example 4 type: sqlite dbname: /path/to/sample_database
table: *
+
+ Example 5 type: postgres user: sample_user password:
+ sample_password host: localhost dbname: sample_database
+ table: sample_table
}
-\value{No value is returned; this function is called for its side effects.}
-\arguments{
- \item{data.file}{The name of the data file to be read.}
- \item{filename}{The path to the data set to be loaded.}
- \item{variable.name}{The name to be assigned to in the global environment.}
+\examples{
+library('ProjectTemplate')
+
+#sql.reader('example.sql', 'data/example.sql', 'example')
}
-\examples{library('ProjectTemplate')
-#sql.reader('example.sql', 'data/example.sql', 'example')}
View
32 man/stata.reader.Rd
@@ -1,22 +1,28 @@
\name{stata.reader}
\alias{stata.reader}
-\title{Read a Stata file with a...}
-\usage{stata.reader(data.file, filename, variable.name)}
-
-\description{
- Read a Stata file with a .stata file extension.
+\title{Read a Stata file with a .stata file extension.}
+\usage{
+ stata.reader(data.file, filename, variable.name)
}
+\arguments{
+ \item{data.file}{The name of the data file to be read.}
-\details{
+ \item{filename}{The path to the data set to be loaded.}
+
+ \item{variable.name}{The name to be assigned to in the
+ global environment.}
+}
+\value{
+ No value is returned; this function is called for its
+ side effects.
+}
+\description{
This function will load the specified Stata file into
memory.
}
-\value{No value is returned; this function is called for its side effects.}
-\arguments{
- \item{data.file}{The name of the data file to be read.}
- \item{filename}{The path to the data set to be loaded.}
- \item{variable.name}{The name to be assigned to in the global environment.}
+\examples{
+library('ProjectTemplate')
+
+#stata.reader('example.stata', 'data/example.stata', 'example')
}
-\examples{library('ProjectTemplate')
-#stata.reader('example.stata', 'data/example.stata', 'example')}
View
17 man/stub.tests.Rd
@@ -1,12 +1,11 @@
\name{stub.tests}
\alias{stub.tests}
\title{Generate unit tests for your helper functions.}
-
-\description{
- Generate unit tests for your helper functions.
+\value{
+ No value is returned; this function is called for its
+ side effects.
}
-
-\details{
+\description{
This function will parse all of the functions defined in
files inside of the \code{lib} directory and will
generate a trivial unit test for each function. The
@@ -15,7 +14,9 @@
fail by default, so you should edit them before calling
\code{\link{test.project}}.
}
-\value{No value is returned; this function is called for its side effects.}
-\examples{library('ProjectTemplate')
+\examples{
+library('ProjectTemplate')
+
+#stub.tests()
+}
-#stub.tests()}
View
32 man/systat.reader.Rd
@@ -1,22 +1,28 @@
\name{systat.reader}
\alias{systat.reader}
-\title{Read a Systat file with a...}
-\usage{systat.reader(data.file, filename, variable.name)}
-
-\description{
- Read a Systat file with a .sys or .syd file extension.
+\title{Read a Systat file with a .sys or .syd file extension.}
+\usage{
+ systat.reader(data.file, filename, variable.name)
}
+\arguments{
+ \item{data.file}{The name of the data file to be read.}
-\details{
+ \item{filename}{The path to the data set to be loaded.}
+
+ \item{variable.name}{The name to be assigned to in the
+ global environment.}
+}
+\value{
+ No value is returned; this function is called for its
+ side effects.
+}
+\description{
This function will load the specified Systat file into
memory.
}
-\value{No value is returned; this function is called for its side effects.}
-\arguments{
- \item{data.file}{The name of the data file to be read.}
- \item{filename}{The path to the data set to be loaded.}
- \item{variable.name}{The name to be assigned to in the global environment.}
+\examples{
+library('ProjectTemplate')
+
+#systat.reader('example.sys', 'data/example.sys', 'example')
}
-\examples{library('ProjectTemplate')
-#systat.reader('example.sys', 'data/example.sys', 'example')}
View
17 man/test.project.Rd
@@ -1,12 +1,11 @@
\name{test.project}
\alias{test.project}
\title{Run all unit tests for this project.}
-
-\description{
- Run all unit tests for this project.
+\value{
+ No value is returned; this function is called for its
+ side effects.
}
-
-\details{
+\description{
This function will run all of the \code{testthat} style
unit tests for the current project that are defined
inside of the \code{tests} directory. The tests will be
@@ -14,9 +13,11 @@
it is recommend that each test begin with a number
specifying its position in the sequence.
}
-\value{No value is returned; this function is called for its side effects.}
-\examples{library('ProjectTemplate')
+\examples{
+library('ProjectTemplate')
#load.project()
-#test.project()}
+#test.project()
+}
+
View
26 man/translate.dcf.Rd
@@ -1,23 +1,25 @@
\name{translate.dcf}
\alias{translate.dcf}
\title{Read a DCF file into an R list.}
-\usage{translate.dcf(filename)}
-
-\description{
- Read a DCF file into an R list.
+\usage{
+ translate.dcf(filename)
}
-
-\details{
+\arguments{
+ \item{filename}{A character vector specifying the DCF
+ file to be translated.}
+}
+\value{
+ Returns a list containing the entries from the DCF file.
+}
+\description{
This function will read a DCF file and translate the
resulting data frame into a list. The DCF format is used
throughout ProjectTemplate for configuration settings and
ad hoc file format specifications.
}
-\value{Returns a list containing the entries from the DCF file.}
-\arguments{
- \item{filename}{A character vector specifying the DCF file to be
-translated.}
+\examples{
+library('ProjectTemplate')
+
+#translate.dcf(file.path('config', 'global.dcf'))
}
-\examples{library('ProjectTemplate')
-#translate.dcf(file.path('config', 'global.dcf'))}
View
32 man/tsv.reader.Rd
@@ -1,22 +1,28 @@
\name{tsv.reader}
\alias{tsv.reader}
-\title{Read a tab separated values (...}
-\usage{tsv.reader(data.file, filename, variable.name)}
-
-\description{
- Read a tab separated values (.tsv or .tab) file.
+\title{Read a tab separated values (.tsv or .tab) file.}
+\usage{
+ tsv.reader(data.file, filename, variable.name)
}
+\arguments{
+ \item{data.file}{The name of the data file to be read.}
-\details{
+ \item{filename}{The path to the data set to be loaded.}
+
+ \item{variable.name}{The name to be assigned to in the
+ global environment.}
+}
+\value{
+ No value is returned; this function is called for its
+ side effects.
+}
+\description{
This function will load a data set stored in the TSV file
format into the specified global variable binding.
}
-\value{No value is returned; this function is called for its side effects.}
-\arguments{
- \item{data.file}{The name of the data file to be read.}
- \item{filename}{The path to the data set to be loaded.}
- \item{variable.name}{The name to be assigned to in the global environment.}
+\examples{
+library('ProjectTemplate')
+
+#tsv.reader('example.tsv', 'data/example.tsv', 'example')
}
-\examples{library('ProjectTemplate')
-#tsv.reader('example.tsv', 'data/example.tsv', 'example')}
View
35 man/url.reader.Rd
@@ -1,20 +1,30 @@
\name{url.reader}
\alias{url.reader}
-\title{Read a remote file described in a...}
-\usage{url.reader(data.file, filename, variable.name)}
-
-\description{
- Read a remote file described in a .url file.
+\title{Read a remote file described in a .url file.}
+\usage{
+ url.reader(data.file, filename, variable.name)
}
+\arguments{
+ \item{data.file}{The name of the data file to be read.}
-\details{
+ \item{filename}{The path to the data set to be loaded.}
+
+ \item{variable.name}{The name to be assigned to in the
+ global environment.}
+}
+\value{
+ No value is returned; this function is called for its
+ side effects.
+}
+\description{
This function will load data from a remote source
accessible through HTTP or FTP based on configuration
information found in the specified .url file. The .url
file must specify the URL of the remote data source and
the type of data that is available remotely. Only one
data source per .url file is supported currently.
-
+}
+\details{
Examples of the DCF format and settings used in a .url
file are shown below:
@@ -22,12 +32,9 @@
http://www.johnmyleswhite.com/ProjectTemplate/sample_data.csv
separator: ,
}
-\value{No value is returned; this function is called for its side effects.}
-\arguments{
- \item{data.file}{The name of the data file to be read.}
- \item{filename}{The path to the data set to be loaded.}
- \item{variable.name}{The name to be assigned to in the global environment.}
+\examples{
+library('ProjectTemplate')
+
+#url.reader('example.url', 'data/example.url', 'example')
}
-\examples{library('ProjectTemplate')
-#url.reader('example.url', 'data/example.url', 'example')}
View
32 man/wsv.reader.Rd
@@ -1,22 +1,28 @@
\name{wsv.reader}
\alias{wsv.reader}
-\title{Read a whitespace separated values (...}
-\usage{wsv.reader(data.file, filename, variable.name)}
-
-\description{
- Read a whitespace separated values (.wsv or .txt) file.
+\title{Read a whitespace separated values (.wsv or .txt) file.}
+\usage{
+ wsv.reader(data.file, filename, variable.name)
}
+\arguments{
+ \item{data.file}{The name of the data file to be read.}
-\details{
+ \item{filename}{The path to the data set to be loaded.}
+
+ \item{variable.name}{The name to be assigned to in the
+ global environment.}
+}
+\value{
+ No value is returned; this function is called for its
+ side effects.
+}
+\description{
This function will load a data set stored in the WSV file
format into the specified global variable binding.
}
-\value{No value is returned; this function is called for its side effects.}
-\arguments{
- \item{data.file}{The name of the data file to be read.}
- \item{filename}{The path to the data set to be loaded.}
- \item{variable.name}{The name to be assigned to in the global environment.}
+\examples{
+library('ProjectTemplate')
+
+#wsv.reader('example.wsv', 'data/example.wsv', 'example')
}
-\examples{library('ProjectTemplate')
-#wsv.reader('example.wsv', 'data/example.wsv', 'example')}
View
32 man/xls.reader.Rd
@@ -1,24 +1,30 @@
\name{xls.reader}
\alias{xls.reader}
-\title{Read an Excel 2004 file with a...}
-\usage{xls.reader(data.file, filename, workbook.name)}
-
-\description{
- Read an Excel 2004 file with a .xls file extension.
+\title{Read an Excel 2004 file with a .xls file extension.}
+\usage{
+ xls.reader(data.file, filename, workbook.name)
}
+\arguments{
+ \item{data.file}{The name of the data file to be read.}
-\details{
+ \item{filename}{The path to the data set to be loaded.}
+
+ \item{workbook.name}{The name to be assigned to in the
+ global environment.}
+}
+\value{
+ No value is returned; this function is called for its
+ side effects.
+}
+\description{
This function will load the specified Excel file into
memory using the gdata package. Each sheet of the Excel
workbook will be read into a separate variable in the
global environment.
}
-\value{No value is returned; this function is called for its side effects.}
-\arguments{
- \item{data.file}{The name of the data file to be read.}
- \item{filename}{The path to the data set to be loaded.}
- \item{workbook.name}{The name to be assigned to in the global environment.}
+\examples{
+library('ProjectTemplate')
+
+#xls.reader('example.xls', 'data/example.xls', 'example')
}
-\examples{library('ProjectTemplate')
-#xls.reader('example.xls', 'data/example.xls', 'example')}
View
32 man/xlsx.reader.Rd
@@ -1,24 +1,30 @@
\name{xlsx.reader}
\alias{xlsx.reader}
-\title{Read an Excel 2007 file with a...}
-\usage{xlsx.reader(data.file, filename, workbook.name)}
-
-\description{
- Read an Excel 2007 file with a .xlsx file extension.
+\title{Read an Excel 2007 file with a .xlsx file extension.}
+\usage{
+ xlsx.reader(data.file, filename, workbook.name)
}
+\arguments{
+ \item{data.file}{The name of the data file to be read.}
-\details{
+ \item{filename}{The path to the data set to be loaded.}
+
+ \item{workbook.name}{The name to be assigned to in the
+ global environment.}
+}
+\value{
+ No value is returned; this function is called for its
+ side effects.
+}
+\description{
This function will load the specified Excel file into
memory using the xlsx package. Each sheet of the Excel
workbook will be read into a separate variable in the
global environment.
}
-\value{No value is returned; this function is called for its side effects.}
-\arguments{
- \item{data.file}{The name of the data file to be read.}
- \item{filename}{The path to the data set to be loaded.}
- \item{workbook.name}{The name to be assigned to in the global environment.}
+\examples{
+library('ProjectTemplate')
+
+#xlsx.reader('example.xlsx', 'data/example.xlsx', 'example')
}
-\examples{library('ProjectTemplate')
-#xlsx.reader('example.xlsx', 'data/example.xlsx', 'example')}
View
32 man/xport.reader.Rd
@@ -1,22 +1,28 @@
\name{xport.reader}
\alias{xport.reader}
-\title{Read an XPort file with a...}
-\usage{xport.reader(data.file, filename, variable.name)}
-
-\description{
- Read an XPort file with a .xport file extension.
+\title{Read an XPort file with a .xport file extension.}
+\usage{
+ xport.reader(data.file, filename, variable.name)
}
+\arguments{
+ \item{data.file}{The name of the data file to be read.}
-\details{
+ \item{filename}{The path to the data set to be loaded.}
+
+ \item{variable.name}{The name to be assigned to in the
+ global environment.}
+}
+\value{
+ No value is returned; this function is called for its
+ side effects.
+}
+\description{
This function will load the specified XPort file into
memory.
}
-\value{No value is returned; this function is called for its side effects.}
-\arguments{
- \item{data.file}{The name of the data file to be read.}
- \item{filename}{The path to the data set to be loaded.}
- \item{variable.name}{The name to be assigned to in the global environment.}
+\examples{
+library('ProjectTemplate')
+
+#xport.reader('example.xport', 'data/example.xport', 'example')
}
-\examples{library('ProjectTemplate')
-#xport.reader('example.xport', 'data/example.xport', 'example')}
View
2  roxygenate.R
@@ -0,0 +1,2 @@
+library('roxygen2')
+roxygenize('.')
View
1  website/TODO.html
@@ -78,6 +78,7 @@
<li>Make <code>data.table</code> integration more powerful.</li>
<li>Integrate <code>sqldf</code>?</li>
<li>Integrate <code>bigmemory</code> or <code>ff</code>?</li>
+<li>Automatic date conversion using lubridate.</li>
</ul>
<h2>Cache Changes?</h2>
View
3  website/index.html
@@ -22,13 +22,14 @@
<li><a href="./intro.html">An Introduction to ProjectTemplate</a></li>
<li><a href="./installing.html">Installing ProjectTemplate</a></li>
<li><a href="./getting_started.html">Getting Started with ProjectTemplate</a></li>
-<li><a href="./mastering.html">Mastering ProjectTemplate's Advanced Features (IN PROGRESS DRAFT)</a></li>
+<li><a href="./mastering.html">Mastering ProjectTemplate's Advanced Features</a></li>
<li><a href="./configuring.html">Configuring ProjectTemplate</a></li>
<li><a href="./updating.html">Updating to the Latest Version</a></li>
<li><a href="./architecture.html">ProjectTemplate's Architecture</a></li>
<li><a href="./file_formats.html">Supported File Formats</a></li>
<li><a href="./changes.html">Changes across ProjectTemplate Versions</a></li>
<li><a href="./mailing_list.html">The ProjectTemplate Mailing List</a></li>
+<li><a href="https://github.com/johnmyleswhite/ProjectTemplate">ProjectTemplate on GitHub</a></li>
<li><a href="./contributing.html">Contributing to ProjectTemplate</a></li>
<li><a href="./packages.html">Building Packages</a></li>
<li><a href="./README.html">The ProjectTemplate README</a></li>
View
3  website/index.markdown
@@ -10,13 +10,14 @@
- [An Introduction to ProjectTemplate](./intro.html)
- [Installing ProjectTemplate](./installing.html)
- [Getting Started with ProjectTemplate](./getting_started.html)
-- [Mastering ProjectTemplate's Advanced Features (IN PROGRESS DRAFT)](./mastering.html)
+- [Mastering ProjectTemplate's Advanced Features](./mastering.html)
- [Configuring ProjectTemplate](./configuring.html)
- [Updating to the Latest Version](./updating.html)
- [ProjectTemplate's Architecture](./architecture.html)
- [Supported File Formats](./file_formats.html)
- [Changes across ProjectTemplate Versions](./changes.html)
- [The ProjectTemplate Mailing List](./mailing_list.html)
+- [ProjectTemplate on GitHub](https://github.com/johnmyleswhite/ProjectTemplate)
- [Contributing to ProjectTemplate](./contributing.html)
- [Building Packages](./packages.html)
- [The ProjectTemplate README](./README.html)
View
BIN  website/logging.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
77 website/mastering.html
@@ -17,92 +17,95 @@
<h2>SQLite Databases</h2>
-<p>Let's start by working with an SQLite database. We'll use a database from the Analytics X competition in which contestants were trying to predict crimes that took place in Philadelphia. You can download the database file <a href="./analyticsx.db">here</a>.</p>
+<p>Let's start by working with a SQLite database. We'll use a database from the Analytics X competition in which contestants were trying to predict crimes that took place in Philadelphia. You can download the database file <a href="./philapd.db.zip">here</a>. To save on bandwidth, we've compressed the database, so you should uncompress it before going through the rest of this tutorial.</p>
<h3>Autoloading the Database</h3>
-<p>The simplest way to access the database is to store the <code>analyticsx.db</code> file in the <code>data</code> directory of a new project. Let's set up a project using the standard ProjectTemplate invocation:</p>
+<p>The simplest way to access the database is to store the <code>philapd.db</code> file in the <code>data</code> directory of a new project. Let's set up a project using the standard ProjectTemplate invocation:</p>
<pre><code> library('ProjectTemplate')
- create.project('AnalyticsX')
+ create.project('PhilaPD')
</code></pre>
-<p>Then we'll shift into the relevant directory and move our database over:</p>
+<p>Then we'll shift into the relevant directory, move our database over and uncompress it:</p>
-<pre><code> cd AnalyticsX
- mv ~/Downloads/analyticsx.db data
+<pre><code> cd PhilaPD
+ mv ~/Downloads/philapd.db.zip data
+ unzip data/philapd.db.zip -d data
+ rm data/philapd.db.zip
</code></pre>
-<p>Then we reload R and load the project. You'll see ProjectTemplate automatically load the five tables found in our SQLite database:</p>
+<p>Then we reload R and load the project. You'll see ProjectTemplate automatically load the two tables found in our SQLite database:</p>
<pre><code> library('ProjectTemplate')
load.project()
</code></pre>
-<p>IMAGE OF AUTOLOADING GOES HERE</p>
+<p><img src="./mastering1.jpg" alt="Autoloading" title="" /></p>
-<p>For most users, this automatic loading procedure is probably enough. But if you need more fine-grained control, you can use the <code>.sql</code> ad hoc file type to load specific tables from an SQLite database. You can also specify an exact SQL query to run against the database. We'll go through all three cases below.</p>
+<p>For most users, this automatic loading procedure is probably enough. But if you need more fine-grained control, you can use the <code>.sql</code> ad hoc file type to load specific tables from a SQLite database. You can also specify an exact SQL query to run against the database. We'll go through all three cases below.</p>
<h3>Load One Specific Table</h3>
-<p>First, let's move the <code>analyticsx.db</code> file out of the <code>data</code> directory to prevent it from being autoloaded:</p>
+<p>First, let's move the <code>philapd.db</code> file out of the <code>data</code> directory to prevent it from being autoloaded:</p>
-<pre><code> mv data/analyticsx.db .
+<pre><code> mv data/philapd.db .
</code></pre>
-<p>After that, we'll create an <code>.sql</code> file in the <code>data</code> directory. We need to specify (a) that we're working with an SQLite database, (b) the path to the SQLite database and (c) the specific table we want to load:</p>
+<p>After that, we'll create an <code>.sql</code> file in the <code>data</code> directory. We'll use a file called <code>data/philapd.sql</code>. Inside of this file, we need to specify (a) that we're working with a SQLite database, (b) the path to the SQLite database and (c) the specific table we want to load. We've done that below:</p>
<pre><code> type: sqlite
- dbname: analytics.db
- table: homicides
+ dbname: philapd.db
+ table: location_info
</code></pre>
-<p>Running <code>load.project</code> will then load only this table from our database.</p>
+<p>After creating the <code>data/philapd.sql</code> file, we can rerun <code>load.project</code>, which will load only the <code>location_info</code> table from our database into the variable <code>philapd</code>:</p>
-<p>IMAGE OF AUTOLOADING GOES HERE</p>
+<p><img src="./mastering2.jpg" alt="Autoloading" title="" /></p>
<h3>Load All Tables from a Specific Database</h3>
<p>If we want to load all of the tables from a database file that we can't place inside of the <code>data</code> directory, we can use a <code>.sql</code> file to do this by replacing the name of a specific table with an asterisk:</p>
<pre><code> type: sqlite
- dbname: analytics.db
+ dbname: philapd.db
table: *
</code></pre>
-<p>IMAGE OF AUTOLOADING GOES HERE</p>
+<p><img src="./mastering3.jpg" alt="Autoloading" title="" /></p>
<h3>Loading Data with an SQL Query</h3>
-<p>You can load a subset of your data by specifying an SQL query instead of a table:</p>
+<p>You can also load a subset of your data by specifying an SQL query instead of a table in your <code>.sql</code> file:</p>
<pre><code> type: sqlite
- dbname: analytics.db
- query: SELECT * FROM homicides
+ dbname: philapd.db
+ query: SELECT * FROM location_info WHERE zip = '19144'
</code></pre>
-<p>IMAGE OF AUTOLOADING GOES HERE</p>
+<p><img src="./mastering4.jpg" alt="Autoloading" title="" /></p>
<h2>MySQL Databases</h2>
<p>Working with a MySQL database is exactly as easy as using a <code>.sql</code> file to access a SQLite database. All that changes is the use of the <code>mysql</code> type instead of the <code>sqlite</code> type:</p>
<pre><code> type: mysql
- dbname: analytics.db
- table: *
+ user: sample_user
+ password: sample_password
+ host: localhost
+ dbname: philapd
+ table: location_info
</code></pre>
-<p>IMAGE OF AUTOLOADING GOES HERE</p>
-
<h2>URL Files</h2>
-<p>If you need to access a file that's available over HTTP or FTP, you can use a <code>.url</code> file. Inside of the file, you'll specify the URL where your data set is available and the type of data set you're accessing:</p>
+<p>If you need to access a file that's available over HTTP or FTP, you can use a <code>.url</code> file. Inside of the file, you'll specify the URL where your data set is available and the type of data set you're accessing. Here, we'll use a <code>data/sample.url</code> file to load the ProjectTemplate standard sample data set over HTTP:</p>
<pre><code> url: http://www.johnmyleswhite.com/ProjectTemplate/sample_data.csv
separator: ,
</code></pre>
-<p>IMAGE OF AUTOLOADING GOES HERE</p>
+<p><img src="./mastering5.jpg" alt="Autoloading" title="" /></p>
<h2>.file Files</h2>
@@ -112,7 +115,7 @@
extension: csv
</code></pre>
-<p>IMAGE OF AUTOLOADING GOES HERE</p>
+<p><img src="./mastering6.jpg" alt="Autoloading" title="" /></p>
<h2>R Files</h2>
@@ -122,7 +125,11 @@
d &lt;- rnorm(1000, 0, 1)
</code></pre>
-<p>IMAGE OF AUTOLOADING GOES HERE</p>
+<p><img src="./mastering7.jpg" alt="Autoloading" title="" /></p>
+
+<h2>Media Files: MP3's and PPM's</h2>
+
+<p>Sometimes you want to work with more interesting sorts of data than a typical text file. ProjectTemplate now has basic support for loading media files into R. To load an MP3 audio file into an R object for analysis, simply place the <code>.mp3</code> file in the <code>data</code> directory. The <code>tuneR</code> package will be automatically loaded by ProjectTemplate and the MP3 file will be read into an R object in the global environment. Similarly, if you want to load a PPM image file, just place the <code>.ppm</code> file into the <code>data</code> directory. ProjectTemplate will then use the <code>pixmap</code> package to load the image file into an R object in the global environment.</p>
<h1>Unit Testing Your Project</h1>
@@ -130,7 +137,7 @@
<p>After editing your tests, you can call <code>test.project()</code> to run all of the unit tests in the <code>tests</code> directory.</p>
-<p>EXAMPLE</p>
+<p><img src="./unit_tests.jpg"