We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
body_append()
1 parent fd532ef commit 2af7b02Copy full SHA for 2af7b02
R/utils.R
@@ -5,6 +5,17 @@
5
#' @importFrom utils packageName
6
pkg_nm <- function() packageName(topenv(environment()))
7
8
+#' @param ans Whether to assign the final results into the 'ans' variable.
9
+#' @noRd
10
+body_append <- function(fn, ..., ans = TRUE) {
11
+ args <- rlang::fn_fmls(fn)
12
+ body <- rlang::fn_body(fn)
13
+ body <- as.list(body)
14
+ if (ans) body[[length(body)]] <- rlang::expr(ans <- !!body[[length(body)]])
15
+ body <- as.call(c(body, rlang::enexprs(...)))
16
+ rlang::new_function(args, body)
17
+}
18
+
19
#' Read Example Data
20
#'
21
#' This function reads example data from the file. If no file is specified, it
0 commit comments