patternapply

Iteratively try patterns against a character vector.
git clone https://git.eamoncaddigan.net/patternapply.git
Log | Files | Refs | README | LICENSE

commit e66c54f6c680727c9599776d4ebf7c2d25ca1c46
parent 30cce81953407be5510d127089fd5a240f6f659d
Author: eamoncaddigan <eamon.caddigan@gmail.com>
Date:   Tue, 23 Feb 2016 06:48:24 -0500

Doc updates.

Diffstat:
MDESCRIPTION | 2+-
MR/generics.R | 18+++++++++++-------
2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION @@ -1,4 +1,4 @@ -Package: patternlist +Package: patternapply Type: Package Title: Try Regular Expressions in Turn to Data Version: 0.1 diff --git a/R/generics.R b/R/generics.R @@ -1,19 +1,21 @@ #' Convert a replacement_list object into a character matrix. -#' +#' #' @param x A replacement_list. -#' -#' @return A character matrix. Each row corresponds to an entry in the +#' +#' @return A character matrix. Each row corresponds to an entry in the #' replacement_list. +#' +#' @method as.matrix replacement_list as.matrix.replacement_list <- function(x) { rlMatrix <- matrix(NA_character_, nrow = length(x), ncol = length(attr(x, "col_names"))) colnames(rlMatrix) <- attr(x, "col_names") - + # Loop (I know) through the elements in the replacement list and copy them # over to the new matrix. - # XXX: This will need to be changed if named vectors are recognized by + # XXX: This will need to be changed if named vectors are recognized by # patternapply(). for (i in seq_along(x)) { rlMatrix[i, seq_along(x[[i]])] <- x[[i]] @@ -21,11 +23,13 @@ as.matrix.replacement_list <- function(x) { } #' Convert a replacement_list object into a data.frame. -#' +#' #' @param x A replacement_list. -#' +#' #' @return A data.frame. Each row corresponds to an entry in the #' replacement_list. +#' +#' @method as.data.frame replacement_list as.data.frame.replacement_list <- function(x) { return(as.data.frame.matrix(as.matrix.replacement_list(x))) }