diff --git a/DESCRIPTION b/DESCRIPTION index 84a9802..108333e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -6,7 +6,7 @@ Authors@R: person("Yuchen", "Wang", email = "ycwang0712@gmail.com", role = c("aut", "cre")) Description: If `dplyr` is a grammar for data manipulation, `extdplyr` is like a short paragraph written in `dplyr`. `extdplyr` extends `dplyr` and - `tidyr` verbs to some common "routines" that manipulate datasets. It uses + `tidyr` verbs to some common "routines" that manipulate data sets. It uses the same interface and preserves all the features from `dplyr`, has good performance, and supports various data sources. License: MIT + file LICENSE diff --git a/NAMESPACE b/NAMESPACE index cc25419..6092dd4 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -3,8 +3,8 @@ export("%>%") export(check_missing) export(check_missing_) -export(ifelse_routine) -export(ifelse_routine_) +export(grp_routine) +export(grp_routine_) export(ind_to_char) export(ind_to_char_) export(pct_routine) diff --git a/R/ifelse_routine.R b/R/grp_routine.R similarity index 89% rename from R/ifelse_routine.R rename to R/grp_routine.R index 0b29c51..1c1a35c 100644 --- a/R/ifelse_routine.R +++ b/R/grp_routine.R @@ -1,6 +1,6 @@ #' Mutate a character/factor based on conditions. #' -#' \code{ifelse_routine} functions like a serious of nested \code{ifelse} where +#' \code{grp_routine} functions like a serious of nested \code{ifelse} where #' a series of conditions are evaluated and different values are assigned based #' on those conditions. #' @@ -11,15 +11,15 @@ #' @inheritParams ind_to_char #' #' @export -#' @example /examples/ifelse_routine_ex.R -ifelse_routine <- function(data, col, ..., ret_factor = FALSE) { - ifelse_routine_(data, col, .dots = lazyeval::lazy_dots(...), +#' @example /examples/grp_routine_ex.R +grp_routine <- function(data, col, ..., ret_factor = FALSE) { + grp_routine_(data, col, .dots = lazyeval::lazy_dots(...), ret_factor = ret_factor) } -#' @describeIn ifelse_routine SE version of ifelse_routine. +#' @describeIn grp_routine SE version of grp_routine. #' @export -ifelse_routine_ <- function(data, col, ..., .dots, +grp_routine_ <- function(data, col, ..., .dots, ret_factor = FALSE) { conds <- lazyeval::all_dots(.dots, ..., all_named = TRUE) diff --git a/cran-comments.md b/cran-comments.md index f6a1df1..c1e581b 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,6 +1,6 @@ ## Test environments * local OS X install, R 3.3.2 -* ubuntu 12.04 (on travis-ci), R 3.1.2 +* ubuntu 12.04 (on travis-ci), R 3.3.2 * win-builder (release) ## R CMD check results diff --git a/examples/ifelse_routine_ex.R b/examples/grp_routine_ex.R similarity index 86% rename from examples/ifelse_routine_ex.R rename to examples/grp_routine_ex.R index 21db122..54d633d 100644 --- a/examples/ifelse_routine_ex.R +++ b/examples/grp_routine_ex.R @@ -2,20 +2,20 @@ df <- data.frame(v1 = letters[1:5], v2 = 1:5) df # By default, it creates new groups -ifelse_routine(df, "group", +grp_routine(df, "group", first = v1 %in% c("a", "b"), second = v2 == 3, third = v2 >= 4) # Gives a warning when the groups are not collectively exhaustive -ifelse_routine(df, "group", +grp_routine(df, "group", first = v1 %in% c("a", "b"), second = v2 == 3, third = v2 > 4) # SE version -ifelse_routine_(df, "group", +grp_routine_(df, "group", "first" = ~ v1 %in% c("a", "b"), "second" = ~ v2 == 3, .dots = setNames(list(~ v2 > 4), "third")) diff --git a/man/ifelse_routine.Rd b/man/grp_routine.Rd similarity index 74% rename from man/ifelse_routine.Rd rename to man/grp_routine.Rd index 938b30d..44be44f 100644 --- a/man/ifelse_routine.Rd +++ b/man/grp_routine.Rd @@ -1,13 +1,13 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/ifelse_routine.R -\name{ifelse_routine} -\alias{ifelse_routine} -\alias{ifelse_routine_} +% Please edit documentation in R/grp_routine.R +\name{grp_routine} +\alias{grp_routine} +\alias{grp_routine_} \title{Mutate a character/factor based on conditions.} \usage{ -ifelse_routine(data, col, ..., ret_factor = FALSE) +grp_routine(data, col, ..., ret_factor = FALSE) -ifelse_routine_(data, col, ..., .dots, ret_factor = FALSE) +grp_routine_(data, col, ..., .dots, ret_factor = FALSE) } \arguments{ \item{data}{A \code{\link[base]{data.frame}} or \code{\link[dplyr]{tbl}}.} @@ -25,13 +25,13 @@ that end with underscores).} and implicit arguments.} } \description{ -\code{ifelse_routine} functions like a serious of nested \code{ifelse} where +\code{grp_routine} functions like a serious of nested \code{ifelse} where a series of conditions are evaluated and different values are assigned based on those conditions. } \section{Functions}{ \itemize{ -\item \code{ifelse_routine_}: SE version of ifelse_routine. +\item \code{grp_routine_}: SE version of grp_routine. }} \examples{ @@ -39,20 +39,20 @@ df <- data.frame(v1 = letters[1:5], v2 = 1:5) df # By default, it creates new groups -ifelse_routine(df, "group", +grp_routine(df, "group", first = v1 \%in\% c("a", "b"), second = v2 == 3, third = v2 >= 4) # Gives a warning when the groups are not collectively exhaustive -ifelse_routine(df, "group", +grp_routine(df, "group", first = v1 \%in\% c("a", "b"), second = v2 == 3, third = v2 > 4) # SE version -ifelse_routine_(df, "group", +grp_routine_(df, "group", "first" = ~ v1 \%in\% c("a", "b"), "second" = ~ v2 == 3, .dots = setNames(list(~ v2 > 4), "third")) diff --git a/man/ind_to_char.Rd b/man/ind_to_char.Rd index da64767..a3e3dc3 100644 --- a/man/ind_to_char.Rd +++ b/man/ind_to_char.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/ifelse_routine.R +% Please edit documentation in R/grp_routine.R \name{ind_to_char} \alias{ind_to_char} \alias{ind_to_char_}