From 2c204d5c094bc1f99792f982f09c24e0f52e8aa1 Mon Sep 17 00:00:00 2001
From: Shinya Uryu <uryu.shinya@nies.go.jp>
Date: Tue, 14 Jan 2020 20:08:38 +0900
Subject: [PATCH] Add renv examples

---
 examples.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/examples.md b/examples.md
index a2b3b92..f729bea 100644
--- a/examples.md
+++ b/examples.md
@@ -10,6 +10,7 @@
 - [Node - Yarn](#node---yarn)
 - [PHP - Composer](#php---composer)
 - [Python - pip](#python---pip)
+- [R - renv](#r---renv)
 - [Ruby - Bundler](#ruby---bundler)
 - [Rust - Cargo](#rust---cargo)
 - [Scala - SBT](#scala---sbt)
@@ -248,6 +249,55 @@ Replace `~/.cache/pip` with the correct `path` if not using Ubuntu.
       ${{ runner.os }}-pip-
 ```
 
+## R - renv
+
+For renv, the cache directory will vary by OS. Look at https://rstudio.github.io/renv/articles/renv.html#cache
+
+Locations:
+ - Ubuntu: `~/.local/share/renv`
+ - macOS: `~/Library/Application Support/renv`
+ - Windows: `%LOCALAPPDATA%/renv`
+
+### Simple example
+```yaml
+- uses: actions/cache@v1
+  with:
+    path: ~/.local/share/renv
+    key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
+    restore-keys: |
+      ${{ runner.os }}-renv-
+```
+
+Replace `~/.local/share/renv` with the correct `path` if not using Ubuntu.
+
+### Multiple OS's in a workflow
+
+```yaml
+- uses: actions/cache@v1
+  if: startsWith(runner.os, 'Linux')
+  with:
+    path: ~/.local/share/renv
+    key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
+    restore-keys: |
+      ${{ runner.os }}-renv-
+
+- uses: actions/cache@v1
+  if: startsWith(runner.os, 'macOS')
+  with:
+    path: ~/Library/Application Support/renv
+    key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
+    restore-keys: |
+      ${{ runner.os }}-renv-
+
+- uses: actions/cache@v1
+  if: startsWith(runner.os, 'Windows')
+  with:
+    path: ~\AppData\Local\renv
+    key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
+    restore-keys: |
+      ${{ runner.os }}-renv-
+```
+
 ## Ruby - Bundler
 
 ```yaml