Downloads an object and parses it according to its extension (or
format):
Usage
read_s3(key, bucket = NULL, ..., format = NULL, config = s3_config())Arguments
- key
Object key inside
bucket, or ans3://bucket/keyURL.- bucket
Bucket; defaults to the config's bucket (
S3PE_BUCKET).- ...
Passed to the reader (for example
col_typesfor CSV,simplifyVectorfor JSON).- format
One of
"csv","tsv","json","geojson","parquet","rds","xlsx","text","raw"; overrides the extension.- config
An
s3_config().
Details
| Extension | Reader | Result |
.csv, .csv.gz | readr::read_csv() | tibble |
.tsv, .tsv.gz | readr::read_tsv() | tibble |
.json | jsonlite::fromJSON() | list or data frame |
.geojson | sf::st_read() if sf is installed, else jsonlite | sf or list |
.parquet | nanoparquet::read_parquet() | data frame |
.rds | readRDS() | the saved object |
.xlsx | readxl::read_excel() | tibble |
.txt, .md, .html, .xml, .svg, ... | character (one string) | |
| anything else | raw vector |
The byte count is checked against the server's Content-Length and,
when the ETag is an MD5, against the MD5 of what arrived.