Skip to content

Commit

Permalink
Three functions that conflicted with {rlang} are eliminated
Browse files Browse the repository at this point in the history
  • Loading branch information
phgrosjean committed Aug 30, 2022
1 parent 651b22e commit b81a609
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 43 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
3 changes: 0 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export(._)
export(as.flow)
export(as.quosure)
export(as_flow)
export(as_quosure)
export(debug_flow)
export(enflow)
export(flow)
Expand All @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion R/flow.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion R/quos_underscore.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 7 additions & 24 deletions R/quosure.R
Original file line number Diff line number Diff line change
Expand Up @@ -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`).
Expand Down Expand Up @@ -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)) {
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion R/svFlow-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion man/quos_underscore.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 1 addition & 10 deletions man/quosure.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/svFlow-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b81a609

Please sign in to comment.