Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Use googleCloudStorageR to automatically upload to Cloud Storage
title: "Host image files on Google Cloud storage"
author: "Michael Whitaker"
date: "January 12, 2017"
self_contained: false
```{r setup, include=FALSE}
opts_chunk$set(echo = TRUE)
opts_knit$set( = function(file) {
upload_try <- gcs_upload(file, name = basename(file), predefinedAcl = "publicRead")
## R Markdown
The function in the above chunk uploads any generated images and adds the src URL automatically in the generated HTML file. Just change to your **BUCKETNAME**
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r cars}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment