Skip to content

Commit b60dd63

Browse files
committed
Add an example with the spark-csv package
1 parent fa8bc92 commit b60dd63

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

docs/sparkr.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ The general method for creating DataFrames from data sources is `read.df`. This
6666
specifying `--packages` with `spark-submit` or `sparkR` commands, or if creating context through `init`
6767
you can specify the packages with the `packages` argument.
6868

69+
<div data-lang="r" markdown="1">
70+
{% highlight r %}
71+
sc <- sparkR.init(packages="com.databricks:spark-csv_2.11:1.0.3")
72+
sqlContext <- sparkRSQL.init(sc)
73+
{% endhighlight %}
74+
</div>
75+
6976
We can see how to use data sources using an example JSON input file. Note that the file that is used here is _not_ a typical JSON file. Each line in the file must contain a separate, self-contained valid JSON object. As a consequence, a regular multi-line JSON file will most often fail.
7077

7178
<div data-lang="r" markdown="1">

0 commit comments

Comments
 (0)