-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1309bce
commit 651b22e
Showing
5 changed files
with
67 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
# svFlow News | ||
# svFlow 1.2.0 | ||
|
||
## svFlow version 1.2.0 | ||
- The package is renamed svFlow because there is another flow package on CRAN. | ||
|
||
The package is renamed svFlow because there is another flow package on CRAN. | ||
- The function `._()` is moved from {svMisc} 1.3.1 into here. Now, it creates or overwrites `.` and `.call` objects in the calling environment to match the behavior of `%>.%`. | ||
|
||
## flow version 1.1.0 | ||
# flow 1.1.0 | ||
|
||
Internal reworking, no change in R code. | ||
- Internal reworking, no change in R code. | ||
|
||
## flow version 1.0-0 | ||
# flow 1.0-0 | ||
|
||
First version of the package. | ||
- First version of the package. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#' Pass first argument as dot to run code in second argument for pipe operators that do not natively support dot-replacement scheme (base R pipe operator) | ||
#' | ||
#' @param x Object to pass to `expr` as dot (`.`). | ||
#' @param expr Expression to execute, containing `.` as a placeholder. | ||
#' | ||
#' @return The result from executing `expr` in the parent environment. | ||
#' @details The function has a side-effect to assign `x` as `.` and unevaluated `expr` as `.call` in the calling environment. Therefore, make sure you do not use `.` or `.call` there for something else. In case `expr` fails in the middle of a series of chained pipes, you can inspect `.` and `.call` or possibly rerun a modified version of the instruction that failed on it for easier debugging purpose. | ||
#' @export | ||
#' @examples | ||
#' # The function is really supposed to be use in a pipe instruction | ||
#' # This example only runs on R >= 4.1 | ||
#' \dontrun{ | ||
#' # lm has data = as second argument, which does not fit well with the pipe |> | ||
#' # In R 4.1, one should write: | ||
#' iris |> \(.)(lm(data = ., Sepal.Length ~ Petal.Length + Species))() | ||
#' # which is not very elegant ! With ._() it is more concise and straighforward | ||
#' iris |> ._(lm(data = ., Sepal.Length ~ Petal.Length + Species)) | ||
#' } | ||
._ <- function(x, expr) { | ||
env <- caller_env() | ||
env[["."]] <- x | ||
env[[".call"]] <- substitute(expr) | ||
expr | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.