storage_write function

Read and write a data frame to/from a storage account

Read and write a data frame to/from a storage account

storage_write_delim(object, container, file, delim = "\t", ...) storage_write_csv(object, container, file, ...) storage_write_csv2(object, container, file, ...) storage_read_delim(container, file, delim = "\t", ...) storage_read_csv(container, file, ...) storage_read_csv2(container, file, ...)

Arguments

  • object: A data frame to write to storage.
  • container: An Azure storage container object.
  • file: The name of a file in storage.
  • delim: For storage_write_delim and storage_read_delim, the field delimiter. Defaults to \t (tab).
  • ...: Optional arguments passed to the file reading/writing functions. See 'Details'.

Details

These functions let you read and write data frames to storage. storage_read_delim and write_delim are for reading and writing arbitrary delimited files. storage_read_csv and write_csv are for comma-delimited (CSV) files. storage_read_csv2 and write_csv2 are for files with the semicolon ; as delimiter and comma , as the decimal point, as used in some European countries.

If the readr package is installed, they call down to read_delim, write_delim, read_csv2 and write_csv2. Otherwise, they use read_delim and write.table.

Examples

## Not run: bl <- storage_endpoint("https://mystorage.blob.core.windows.net/", key="access_key") cont <- storage_container(bl, "mycontainer") storage_write_csv(iris, cont, "iris.csv") # if readr is not installed irisnew <- storage_read_csv(cont, "iris.csv", stringsAsFactors=TRUE) # if readr is installed irisnew <- storage_read_csv(cont, "iris.csv", col_types="nnnnf") all(mapply(identical, iris, irisnew)) # TRUE ## End(Not run)

See Also

storage_download , download_blob , download_azure_file , download_adls_file , write.table , read.csv , readr::write_delim , readr::read_delim

  • Maintainer: Hong Ooi
  • License: MIT + file LICENSE
  • Last published: 2022-05-25