The rgcs
package provides an R interface to Google Cloud Storage . Currently it supports functionality for listing, downloading, and uploading files to/from GCS.
Not on CRAN/MRAN yet - please install via devtools::install_github
via :
devtools::install_github("lytics/rgcs")
Before doing anything fun, you must authorize GCS from your browser. Like the R BigQuery pacakge, httr
caches the OAUTH access and refresh tokens for easy access.
library(rgcs)
# get all GCS buckets that belong to a project
buckets <- list_buckets(project = "my-project")
# get all files in a GCS Bucket
store <- gcs_store$new(bucket = buckets[1])
files <- store$list_files()
prefixed.files <- store$list_files(list(prefix = "mtcars"))
# download a file to a GCS bucket
store$download_file(list(prefix = "mtcars.csv"))
# upload a file from a GCS bucket
store$upload_file(name = "destination.csv", df = mtcars)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.