s3_get | R Documentation |
Files are downloaded to the R user data directory (i.e., tools::R_user_dir("s3", "data")
) so they
can be cached across all of an R user's sessions and projects.
Specify an alternative download location by setting the R_USER_DATA_DIR
environment variable
(see ?tools::R_user_dir
) or by using the data_dir
argument.
s3_get(
s3_uri,
region = "us-east-2",
quiet = FALSE,
progress = FALSE,
force = FALSE,
public = FALSE,
data_dir = tools::R_user_dir("s3", "data")
)
s3_uri |
URI for an S3 object |
region |
AWS region for bucket containing the file (defaults to "us-east-2", but only required for private files) |
quiet |
suppress messages? |
progress |
show download progress? (currently only for public objects) |
force |
force download to overwrite existing S3 object |
public |
defaults to FALSE; if TRUE, ignore any environment variables specifying AWS credentials and attempt to download the file as publicly available |
data_dir |
root directory for downloaded files (defaults to |
a character string that is the file path to the downloaded file (invisibly)
Sys.setenv("R_USER_DATA_DIR" = tempdir())
the_file <- s3_get(s3_uri = "s3://geomarker/testing_downloads/mtcars.rds")
s3_get("s3://geomarker/testing_downloads/mtcars.rds") |>
readRDS()
unlink(the_file)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.