write.text {SparkR}R Documentation

write.text

Description

Saves the content of the SparkDataFrame in a text file at the specified path. The SparkDataFrame must have only one column of string type with the name "value". Each row becomes a new line in the output file.

Usage

write.text(x, path)

## S4 method for signature 'SparkDataFrame,character'
write.text(x, path)

Arguments

x

A SparkDataFrame

path

The directory where the file is saved

See Also

Other SparkDataFrame functions: SparkDataFrame-class, [[, agg, arrange, as.data.frame, attach, cache, collect, colnames, coltypes, columns, count, dapply, describe, dim, distinct, dropDuplicates, dropna, drop, dtypes, except, explain, filter, first, group_by, head, histogram, insertInto, intersect, isLocal, join, limit, merge, mutate, ncol, persist, printSchema, registerTempTable, rename, repartition, sample, saveAsTable, selectExpr, select, showDF, show, str, take, unionAll, unpersist, withColumn, write.df, write.jdbc, write.json, write.parquet

Examples

## Not run: 
##D sc <- sparkR.init()
##D sqlContext <- sparkRSQL.init(sc)
##D path <- "path/to/file.txt"
##D df <- read.text(sqlContext, path)
##D write.text(df, "/tmp/sparkr-tmp/")
## End(Not run)

[Package SparkR version 2.0.0 Index]