Github user davies commented on a diff in the pull request:
https://github.com/apache/spark/pull/8952#discussion_r40965880
--- Diff: R/pkg/R/SQLContext.R ---
@@ -149,6 +149,26 @@ createDataFrame <- function(sqlContext, data, schema =
NULL, samplingRatio = 1.0
dataFrame(sdf)
}
+#' Create a DataFrame
+#'
+#' Converts R data.frame or list into DataFrame.
+#'
+#' @param sqlContext A SQLContext
+#' @param data An RDD or list or data.frame
+#' @param schema a list of column names or named list (StructType),
optional
+#' @return an DataFrame
+#' @export
+#' @examples
+#'\dontrun{
+#' sc <- sparkR.init()
+#' sqlContext <- sparkRSQL.init(sc)
+#' df1 <- as.DataFrame(sqlContext, iris)
+#' df2 <- as.DataFrame(sqlContext, list(3,4,5,6))
+#' }
+as.DataFrame <- function(sqlContext, data, schema = NULL, samplingRatio =
1.0){
--- End diff --
sqlContext is already a singleton, it's safe to call sparkRSQL.init
multiple times. So we have move `sqlContext` to the second place (or even the
last), and make it optional.
---
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]