Salty Gold Fish
Salty Gold Fish

Reputation: 463

Save RData to Azure Blob Storage

I'm recently learning how to read & write files to Azure Blob Storage using R on Azure Databricks. Are there any tutorials on how to save RData file to Azure Blob Storage?

Upvotes: 0

Views: 722

Answers (2)

Hong Ooi
Hong Ooi

Reputation: 57686

The latest version of AzureStor now has a storge_save_rdata function:

bl <- blob_endpoint("https://myacct.blob.core.windows.net", key="mykey")
cont <- storage_container(bl, "mycontainer")
storage_save_rdata(iris, mtcars, container=cont, file="myblob.rdata")

Upvotes: 1

unknown
unknown

Reputation: 7483

There is a solution to upload the data frame as a CSV directly from the R environment using AzureStor package.

w_con <- textConnection("foo", "w")
write.csv(ds,w_con)
r_con <- textConnection(textConnectionValue(w_con))
close(w_con)
upload_blob(container, src=r_con, dest=paste0("check_",ds[1, "Claim Number"], '_',ds[1, "Claim Type"], ".csv"))
close(r_con)  

For more details, see the operations on a blob container or blob.

Upvotes: 0

Related Questions