

{"id":5644,"date":"2018-01-17T08:53:30","date_gmt":"2018-01-17T08:53:30","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=5644"},"modified":"2018-09-18T11:36:55","modified_gmt":"2018-09-18T06:06:55","slug":"create-sparkdataframes","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/create-sparkdataframes\/","title":{"rendered":"Ways to Create SparkDataFrames in SparkR"},"content":{"rendered":"<h2>1. Objective<\/h2>\n<p>Today, in this SparkDataFrames Tutorial, we will learn the whole concept of creating DataFrames in <strong><a href=\"https:\/\/data-flair.training\/blogs\/sparkr\/\">SparkR<\/a>.\u00a0<\/strong>Data is organized as a distributed collection of data into named columns. Basically, that we call a SparkDataFrames in SparkR. Also, there are many ways to create DataFrames in SparkR.<\/p>\n<p>So, let&#8217;s start SparkDataFrames Tutorial.<\/p>\n<div id=\"attachment_5648\" style=\"width: 1210px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Creating-SparkDataFrames-in-SparkR-01-2.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-5648\" class=\"wp-image-5648 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Creating-SparkDataFrames-in-SparkR-01-2.jpg\" alt=\"Creating SparkDataframes in Spark R\" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Creating-SparkDataFrames-in-SparkR-01-2.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Creating-SparkDataFrames-in-SparkR-01-2-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Creating-SparkDataFrames-in-SparkR-01-2-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Creating-SparkDataFrames-in-SparkR-01-2-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Creating-SparkDataFrames-in-SparkR-01-2-1024x536.jpg 1024w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><p id=\"caption-attachment-5648\" class=\"wp-caption-text\">Creating SparkDataframes in Spark R<\/p><\/div>\n<h2>2. What is SparkDataFrames?<\/h2>\n<p><span style=\"font-weight: 400\">Data is organized as a distributed collection of data into named columns. Basically, that we call a SparkDataFrame. Although, it is as same as a table in a relational database or a data frame in <strong><a href=\"https:\/\/data-flair.training\/blogs\/sparkr\/\">R<\/a><\/strong>. Moreover, we can construct a SparkR DataFrame from a wide array of sources. For example, structured data files, tables in Hive, external databases. Also, existing local R data frames are used for construction.<\/span><\/p>\n<h2>3. Ways to Create SparkDataFrames<\/h2>\n<p><span style=\"font-weight: 400\">Applications can create DataFrames in Spark, with a SparkSession. Apart from it, we can also create it from several methods. Such as local R data frame, a Hive table, or other data sources. Let\u2019s discuss all in brief. <\/span><\/p>\n<h3>a. From local data frames<\/h3>\n<p><span style=\"font-weight: 400\">To create a SparkDataframe, there is one simplest way. That is the conversion of a local R data frame into a SparkDataFrame. Although, we can create by using as DataFrame or createDataFrame. Also, by passing in the local R data frame to create a SparkDataFrame.<\/span><br \/>\nFor example,<span style=\"font-weight: 400\"><br \/>\n<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">df &lt;- as.DataFrame(faithful)\r\n# Displays the first part of the SparkDataFrame\r\nhead(df)\r\n## \u00a0eruptions waiting\r\n##1 \u00a0\u00a0\u00a0\u00a03.600 \u00a0\u00a0\u00a0\u00a0\u00a079\r\n##2 \u00a0\u00a0\u00a0\u00a01.800 \u00a0\u00a0\u00a0\u00a0\u00a054\r\n##3 \u00a0\u00a0\u00a0\u00a03.333 \u00a0\u00a0\u00a0\u00a0\u00a074<\/pre>\n<h3>b. From Data Sources<\/h3>\n<p><span style=\"font-weight: 400\">Through the SparkR SparkDataFrame interface, SparkR supports operating on a variety of data sources. Basically, for creating SparkDataFrames, the general method from data sources is read.df. Generally, this method takes in the path for the file to load. Also, the type of data source and the currently active SparkSession will be automatically used. Moreover, SparkR supports reading JSON, CSV and parquet files natively.<\/span><br \/>\n<span style=\"font-weight: 400\"><br \/>\n<\/span><span style=\"font-weight: 400\">In addition, we can add these packages by specifying two conditions.<\/span> Such as, if packages with spark-submit or sparkR commands. Else, if initializing SparkSession with the sparkPackages parameter. Either in an interactive R shell or from RStudio.<span style=\"font-weight: 400\"><br \/>\n<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">sparkR.session(sparkPackages = \"com.databricks:spark-avro_2.11:3.0.0\")<\/pre>\n<p><span style=\"font-weight: 400\">Basically, we have seen how to use data sources using an example, JSON input file.<\/span> Although the file that is used here is not a typical JSON file. Basically, each line in the file must contain a separate, valid JSON object.<br \/>\n<span style=\"font-weight: 400\"><br \/>\n<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">people &lt;- read.df(\".\/examples\/src\/main\/resources\/people.json\", \"json\")\r\nhead(people)\r\n## \u00a0age \u00a0\u00a0\u00a0name\r\n##1 \u00a0NA Michael\r\n##2 \u00a030 \u00a0\u00a0\u00a0Andy\r\n##3 \u00a019 \u00a0Justin\r\n# SparkR automatically infers the schema from the JSON file\r\nprintSchema(people)\r\n# root\r\n# \u00a0|-- age: long (nullable = true)\r\n# \u00a0|-- name: string (nullable = true)\r\n# Similarly, multiple files can be read with read.json\r\npeople &lt;- read.json(c(\".\/examples\/src\/main\/resources\/people.json\", \".\/examples\/src\/main\/resources\/people2.json\"))\r\nThe data sources API natively supports CSV formatted input files. For more information please refer to SparkR read.df API documentation.\r\ndf &lt;- read.df(csvPath, \"csv\", header = \"true\", inferSchema = \"true\", na.strings = \"NA\")<\/pre>\n<p><span style=\"font-weight: 400\">In addition, we can also use data sources API to save out SparkDataFrames into multiple file formats.<\/span><br \/>\n<span style=\"font-weight: 400\">For example, we can save the SparkDataFrame from the previous example to a Parquet file using write.df.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">write.df(people, path = \"people.parquet\", source = \"parquet\", mode = \"overwrite\")<\/pre>\n<h3>c. From Hive tables<\/h3>\n<p><span style=\"font-weight: 400\">We can also use Hive tables to create SparkDataFrames.<\/span> For this, we will need to create a SparkSession with Hive support.\u00a0Also can help to access tables in the Hive MetaStore. Although it is very important to note that Spark should have been built with Hive support.\u00a0<span style=\"font-weight: 400\">Although, SparkR attempt to create a SparkSession with Hive support enabled by default.<\/span> (enableHiveSupport = TRUE).<br \/>\n<b>sparkR.session()<\/b><br \/>\nFor example,<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">sql(\"CREATE TABLE IF NOT EXISTS src (key INT, value STRING)\")\r\nsql(\"LOAD DATA LOCAL INPATH 'examples\/src\/main\/resources\/kv1.txt' INTO TABLE src\")\r\n\r\n# Queries can be expressed in HiveQL.\r\nresults &lt;- sql(\"FROM src SELECT key, value\")\r\n# results is now a SparkDataFrame\r\nhead(results)\r\n## \u00a0key \u00a0\u00a0value\r\n## 1 238 val_238\r\n## 2 \u00a086 \u00a0val_86\r\n## 3 311 val_311<\/pre>\n<p>So, this was all in SparkDataFrames. Hope you like our explanation.<\/p>\n<h2>4. Conclusion<\/h2>\n<p>Hence, we have seen all the methods to construct a SparkR SparkDataFrame. Also, we have learned different ways to create Data frames in spark with local R data frame, a Hive table, and data sources. Although, we have covered all the insights regarding. Still, if any query arises, feel free to ask in the comment section.<br \/>\n<a href=\"https:\/\/spark.apache.org\/\">For reference<\/a>.<span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:2052,&quot;href&quot;:&quot;https:\\\/\\\/spark.apache.org&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20251009215151\\\/https:\\\/\\\/spark.apache.org\\\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-11 00:11:34&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-14 03:24:05&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-17 05:06:29&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-20 07:19:55&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-23 14:10:46&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-26 19:03:14&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-30 13:05:23&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-02 13:25:12&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-05 14:08:05&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-09 10:16:58&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-12 11:04:53&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-15 17:09:49&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-18 18:39:09&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-21 19:15:09&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-26 04:14:49&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-29 05:32:17&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-01 07:55:30&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-04 10:44:57&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-07 12:28:46&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-11 00:52:17&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-14 12:51:24&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-17 14:17:39&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-20 17:49:34&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-24 04:42:19&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-27 06:25:21&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-02 08:44:49&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-05 10:27:17&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-08 11:13:11&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-11 12:04:06&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-14 12:32:46&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-18 01:16:16&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-21 21:29:48&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-25 06:37:35&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-28 07:59:07&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-31 10:36:07&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-04 11:16:36&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-07 18:11:02&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-11 05:09:37&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-14 06:26:10&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-18 15:58:17&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-22 11:10:25&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-27 06:59:55&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-30 12:38:54&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-03 15:24:36&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-06 17:05:30&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-10 12:07:21&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-14 23:33:58&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-19 11:27:54&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-23 02:59:38&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-29 05:05:46&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-01 06:55:32&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-04 20:59:59&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-08 05:37:55&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-11 15:39:15&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-14 16:52:39&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-18 01:16:02&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-22 04:29:36&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-22 04:29:36&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. Objective Today, in this SparkDataFrames Tutorial, we will learn the whole concept of creating DataFrames in SparkR.\u00a0Data is organized as a distributed collection of data into named columns. Basically, that we call a&#46;&#46;&#46;<\/p>\n","protected":false},"author":6,"featured_media":6215,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[3062,3088,3536,4409,13047,15438],"class_list":["post-5644","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-spark","tag-create-dataframes-in-spark-r","tag-create-sparkdataframes","tag-dataframe-in-spark","tag-examples-of-sparkdataframe","tag-spark-dataframe","tag-ways-to-create-sparkdataframe"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Ways to Create SparkDataFrames in SparkR - DataFlair<\/title>\n<meta name=\"description\" content=\"SparkDataFrames in SparkR, Ways to Create SparkDataFrame from local dataframes, create SparkDataFrame from hive table,create SparkDataFrame from Data source\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/create-sparkdataframes\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Ways to Create SparkDataFrames in SparkR - DataFlair\" \/>\n<meta property=\"og:description\" content=\"SparkDataFrames in SparkR, Ways to Create SparkDataFrame from local dataframes, create SparkDataFrame from hive table,create SparkDataFrame from Data source\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/create-sparkdataframes\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-01-17T08:53:30+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-09-18T06:06:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Creating-SparkDataFrames-in-SparkR.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Ways to Create SparkDataFrames in SparkR - DataFlair","description":"SparkDataFrames in SparkR, Ways to Create SparkDataFrame from local dataframes, create SparkDataFrame from hive table,create SparkDataFrame from Data source","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/create-sparkdataframes\/","og_locale":"en_US","og_type":"article","og_title":"Ways to Create SparkDataFrames in SparkR - DataFlair","og_description":"SparkDataFrames in SparkR, Ways to Create SparkDataFrame from local dataframes, create SparkDataFrame from hive table,create SparkDataFrame from Data source","og_url":"https:\/\/data-flair.training\/blogs\/create-sparkdataframes\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-01-17T08:53:30+00:00","article_modified_time":"2018-09-18T06:06:55+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Creating-SparkDataFrames-in-SparkR.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/create-sparkdataframes\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/create-sparkdataframes\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89"},"headline":"Ways to Create SparkDataFrames in SparkR","datePublished":"2018-01-17T08:53:30+00:00","dateModified":"2018-09-18T06:06:55+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/create-sparkdataframes\/"},"wordCount":559,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/create-sparkdataframes\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Creating-SparkDataFrames-in-SparkR.jpg","keywords":["Create DataFrames in Spark R","Create SparkDataFrames","Dataframe in Spark","Examples of SparkDataFrame","Spark DataFrame","Ways to Create SparkDataFrame"],"articleSection":["Apache Spark Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/create-sparkdataframes\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/create-sparkdataframes\/","url":"https:\/\/data-flair.training\/blogs\/create-sparkdataframes\/","name":"Ways to Create SparkDataFrames in SparkR - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/create-sparkdataframes\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/create-sparkdataframes\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Creating-SparkDataFrames-in-SparkR.jpg","datePublished":"2018-01-17T08:53:30+00:00","dateModified":"2018-09-18T06:06:55+00:00","description":"SparkDataFrames in SparkR, Ways to Create SparkDataFrame from local dataframes, create SparkDataFrame from hive table,create SparkDataFrame from Data source","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/create-sparkdataframes\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/create-sparkdataframes\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/create-sparkdataframes\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Creating-SparkDataFrames-in-SparkR.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Creating-SparkDataFrames-in-SparkR.jpg","width":1200,"height":628,"caption":"Create SparkDataFrame in SparkR"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/create-sparkdataframes\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Apache Spark Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/spark\/"},{"@type":"ListItem","position":3,"name":"Ways to Create SparkDataFrames in SparkR"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team provides industry-driven content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our expert educators focus on delivering value-packed, easy-to-follow resources for tech enthusiasts and professionals.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam2\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/5644","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=5644"}],"version-history":[{"count":4,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/5644\/revisions"}],"predecessor-version":[{"id":34575,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/5644\/revisions\/34575"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/6215"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=5644"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=5644"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=5644"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}