commit 1fbedee74c976603560fd9ba66f3d85423aa5f0a
parent 2271dcc177da8b67a695ff4481c5b026f66a8259
Author: eamoncaddigan <eamon.caddigan@gmail.com>
Date: Mon, 29 Feb 2016 13:22:22 -0500
Still figuring out documentation stuff.
Diffstat:
3 files changed, 50 insertions(+), 21 deletions(-)
diff --git a/R/patternapply.R b/R/patternapply.R
@@ -1,14 +1,28 @@
+#' patternappy: A package for attempting to apply patterns to a vector.
+#'
+#' This package contains the function \code{patternapply()}, which iteratively
+#' tries to match a list of regular expressions to a vector and returns the
+#' associated replacement vector. This is useful for turning a column of text
+#' data with different formats into a matrix or data frame. S3 generics are also
+#' provided to assist with this.
+#'
+#' @docType package
+#' @name patternapply
+NULL
+
#' Iteratively try patterns against a character vector.
#'
#' @param X A character vector where matches are sought.
#' @param patterns A vector of regular expression patterns.
#' @param replacements A list of replacement information, which must match the
-#' length of \code{patterns}. Each element must be a character vector. This can
-#' include backreferences "\1" to "\9" to parenthesized subexpressions of the
-#' corresponding pattern.
+#' length of \code{patterns}. Each element must be a character vector. This
+#' can include backreferences "\1" to "\9" to parenthesized subexpressions of
+#' the corresponding pattern.
#'
#' @return A list of replacement vectors with class "replacement_list".
+#'
+#' @rdname patternapply_fun
patternapply <- function(X, patterns,
replacements = as.list(paste(seq_along(patterns)))) {
# Check the inputs
diff --git a/man/patternapply.Rd b/man/patternapply.Rd
@@ -1,25 +1,15 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/patternapply.R
+\docType{package}
\name{patternapply}
\alias{patternapply}
-\title{Iteratively try patterns against a character vector.}
-\usage{
-patternapply(X, patterns, replacements = list(paste(seq_along(patterns))))
-}
-\arguments{
-\item{X}{A character vector where matches are sought.}
-
-\item{patterns}{A vector of regular expression patterns.}
-
-\item{replacements}{A list of replacement information, which must match the
-length of \code{patterns}. Each element must be a character vector. This can
-include backreferences "\1" to "\9" to parenthesized subexpressions of the
-corresponding pattern.}
-}
-\value{
-A list of replacement vectors with class "replacement_list".
-}
+\alias{patternapply-package}
+\title{patternappy: A package for attempting to apply patterns to a vector.}
\description{
-Iteratively try patterns against a character vector.
+This package contains the function \code{patternapply()}, which iteratively
+tries to match a list of regular expressions to a vector and returns the
+associated replacement vector. This is useful for turning a column of text
+data with different formats into a matrix or data frame. S3 generics are also
+provided to assist with this.
}
diff --git a/man/patternapply_fun.Rd b/man/patternapply_fun.Rd
@@ -0,0 +1,25 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/patternapply.R
+\name{patternapply}
+\alias{patternapply}
+\title{Iteratively try patterns against a character vector.}
+\usage{
+patternapply(X, patterns, replacements = as.list(paste(seq_along(patterns))))
+}
+\arguments{
+\item{X}{A character vector where matches are sought.}
+
+\item{patterns}{A vector of regular expression patterns.}
+
+\item{replacements}{A list of replacement information, which must match the
+length of \code{patterns}. Each element must be a character vector. This
+can include backreferences "\1" to "\9" to parenthesized subexpressions of
+the corresponding pattern.}
+}
+\value{
+A list of replacement vectors with class "replacement_list".
+}
+\description{
+Iteratively try patterns against a character vector.
+}
+