diff --git a/R/pkg/R/SQLContext.R b/R/pkg/R/SQLContext.R index 9a743a34115330606edb5329018842569255b380..30978bb50d3394a33e9120f70b27d10e28802c18 100644 --- a/R/pkg/R/SQLContext.R +++ b/R/pkg/R/SQLContext.R @@ -86,7 +86,9 @@ infer_type <- function(x) { createDataFrame <- function(sqlContext, data, schema = NULL, samplingRatio = 1.0) { if (is.data.frame(data)) { # get the names of columns, they will be put into RDD - schema <- names(data) + if (is.null(schema)) { + schema <- names(data) + } n <- nrow(data) m <- ncol(data) # get rid of factor type