• Stars
    star
    152
  • Rank 244,685 (Top 5 %)
  • Language
    R
  • License
    Apache License 2.0
  • Created over 10 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Digital Ocean R client

analogsea

codecov.io rstudio mirror downloads cran version R-CMD-check Lifecycle: stable

sticker

Use our link https://m.do.co/c/1d5a471e5f54, you'll get 100 usd in credits to try DO!

analogsea is an R client for version 2 of the Digital Ocean API. See ?droplet_functions after loading analogsea. It allows you to programatically create and destroy droplets (remote computers), and install various R related tools:

  • R (done)
  • RStudio Server (done)
  • RStudio Shiny Server (done)
  • OpenCPU (not yet)
  • Use packrat to move a project to a droplet (not yet)

In addition, it allows you to use a readily available image with RStudio Server, Shiny Server and fully tidyverse from DigitalOcean Marketplace.

Docs: https://pacha.dev/analogsea/.

Use cases

Install

Stable version from CRAN

install.packages("analogsea")

Development version from GitHub

remotes::install_github("pachadotdev/analogsea")
library("analogsea")

Create a DO account

If you don't already have one, create a DO account. By using this link, you'll start with $100 in credits with a 2 months limit. This is enough for 1440 hours of computing on a machine with 4 GB memory and 2 dedicated CPUs.

Authenticate

The best way to authenticate is to generate a personal access token (https://cloud.digitalocean.com/settings/tokens/new) and save it in an environment variable called DO_PAT. If you don't do this, you'll be prompted to authenticate in your browser the first time you use analogsea.

Make sure you provide DigitalOcean your public key at https://cloud.digitalocean.com/ssh_keys. Github has some good advice on creating a new public key if you don't already have one: https://help.github.com/articles/generating-ssh-keys/.

It is highly recommended to use DO_PAT, it's easier and allows (semi) automated tasks.

To use ssh keys install the recommended ssh package: r install.packages("ssh").

Get droplets

All droplets

droplets()
<r> droplets()
$unintrenchable
<droplet>unintrenchable (2724525)
  Status: off
  Region: San Francisco 1
  Image: Ubuntu 14.04 x64
  Size: 512mb ($0.00744 / hr)

$basipterygium
<droplet>basipterygium (2724526)
  Status: active
  Region: San Francisco 1
  Image: Ubuntu 14.04 x64
  Size: 512mb ($0.00744 / hr)

A single droplet. Pass in a single droplet id.

droplet(2724525)
<droplet>unintrenchable (2724525)
  Status: off
  Region: San Francisco 1
  Image: Ubuntu 14.04 x64
  Size: 512mb ($0.00744 / hr)

Spin up a new droplet

To make this as dead simple as possible, you just use one function, without any parameters.

droplet_create()
Using default ssh key: Jane Doe
NB: This costs $0.00744 / hour  until you droplet_delete() it
<droplet>sabaoth (2727258)
  Status: new
  Region: San Francisco 1
  Image: Ubuntu 14.04 x64
  Size: 512mb ($0.00744 / hr)

You can of course pass in lots of options for name of the droplet, RAM size, disk size, ssh keys, etc. See regions() and sizes() to list available regions and sizes.

Delete a droplet

droplet_delete(1707487)

Chaining

Most of the droplet_* functions can be chained together using the %>% function. For example, you can turn a droplet off, snapshot, and then turn it back on with:

d %>%
   droplet_power_off() %>%
   droplet_snapshot() %>%
   droplet_power_on() %>%

R/RStudio

We're still working on these, but would love feedback.

By default, analogsea creates an Ubuntu 20.04 image. Let's say you've got ten students from an R workshop, then you can run

droplet_create("rstudio-20-04")

users <- list(
  user = paste0("student", 1:5),
  password = sapply(rep(8,5), create_password)
)
  
for (i in seq_along(users$user)) {
  ubuntu_create_user(x, users$user[i], users$password[i], keyfile = "~/.ssh/id_rsa")
}

Then, each student shall be able to open RStudio from the browser, by visiting http://123.456.789:8787 and accessing with studentX (X = 1,...,10) and the password created.

To install more R packages, you can make them readily available for all the users that have access to your droplet with

ubuntu_install_r() # ohlf if you didn't use the RStudio image
install_r_package("arrow")

Shiny

The RStudio Server image also features readily available Shiny Server, but we provide the functions ubuntu_install_shiny() and docklet_shinyserver() (requires to use the Docker image, i.e. docklet_create()) to configure Shiny from scratch.

Install RStudio Server

For the standard Ubuntu image you can use ubuntu_install_rstudio().

For dockerized RStudio you have the next option:

docklet_create() %>%
  docklet_rstudio()

This will install R, RStudio Server and it's dependencies. It will automatically pop open the RStudio server instance in your default browser, with default username/password of rstudio/server.

Meta

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

More Repositories

1

d3po

Mega htmlwidget for Shiny.
JavaScript
41
star
2

chilemapas

Mapas terrestres de Chile con topologias simplificadas.
R
34
star
3

tradestatistics-visualization-with-shiny

Open Trade Statistics Shiny Dashboard
R
31
star
4

economiccomplexity

A wrapper of different indices and networks commonly used in Economic Complexity
HTML
29
star
5

jitsi-droplet

Shell
23
star
6

eflm

Efficient Fitting of Linear and Generalized Linear Models by using just base R. The speed gains over lm and glm are obtained by reducing the NxP model matrix to a PxP matrix, and the best computational performance is obtained when R is linked against OpenBLAS, Intel MKL or other optimized BLAS library.
R
18
star
7

rick_and_morty_tidy_text

SRecode Template
16
star
8

oec

The Observatory of Economic Complexity - R Package
R
13
star
9

r-packages-ubuntu

Install R packages as you would do on Windows (i.e., no long compilation time)
Shell
11
star
10

rstudio-server-droplet

Scripts with all the steps to create the RStudio Server image from DigitalOcean Marketplace
Shell
10
star
11

r-with-intel-mkl

R
8
star
12

casen

Funciones para realizar estadistica con el disenio complejo de la encuesta CASEN.
R
7
star
13

metabase-droplet

Scripts with all the steps to create the Metabase image from DigitalOcean Marketplace
Shell
7
star
14

x1-carbon-9th-gen-ubuntu

Minimal tweaks for a 100% good experience with Lenovo ThinkPad X1 Carbon 9th Gen on Ubuntu 20.04
7
star
15

leontief

Input-Output analysis (Macroeconomics).
C++
7
star
16

binet

Functions to build bipartite networks under the Tidyverse philosophy
R
6
star
17

openrefine-deb

Open Refine installer for Debian 9+ / Ubuntu 16.04+
Shell
5
star
18

linear-models-guide-codes

R
5
star
19

tradestatistics-database-postgresql

Tidy trade data from UN COMTRADE and also countries, commodities, RTAs and tariffs tables. Uses RDS and Apache Arrow, then uploads to PostgreSQL.
R
5
star
20

template-tesis-uchile

Plantilla para escribir tesis en R Markdown/LaTeX (siguiendo reglas de la U. de Chile)
TeX
5
star
21

tintin

Palettes generated from Tintin covers. There is one palette per cover, with a total of 24 palettes of 5 colours each. Includes functions to interpolate colors in order to create more colors based on the provided palettes.
R
4
star
22

bowie-timeline

JavaScript
3
star
23

oec-documentation

OEC Documentation
TeX
3
star
24

nene

Calculo del desempleo a partir de encuesta NENE (INE)
R
3
star
25

cepiigeodist

GeoDist datasets in R (CEPII)
R
3
star
26

rstudio-server-pkg-dev-droplet

Shell
3
star
27

tradepolicy

Replication of 'An Advanced Guide To Trade Policy Analysis'
Stata
3
star
28

datachile-data

R
3
star
29

analisis-de-datos-unab

Estadistica descriptiva, gráficos y regresiones en R.
HTML
2
star
30

mindicador

Indicadores Economicos de Chile (Economic Outlook for Chile)
R
2
star
31

cepiigravity

Gravity dataset in R (CEPII)
R
2
star
32

rstudio-server-stan-droplet

Shell
2
star
33

uarizona-workshops

HTML
2
star
34

freedomhouse

The goal of freedom is to ease the usage of the Freedom in the World dataset from Freedom House in R. The Freedom in the World dataset is updated annually and is originally available for download in Excel format.
R
2
star
35

constitucionabierta

R
2
star
36

youtube-codes

R
2
star
37

mastodonsocial.ca

A log of the things I do to keep MastodonSocial.ca running
2
star
38

advanced-international-trade-in-r

Stata
2
star
39

shinywordle

R
2
star
40

escapstructuralgravity

Shiny dashboard for estructural gravity modelling
R
2
star
41

tradestatistics-plumber-api

tradestatistics.io API, reads from PostgreSQL and provides tidy CSV and Apache Arrow data
R
2
star
42

unescap-gravity-2020

ARTNeT Advanced Workshop on Analysing Trade and Trade Policy with the Structural Gravity Model
R
2
star
43

valuation-systems

The standard is FOB for exports and CIF for imports, but that's not always the case. I got the detail by country-year from https://comtrade.un.org/db/mr/daExpNoteDetail.aspx?.
R
2
star
44

censo2017python

Una Base de Datos de Alto Rendimiento del Censo 2017 de Chile.
Jupyter Notebook
1
star
45

satrday

CSS
1
star
46

leanpub-quarto-template

Leanpub Quarto Template
TeX
1
star
47

databases.pacha.dev

HTML
1
star
48

cpp11-r-examples

C++
1
star
49

prettydoc_experiments

prettydoc themes based on Yixuan Qiu's R package
CSS
1
star
50

gravity-test-bank-public

1
star
51

r-ladies

HTML
1
star
52

LSTS

Locally Stationary Time Series
R
1
star
53

estadistica-y-r-en-castellano

1
star
54

lucida-minion-tex

Install Minion Pro and Lucida for TeX
TeX
1
star
55

zotero-redhat-package

1
star
56

uncomtrademisc

Ease some data munging when using UN COMTRADE data.
R
1
star
57

chilean-constitution

HTML
1
star
58

baci-replication-try

An attempt to replicate the article 'BACI: International Trade Database at the Product-Level. The 1994-2007 Version' for the course STA2101
R
1
star
59

cpp11omp

Demonstration that cpp11 can use OpenMP with the right compiler
C++
1
star
60

general-equilibrium-ftas-chile

TeX
1
star
61

analisis-redes-latinr-2019

R
1
star
62

r-users-groups

HTML
1
star
63

cepii-datasets-arrow

R
1
star
64

canadamaps

Maps of the Political and Administrative Divisions of Canada.
R
1
star
65

dulmagemendelsohn

C
1
star