Github user felixcheung commented on a diff in the pull request:
https://github.com/apache/spark/pull/19557#discussion_r146182283
--- Diff: R/pkg/R/DataFrame.R ---
@@ -3247,12 +3247,23 @@ setMethod("as.data.frame",
#' }
#' @seealso \link{detach}
#' @note attach since 1.6.0
-setMethod("attach",
- signature(what = "SparkDataFrame"),
- function(what, pos = 2, name = deparse(substitute(what)),
warn.conflicts = TRUE) {
- newEnv <- assignNewEnv(what)
- attach(newEnv, pos = pos, name = name, warn.conflicts =
warn.conflicts)
- })
+#' @name attach
+NULL
+
+createAttachMethod <- function() {
+ f <- function() {
+ args <- as.list(environment()) # capture all function parameters -
this must be the first line
+ newEnv <- assignNewEnv(args$what)
+ args$what <- newEnv
+ do.call(attach, args)
--- End diff --
since I'm changing to `do.call` - so that we can retain the param
name/value order without having to hardcode them here - we are no longer being
flagged with the NOTE on calling `attach` :)
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]