docs/2020-05-19_azure-rstudio-server-and-pins.md

2020-05-19: Azure, RStudio server, and pins

This meetup is structured as a mini-workshop. You learn about three tools you can combine to improve the way you manage data: Azure, RStudio server and the pins package. As a side effect you will also learn a system we plan to use in a longer workshop.

Find materials are at https://github.com/2DegreesInvesting/ds-incubator/issues/45; the most important document to follow along is https://bit.ly/dsi-pin-azure.

Introduction

Open 00_intro-rmd.Rmd

The goal of this section is to practice the tools we'll be using later:

Managing these three things at once is hard and will likely distract you from learning anything. A little practice will help you will master these tools so you can focus on the content of the lessons to come.

Objective

RMarkdown notebooks

This is an R Markdown Notebook. When you execute code within the notebook, the results appear beneath the code.

R code goes in code chunks, denoted by three backticks. Try executing this chunk by clicking the Run button within the chunk or by placing your cursor inside it and pressing Crtl+Shift+Enter (Windows) or Cmd+Shift+Enter (Mac).

packageVersion("pins")

Setup an Azure board for pins

Open 01_setup-azure-board.Rmd

Objective

Setup an Azure board for pins

AZURE_STORAGE_CONTAINER="test-container"
AZURE_STORAGE_ACCOUNT="2diiteststorage"
# Not my real key
AZURE_STORAGE_KEY="ABABAB...=="

Use an Azure board

Open 02_use-azure-board.Rmd

https://bit.ly/dsi-pin-azure

Objectives

Use the pins package and register our Azure board

library(pins)
board_register_azure()

Find datasets in our Azure board

pin_find("mtc", board = "azure")

Get a dataset from our Azure board

mydata <- pin_get("mtcars", board = "azure")
mydata

Save processed data to the server's cache

smalldata <- head(mydata)
smalldata
pin(smalldata)
pin_find("smalldata")
pin_get("smalldata")

Visualize the structure of the server's cache.

server_cache <- board_cache_path()
server_cache
fs::dir_tree(server_cache)

Takeaways



2DegreesInvesting/ds-incubator documentation built on Oct. 13, 2021, 10:09 a.m.