简体   繁体   中英

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?

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")

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM