Github user adrian555 commented on a diff in the pull request:
https://github.com/apache/spark/pull/9031#discussion_r41698039
--- Diff: R/pkg/R/DataFrame.R ---
@@ -1881,3 +1881,33 @@ setMethod("as.data.frame",
}
collect(x)
})
+
+#' The specified DataFrame is attached to the R search path. This means
that
+#' the DataFrame is searched by R when evaluating a variable, so columns in
+#' the DataFrame can be accessed by simply giving their names.
+#'
+#' @rdname attach
+#' @title Attach DataFrame to R search path
+#' @param what (DataFrame) The DataFrame to attach
+#' @param pos (integer) Specify position in search() where to attach.
+#' @param name (character) Name to use for the attached DataFrame. Names
+#' starting with package: are reserved for library.
+#' @param warn.conflicts (logical) If TRUE, warnings are printed about
conflicts
+#' from attaching the database, unless that DataFrame contains an object
+#' @examples
+#' \dontrun{
+#' attach(irisDf)
+#' summary(Sepal_Width)
+#' }
+#' @seealso \link{detach}
+setMethod("attach",
+ signature(what = "DataFrame"),
+ function(what, pos = 2, name = deparse(substitute(what)),
warn.conflicts = TRUE) {
+ bf <- what
+ cols <- columns(bf)
+ newEnv <- new.env()
+ for (i in 1:length(cols)) {
--- End diff --
@shivaram @felixcheung Anyone knows how to create a DataFrame with 0
column? Could you please show me how to do that? Thanks.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]