Permalink
Browse files

Switched over to roxygen

  • Loading branch information...
1 parent 94c4dc6 commit e910796eb8d0f027c6fd95bceda4d6407126e508 @johnmyleswhite committed Jul 6, 2011
Showing with 1,115 additions and 281 deletions.
  1. +62 −5 DESCRIPTION
  2. +9 −9 NAMESPACE
  3. BIN ProjectTemplate_0.3-5.tar.gz
  4. +6 −2 R/arff.reader.R
  5. +11 −2 R/cache.R
  6. +5 −1 R/cache.name.R
  7. +7 −2 R/cache.project.R
  8. +9 −3 R/clean.variable.name.R
  9. +13 −1 R/create.project.R
  10. +7 −1 R/csv.reader.R
  11. +7 −1 R/db.reader.R
  12. +7 −1 R/dbf.reader.R
  13. +7 −1 R/epiinfo.reader.R
  14. +7 −1 R/file.reader.R
  15. +20 −0 R/help.R
  16. +2 −1 R/load.project.R
  17. +7 −1 R/mp3.reader.R
  18. +7 −1 R/mtp.reader.R
  19. +7 −1 R/octave.reader.R
  20. +7 −1 R/ppm.reader.R
  21. +7 −1 R/r.reader.R
  22. +7 −1 R/rdata.reader.R
  23. +4 −3 R/reload.project.R
  24. +3 −2 R/run.project.R
  25. +3 −2 R/show.project.R
  26. +7 −1 R/spss.reader.R
  27. +7 −1 R/sql.reader.R
  28. +7 −1 R/stata.reader.R
  29. +3 −2 R/stub.tests.R
  30. +7 −1 R/systat.reader.R
  31. +4 −1 R/test.project.R
  32. +10 −4 R/translate.dcf.R
  33. +7 −1 R/tsv.reader.R
  34. +7 −1 R/url.reader.R
  35. +7 −1 R/wsv.reader.R
  36. +7 −1 R/xls.reader.R
  37. +7 −1 R/xlsx.reader.R
  38. +7 −1 R/xport.reader.R
  39. +3 −1 TODO.markdown
  40. +10 −0 build_script.R
  41. +0 −34 man/ProjectTemplate-package.Rd
  42. +25 −0 man/ProjectTemplate.Rd
  43. +20 −0 man/arff.reader.Rd
  44. +22 −17 man/cache.Rd
  45. +20 −0 man/cache.name.Rd
  46. +15 −14 man/cache.project.Rd
  47. +16 −16 man/clean.variable.name.Rd
  48. +31 −24 man/create.project.Rd
  49. +22 −0 man/csv.reader.Rd
  50. +25 −0 man/db.reader.Rd
  51. +22 −0 man/dbf.reader.Rd
  52. +22 −0 man/epiinfo.reader.Rd
  53. +16 −0 man/extensions.dispatch.table.Rd
  54. +32 −0 man/file.reader.Rd
  55. +10 −17 man/load.project.Rd
  56. +23 −0 man/mp3.reader.Rd
  57. +23 −0 man/mtp.reader.Rd
  58. +22 −0 man/octave.reader.Rd
  59. +23 −0 man/ppm.reader.Rd
  60. +24 −0 man/r.reader.Rd
  61. +23 −0 man/rdata.reader.Rd
  62. +14 −14 man/reload.project.Rd
  63. +13 −17 man/run.project.Rd
  64. +19 −14 man/show.project.Rd
  65. +24 −0 man/spss.reader.Rd
  66. +42 −0 man/sql.reader.Rd
  67. +22 −0 man/stata.reader.Rd
  68. +15 −17 man/stub.tests.Rd
  69. +22 −0 man/systat.reader.Rd
  70. +15 −18 man/test.project.Rd
  71. +15 −17 man/translate.dcf.Rd
  72. +22 −0 man/tsv.reader.Rd
  73. +33 −0 man/url.reader.Rd
  74. +22 −0 man/wsv.reader.Rd
  75. +24 −0 man/xls.reader.Rd
  76. +24 −0 man/xlsx.reader.Rd
  77. +22 −0 man/xport.reader.Rd
View
@@ -1,14 +1,71 @@
Package: ProjectTemplate
Type: Package
-Title: Automates the creation of new statistical analysis projects.
+Title: Automates the creation of new statistical analysis
+ projects.
Version: 0.3-5
Date: 2011-07-05
Author: John Myles White
Maintainer: John Myles White <jmw@johnmyleswhite.com>
-Description: 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.
+Description: 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.
License: Artistic-2.0
LazyLoad: yes
-Depends: R (>= 2.7), testthat
-Suggests: foreign, reshape, plyr, stringr, ggplot2, lubridate, log4r, RMySQL, RSQLite, xlsx, gdata, RODBC, tuneR, pixmap
+Depends:
+ R (>= 2.7),
+ testthat
+Suggests:
+ foreign,
+ reshape,
+ plyr,
+ stringr,
+ ggplot2,
+ lubridate,
+ log4r,
+ RMySQL,
+ RSQLite,
+ xlsx,
+ gdata,
+ RODBC,
+ tuneR,
+ pixmap
URL: http://projecttemplate.net
-Collate: cache.R cache.name.R cache.project.R clean.variable.name.R create.project.R load.project.R reload.project.R run.project.R show.project.R stub.tests.R test.project.R translate.dcf.R arff.reader.R csv.reader.R db.reader.R dbf.reader.R epiinfo.reader.R file.reader.R mp3.reader.R mtp.reader.R octave.reader.R ppm.reader.R r.reader.R rdata.reader.R spss.reader.R sql.reader.R stata.reader.R systat.reader.R tsv.reader.R url.reader.R wsv.reader.R xls.reader.R xlsx.reader.R xport.reader.R extensions.dispatch.table.R
+Collate:
+ 'arff.reader.R'
+ 'cache.name.R'
+ 'cache.project.R'
+ 'cache.R'
+ 'clean.variable.name.R'
+ 'create.project.R'
+ 'csv.reader.R'
+ 'db.reader.R'
+ 'dbf.reader.R'
+ 'epiinfo.reader.R'
+ 'file.reader.R'
+ 'help.R'
+ 'load.project.R'
+ 'mp3.reader.R'
+ 'mtp.reader.R'
+ 'octave.reader.R'
+ 'ppm.reader.R'
+ 'r.reader.R'
+ 'rdata.reader.R'
+ 'reload.project.R'
+ 'run.project.R'
+ 'show.project.R'
+ 'spss.reader.R'
+ 'sql.reader.R'
+ 'stata.reader.R'
+ 'stub.tests.R'
+ 'systat.reader.R'
+ 'test.project.R'
+ 'translate.dcf.R'
+ 'tsv.reader.R'
+ 'url.reader.R'
+ 'wsv.reader.R'
+ 'xls.reader.R'
+ 'xlsx.reader.R'
+ 'xport.reader.R'
+ 'extensions.dispatch.table.R'
View
@@ -1,9 +1,9 @@
-export("cache")
-export("cache.project")
-export("create.project")
-export("load.project")
-export("reload.project")
-export("run.project")
-export("show.project")
-export("stub.tests")
-export("test.project")
+export(cache.project)
+export(cache)
+export(create.project)
+export(load.project)
+export(reload.project)
+export(run.project)
+export(show.project)
+export(stub.tests)
+export(test.project)
Binary file not shown.
View
@@ -1,12 +1,16 @@
-#' Read the Weka (.arff) file format.
+#' Read the Weka file format.
#'
#' This function will load a data set stored in the Weka file format into
#' the specified global variable binding.
#'
+#' @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.
+#'
#' @return No value is returned; this function is called for its side effects.
#'
#' @examples
-#' arff.reader('example.arff', 'data/example.arff', 'example')
+#' #arff.reader('example.arff', 'data/example.arff', 'example')
arff.reader <- function(data.file, filename, variable.name)
{
library('foreign')
View
@@ -5,14 +5,23 @@
#' at load time when calling \code{\link{load.project}}. Cached data sets are
#' stored as \code{.RData} files.
#'
+#' @param variable A character vector containing the name of the variable to
+#' be saved.
+#'
#' @return No value is returned; this function is called for its side effects.
#'
#' @export
#' @examples
#' library('ProjectTemplate')
-#' load.project()
+#' #create.project('tmp-project')
+#'
+#' #setwd('tmp-project')
+#'
+#' #dataset1 <- 1:5
+#' #cache('dataset1')
#'
-#' cache('dataset1')
+#' #setwd('..')
+#' #unlink('tmp-project')
cache <- function(variable)
{
save(list = variable,
View
@@ -3,10 +3,14 @@
#' This function will translate a variable name into a form that is
#' suitable as a filename on most OS's.
#'
+#' @param data.filename The variable name to be translated into a filename.
+#'
#' @return A translated variable name.
#'
#' @examples
-#' cache.name('example.1')
+#' library('ProjectTemplate')
+#'
+#' #cache.name('example.1')
cache.name <- function(data.filename)
{
return(gsub('\\..*', '', data.filename, perl = TRUE))
View
@@ -2,14 +2,19 @@
#'
#' 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 read quickly. This is particularly useful for data sets
+#' easier to load quickly. This is particularly useful for data sets
#' that you've modified during a slow munging process that does not
#' need to be repeated.
#'
#' @return No value is returned; this function is called for its side effects.
#'
+#' @export
+#'
#' @examples
-#' cache.project()
+#' library('ProjectTemplate')
+#' #load.project()
+#'
+#' #cache.project()
cache.project <- function()
{
for (dataset in project.info[['data']])
View
@@ -1,13 +1,19 @@
#' Translate a file name into a valid R variable name.
#'
#' This function will translate a file name into a name that is a valid
-#' variable name in R. Non-alphabetic characters will be either stripped
-#' or replaced with dots.
+#' 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.
#'
+#' @param variable.name A character vector containing a variable's proposed
+#' name that should be standardized.
+#'
#' @return A translated variable name.
#'
#' @examples
-#' clean.variable.name('example_1')
+#' library('ProjectTemplate')
+#'
+#' #clean.variable.name('example_1')
clean.variable.name <- function(variable.name)
{
variable.name <- gsub('^[^a-zA-Z0-9]+', '', variable.name, perl = TRUE)
View
@@ -8,13 +8,25 @@
#' all of ProjectTemplate's functionality into a directory for extensive
#' customization, the \code{dump} argument can be set to \code{TRUE}.
#'
+#' @param project.name A character vector containing the name for this new
+#' project. Must be a valid directory name for your file system.
+#' @param 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.
+#' @param dump A boolean value indicating whether the entire functionality
+#' of ProjectTemplate should be written out to flat files in the current
+#' project.
+#'
#' @return No value is returned; this function is called for its side effects.
#'
#' @export
#'
#' @examples
#' library('ProjectTemplate')
-#' create.project('MyProject')
+#'
+#' #create.project('MyProject')
create.project <- function(project.name = 'new-project', minimal = FALSE, dump = FALSE)
{
tmp.dir <- paste(project.name, '_tmp', sep = '')
View
@@ -3,10 +3,16 @@
#' This function will load a data set stored in the CSV file format into
#' the specified global variable binding.
#'
+#' @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.
+#'
#' @return No value is returned; this function is called for its side effects.
#'
#' @examples
-#' csv.reader('example.csv', 'data/example.csv', 'example')
+#' library('ProjectTemplate')
+#'
+#' #csv.reader('example.csv', 'data/example.csv', 'example')
csv.reader <- function(data.file, filename, variable.name)
{
if (grepl('\\.zip$', filename))
View
@@ -5,10 +5,16 @@
#' table or query to execute against the database, move it elsewhere and
#' use a .sql file interpreted by \code{\link{sql.reader}}.
#'
+#' @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.
+#'
#' @return No value is returned; this function is called for its side effects.
#'
#' @examples
-#' db.reader('example.db', 'data/example.db', 'example')
+#' library('ProjectTemplate')
+#'
+#' #db.reader('example.db', 'data/example.db', 'example')
db.reader <- function(data.file, filename, variable.name)
{
library('RSQLite')
View
@@ -3,10 +3,16 @@
#' This function will load all of the data sets stored in the specified
#' XBASE file into the global environment.
#'
+#' @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.
+#'
#' @return No value is returned; this function is called for its side effects.
#'
#' @examples
-#' dbf.reader('example.dbf', 'data/example.dbf', 'example')
+#' library('ProjectTemplate')
+#'
+#' #dbf.reader('example.dbf', 'data/example.dbf', 'example')
dbf.reader <- function(data.file, filename, variable.name)
{
library('foreign')
View
@@ -3,10 +3,16 @@
#' This function will load all of the data sets stored in the specified
#' Epi Info file into the global environment.
#'
+#' @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.
+#'
#' @return No value is returned; this function is called for its side effects.
#'
#' @examples
-#' epiinfo.reader('example.rec', 'data/example.rec', 'example')
+#' library('ProjectTemplate')
+#'
+#' #epiinfo.reader('example.rec', 'data/example.rec', 'example')
epiinfo.reader <- function(data.file, filename, variable.name)
{
library('foreign')
View
@@ -11,10 +11,16 @@
#' path: http://www.johnmyleswhite.com/ProjectTemplate/sample_data.csv
#' extension: csv
#'
+#' @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.
+#'
#' @return No value is returned; this function is called for its side effects.
#'
#' @examples
-#' file.reader('example.file', 'data/example.file', 'example')
+#' library('ProjectTemplate')
+#'
+#' #file.reader('example.file', 'data/example.file', 'example')
file.reader <- function(data.file, filename, variable.name)
{
file.info <- ProjectTemplate:::translate.dcf(filename)
View
@@ -0,0 +1,20 @@
+#' Automates the creation of new statistical analysis projects.
+#'
+#' 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
+#' @name ProjectTemplate
+#' @aliases ProjectTemplate package-ProjectTemplate
+#' @examples
+#' library('ProjectTemplate')
+#'
+#' #create.project('project_name')
+#'
+#' #setwd('project_name')
+#' #load.project()
+NULL
View
@@ -9,7 +9,8 @@
#'
#' @examples
#' library('ProjectTemplate')
-#' load.project()
+#'
+#' #load.project()
load.project <- function()
{
project.info <- list()
View
@@ -4,10 +4,16 @@
#' tuneR package. This is useful for working with music files as a data
#' set.
#'
+#' @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.
+#'
#' @return No value is returned; this function is called for its side effects.
#'
#' @examples
-#' mp3.reader('example.mp3', 'data/example.mp3', 'example')
+#' library('ProjectTemplate')
+#'
+#' #mp3.reader('example.mp3', 'data/example.mp3', 'example')
mp3.reader <- function(data.file, filename, variable.name)
{
library('tuneR')
View
@@ -3,10 +3,16 @@
#' This function will load the specified Minitab Portable Worksheet into
#' memory.
#'
+#' @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.
+#'
#' @return No value is returned; this function is called for its side effects.
#'
#' @examples
-#' mtp.reader('example.mtp', 'data/example.mtp', 'example')
+#' library('ProjectTemplate')
+#'
+#' #mtp.reader('example.mtp', 'data/example.mtp', 'example')
mtp.reader <- function(data.file, filename, variable.name)
{
library('foreign')
Oops, something went wrong.

0 comments on commit e910796

Please sign in to comment.