<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using R, how do we write csv file to say dbfs:/tmp? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/using-r-how-do-we-write-csv-file-to-say-dbfs-tmp/m-p/29254#M20998</link>
    <description>&lt;P&gt;%r&lt;/P&gt;&lt;P&gt;write.csv(df,file='/tmp/df.csv',row.names = FALSE)&lt;/P&gt;&lt;P&gt;%fs ls /tmp&lt;/P&gt;&lt;P&gt;above does not show that the file df.csv exist&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;below will have error:&lt;/P&gt;&lt;P&gt;%r&lt;/P&gt;&lt;P&gt;write.csv(df,file='/dbfs/tmp/df.csv',row.names = FALSE)&lt;/P&gt;&lt;P&gt;Warning in file(file, ifelse(append, "a", "w")) :&lt;/P&gt;&lt;P&gt;  cannot open file '/dbfs/tmp/df.csv': No such file or directory&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error in file(file, ifelse(append, "a", "w")) : &lt;/P&gt;&lt;P&gt;  cannot open the connection&lt;/P&gt;&lt;P&gt;Some(&amp;lt;code style = 'font-size:10pt'&amp;gt; Error in file(file, ifelse(append, &amp;amp;quot;a&amp;amp;quot;, &amp;amp;quot;w&amp;amp;quot;)): cannot open the connection &amp;lt;/code&amp;gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 26 Oct 2022 00:18:06 GMT</pubDate>
    <dc:creator>THIAM_HUATTAN</dc:creator>
    <dc:date>2022-10-26T00:18:06Z</dc:date>
    <item>
      <title>Using R, how do we write csv file to say dbfs:/tmp?</title>
      <link>https://community.databricks.com/t5/data-engineering/using-r-how-do-we-write-csv-file-to-say-dbfs-tmp/m-p/29251#M20995</link>
      <description>&lt;P&gt;let us say I already have the data 'TotalData'&lt;/P&gt;&lt;P&gt;write.csv(TotalData,file='/tmp/TotalData.csv',row.names = FALSE)&lt;/P&gt;&lt;P&gt;I do not see any error from above&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when I list files below:&lt;/P&gt;&lt;P&gt;%fs ls /tmp&lt;/P&gt;&lt;P&gt;I do not see any files written there. Why?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 03:35:56 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/using-r-how-do-we-write-csv-file-to-say-dbfs-tmp/m-p/29251#M20995</guid>
      <dc:creator>THIAM_HUATTAN</dc:creator>
      <dc:date>2022-10-05T03:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Using R, how do we write csv file to say dbfs:/tmp?</title>
      <link>https://community.databricks.com/t5/data-engineering/using-r-how-do-we-write-csv-file-to-say-dbfs-tmp/m-p/29252#M20996</link>
      <description>&lt;P&gt;Hi Thiam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for reaching out to us. In this case it seems that you have written a file to the OS /tmp and tried to fetch the same folder in DBFS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Written &amp;gt;&amp;gt; /tmp/TotalData.csv&lt;/P&gt;&lt;P&gt;Reading &amp;gt;&amp;gt; /dbfs/tmp/TotalData.csv&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try to execute write.csv with the following path instead:&lt;/P&gt;&lt;P&gt;&lt;I&gt;write.csv(TotalData,file='/dbfs/tmp/TotalData.csv',row.names = FALSE)&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;%fs ls /tmp&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you will see the file in DBFS. If your intention was to write it to the OS /tmp, please do the following:&lt;/P&gt;&lt;P&gt;&lt;I&gt;write.csv(TotalData,file='/tmp/TotalData.csv',row.names = FALSE)&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;%sh ls /tmp&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;%sh&lt;/B&gt; allows you to run shell code on the OS while &lt;B&gt;%fs&lt;/B&gt; is used for DBFS file access.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please read the following documentation for more information:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/notebooks/notebooks-use.html#:~:text=Notebooks%20also%20support%20a%20few%20auxiliary%20magic%20commands%3A" target="test_blank"&gt;https://docs.databricks.com/notebooks/notebooks-use.html#:~:text=Notebooks%20also%20support%20a%20few%20auxiliary%20magic%20commands%3A&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 12:40:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/using-r-how-do-we-write-csv-file-to-say-dbfs-tmp/m-p/29252#M20996</guid>
      <dc:creator>Cedric</dc:creator>
      <dc:date>2022-10-05T12:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using R, how do we write csv file to say dbfs:/tmp?</title>
      <link>https://community.databricks.com/t5/data-engineering/using-r-how-do-we-write-csv-file-to-say-dbfs-tmp/m-p/29254#M20998</link>
      <description>&lt;P&gt;%r&lt;/P&gt;&lt;P&gt;write.csv(df,file='/tmp/df.csv',row.names = FALSE)&lt;/P&gt;&lt;P&gt;%fs ls /tmp&lt;/P&gt;&lt;P&gt;above does not show that the file df.csv exist&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;below will have error:&lt;/P&gt;&lt;P&gt;%r&lt;/P&gt;&lt;P&gt;write.csv(df,file='/dbfs/tmp/df.csv',row.names = FALSE)&lt;/P&gt;&lt;P&gt;Warning in file(file, ifelse(append, "a", "w")) :&lt;/P&gt;&lt;P&gt;  cannot open file '/dbfs/tmp/df.csv': No such file or directory&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error in file(file, ifelse(append, "a", "w")) : &lt;/P&gt;&lt;P&gt;  cannot open the connection&lt;/P&gt;&lt;P&gt;Some(&amp;lt;code style = 'font-size:10pt'&amp;gt; Error in file(file, ifelse(append, &amp;amp;quot;a&amp;amp;quot;, &amp;amp;quot;w&amp;amp;quot;)): cannot open the connection &amp;lt;/code&amp;gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 00:18:06 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/using-r-how-do-we-write-csv-file-to-say-dbfs-tmp/m-p/29254#M20998</guid>
      <dc:creator>THIAM_HUATTAN</dc:creator>
      <dc:date>2022-10-26T00:18:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using R, how do we write csv file to say dbfs:/tmp?</title>
      <link>https://community.databricks.com/t5/data-engineering/using-r-how-do-we-write-csv-file-to-say-dbfs-tmp/m-p/29255#M20999</link>
      <description>&lt;P&gt;please see above. thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 00:20:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/using-r-how-do-we-write-csv-file-to-say-dbfs-tmp/m-p/29255#M20999</guid>
      <dc:creator>THIAM_HUATTAN</dc:creator>
      <dc:date>2022-10-26T00:20:27Z</dc:date>
    </item>
  </channel>
</rss>

