cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Exporting R data frame variable

Brave
New Contributor II

Hi all.

I am trying to export R data frame variable as csv file.

I am using this formula:

df<- data.frame(VALIDADOR_FIM)

df.coalesce(1).write.format("com.databricks.spark.csv").option("header", "true").save("dbfs:/FileStore/df/df.csv")

But isnยดt working. How can this as export a csv file?

1 ACCEPTED SOLUTION

Accepted Solutions

sher
Valued Contributor II

Please try to execute write.csv with the following path instead:

write.csv(TotalData,file='/dbfs/tmp/df.csv',row.names = FALSE)

%fs ls /tmp

View solution in original post

6 REPLIES 6

sher
Valued Contributor II

Please try to execute write.csv with the following path instead:

write.csv(TotalData,file='/dbfs/tmp/df.csv',row.names = FALSE)

%fs ls /tmp

Brave
New Contributor II

Hi @sherbin wโ€‹ tanks for Help! Now how i can acess this .csv to download?

I tryed:

%fs ls /tmp

and

read.df(path = "/tmp/VALIDADOR_FIM.csv")

but both didnยดt worked.

sher
Valued Contributor II

@FELIPE VALENTEโ€‹ 

you mean local download ?

Brave
New Contributor II

Yes!

sher
Valued Contributor II

I don't think that will be possible in databricks. may be i wrong.

But what I did was mount s3 put that CSV file there and download it.

Kaniz
Community Manager
Community Manager

Hi @FELIPE VALENTEโ€‹  (Customer)โ€‹, We havenโ€™t heard from you since the last response from @sherbin wโ€‹  (Customer)โ€‹ , and I was checking back to see if his suggestions helped you.

Or else, If you have any solution, please share it with the community, as it can be helpful to others.

Also, Please don't forget to click on the "Select As Best" button whenever the information provided helps resolve your question.

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.