diff --git a/DESCRIPTION b/DESCRIPTION index 2e9cb24..84300e9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: svFlow Type: Package -Version: 1.2.0 +Version: 1.2.1 Title: Data Analysis Work Flow and Alternate Pipeline Operator Description: Data work flow analysis using 'proto' objects and pipe operator that integrates non-standard evaluation and the 'lazyeval' mechanism. diff --git a/NAMESPACE b/NAMESPACE index dd0ed4c..64d3193 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -21,7 +21,6 @@ export(._) export(as.flow) export(as.quosure) export(as_flow) -export(as_quosure) export(debug_flow) export(enflow) export(flow) @@ -30,9 +29,7 @@ export(is.bare_formula) export(is.flow) export(is.formula) export(is.quosure) -export(is_bare_formula) export(is_flow) -export(is_quosure) export(quos_underscore) importFrom(graphics,plot) importFrom(igraph,graph_from_edgelist) diff --git a/NEWS.md b/NEWS.md index 3275e93..5b04ae2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# svFlow 1.2.1 + +- Some functions that are redundant with functions in {rlang} are eliminated: `as_quosure()`, `is_quosure()` and `is_bare_formula()` + # svFlow 1.2.0 - The package is renamed svFlow because there is another flow package on CRAN. diff --git a/R/flow.R b/R/flow.R index b2162a3..73d1701 100644 --- a/R/flow.R +++ b/R/flow.R @@ -254,7 +254,7 @@ as.proto.Flow <- function(x, ...) { l <- nchar(name) if (substr(name, l, l) == "_") { - x[[substr(name, 1L, l - 1L)]] <- as_quosure(value, env = caller_env()) + x[[substr(name, 1L, l - 1L)]] <- as.quosure(value, env = caller_env()) } else { x[[name]] <- value } diff --git a/R/quos_underscore.R b/R/quos_underscore.R index 1fd9022..5b0cc52 100644 --- a/R/quos_underscore.R +++ b/R/quos_underscore.R @@ -10,7 +10,7 @@ #' @return An object of class **quosures** is returned. It can be used directly #' in tidyeval-aware contexts. #' @export -#' @seealso [as_quosure], \code{\link{\%>_\%}} +#' @seealso [as.quosure], \code{\link{\%>_\%}} #' @keywords utilities #' @concept automatic quosures creation for non-standard evaluation #' @examples diff --git a/R/quosure.R b/R/quosure.R index 280caa1..c422ea3 100644 --- a/R/quosure.R +++ b/R/quosure.R @@ -25,7 +25,7 @@ #' @details `-` is defined as an unary minus operator for **formula** objects #' (which is *not* defined in base R, hence, not supposed to be used otherwise). #' Thus, `-~expr` just converts a formula build using the base `~expr` -#' instruction into a **quosure**. `as_quosure()` does the same, when the +#' instruction into a **quosure**. `as.quosure()` does the same, when the #' expression is provided directly, and allows also to define the enclosing #' environment (by default, it is the environment where the code is evaluated, #' and it is also the case when using `-~expr`). @@ -140,11 +140,11 @@ print.unquoted <- function(x, ...) { #' @export #' @rdname quosure -as_quosure <- function(x, env = caller_env()) { - if (is_quosure(x)) { +as.quosure <- function(x, env = caller_env()) { + if (is.quosure(x)) { x - } else if (is_bare_formula(x)) { + } else if (is.bare_formula(x)) { .as_quosure_formula(x, env) } else if (is_symbolic(x)) { @@ -157,36 +157,19 @@ as_quosure <- function(x, env = caller_env()) { #' @export #' @rdname quosure -as.quosure <- as_quosure - -#' @export -#' @rdname quosure -is_quosure <- function(x) +is.quosure <- function(x) x %is% 'quosure' #' @export #' @rdname quosure -is.quosure <- is_quosure - -# Do not export this, because it mask a function of the same name in purrr -# It is used for the same purpose, but I don't understand why its code must -# be so complex (and slow!). So, I stick to my own version here -is_formula <- function(x) +is.formula <- function(x) x %is% 'formula' #' @export #' @rdname quosure -is.formula <- is_formula - -#' @export -#' @rdname quosure -is_bare_formula <- function(x) +is.bare_formula <- function(x) is_true(class(x) == 'formula') -#' @export -#' @rdname quosure -is.bare_formula <- is_bare_formula - #' @export #' @rdname quosure `!!` <- function(x) get_expr(x) diff --git a/R/svFlow-package.R b/R/svFlow-package.R index edd9875..b6b9cad 100644 --- a/R/svFlow-package.R +++ b/R/svFlow-package.R @@ -53,7 +53,7 @@ #' #' - [str.Flow()] compactly displays the content of a **Flow** object. #' -#' - [as_quosure()], and unary `+` and `-` operators combined with **formula** +#' - [as.quosure()], and unary `+` and `-` operators combined with **formula** #' objects provide an alternate way to create **quosure**s. #' #' - [quos_underscore()] automatically converts arguments whose name ends with diff --git a/man/quos_underscore.Rd b/man/quos_underscore.Rd index d4dac0c..ab88ede 100644 --- a/man/quos_underscore.Rd +++ b/man/quos_underscore.Rd @@ -27,7 +27,7 @@ foo(x = 1:10, # "Normal" argument z_ = non_existing_name) # Expressions in quosures are not evaluated } \seealso{ -\link{as_quosure}, \code{\link{\%>_\%}} +\link{as.quosure}, \code{\link{\%>_\%}} } \concept{automatic quosures creation for non-standard evaluation} \keyword{utilities} diff --git a/man/quosure.Rd b/man/quosure.Rd index d027438..5825717 100644 --- a/man/quosure.Rd +++ b/man/quosure.Rd @@ -8,12 +8,9 @@ \alias{+.quosure} \alias{+.unquoted} \alias{print.unquoted} -\alias{as_quosure} \alias{as.quosure} -\alias{is_quosure} \alias{is.quosure} \alias{is.formula} -\alias{is_bare_formula} \alias{is.bare_formula} \alias{!!} \title{Create and manipulate quosures easily} @@ -30,18 +27,12 @@ \method{print}{unquoted}(x, ...) -as_quosure(x, env = caller_env()) - as.quosure(x, env = caller_env()) -is_quosure(x) - is.quosure(x) is.formula(x) -is_bare_formula(x) - is.bare_formula(x) `!!`(x) @@ -79,7 +70,7 @@ or related objects. \code{-} is defined as an unary minus operator for \strong{formula} objects (which is \emph{not} defined in base R, hence, not supposed to be used otherwise). Thus, \code{-~expr} just converts a formula build using the base \code{~expr} -instruction into a \strong{quosure}. \code{as_quosure()} does the same, when the +instruction into a \strong{quosure}. \code{as.quosure()} does the same, when the expression is provided directly, and allows also to define the enclosing environment (by default, it is the environment where the code is evaluated, and it is also the case when using \code{-~expr}). diff --git a/man/svFlow-package.Rd b/man/svFlow-package.Rd index bf1a61f..198c019 100644 --- a/man/svFlow-package.Rd +++ b/man/svFlow-package.Rd @@ -55,7 +55,7 @@ functions and objects derived from a "flow pipeline" will be directly compatible with the tidyeval mechanism, as they will be most tidyverse-friendly as possible per construction. \item \code{\link[=str.Flow]{str.Flow()}} compactly displays the content of a \strong{Flow} object. -\item \code{\link[=as_quosure]{as_quosure()}}, and unary \code{+} and \code{-} operators combined with \strong{formula} +\item \code{\link[=as.quosure]{as.quosure()}}, and unary \code{+} and \code{-} operators combined with \strong{formula} objects provide an alternate way to create \strong{quosure}s. \item \code{\link[=quos_underscore]{quos_underscore()}} automatically converts arguments whose name ends with \verb{_} into \strong{quosure}s, and this mechanism is used by our flow pipe