An open API service indexing awesome lists of open source software.

https://github.com/moodymudskipper/shootnloot

Easily share objects between remote sessions
https://github.com/moodymudskipper/shootnloot

Last synced: 2 days ago
JSON representation

Easily share objects between remote sessions

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%",
shootnloot.ids = c(default = "1XzarXBNkLDYoeA5XsBa6NUUlYFUGcx4j",
antoine = "1XzarXBNkLDYoeA5XsBa6NUUlYFUGcx4j")
)
```

# shootnloot

EXPERIMENTAL

A package to easily share objects between remote sessions. You'll need a google account.

With {shootnloot} it takes a single call to upload an object, a script, or your full workspace,
and one more call on the recipient side to fetch it.

## Installation

Install with:

``` r
remotes::install_github("moodymudskipper/shootnloot")
```

## Example

```{r, echo = FALSE}
library(shootnloot)
```

To upload publicly conveniently I first define a new id, this basically
defines an online paste bin we'll be sending to and fetching from.

```{r, eval = FALSE}
new_id(type = "anyone")
```

```{r, echo = FALSE}
"1XzarXBNkLDYoeA5XsBa6NUUlYFUGcx4j"
```

Then I set it as my default id in my *.RProfile*.

```{r}
options(shootnloot.ids = c(default = "1XzarXBNkLDYoeA5XsBa6NUUlYFUGcx4j"))
```

And I communicate it to you the recipient so you can put in your own *.RProfile* :

```{r}
options(shootnloot.ids = c(antoine = "1XzarXBNkLDYoeA5XsBa6NUUlYFUGcx4j"))
```

From there whenever I use `shoot_object()` :

```{r, eval = FALSE}
shoot_object(head(iris))
```

You'll be able to loot the object with :

```{r, eval = FALSE}
loot_object("antoine")
```

```{r, echo = FALSE}
message(
"trying URL 'https://drive.google.com/uc?id=1XzarXBNkLDYoeA5XsBa6NUUlYFUGcx4j'\n",
"content type 'application/x-gzip' length 296 bytes\n",
"==================================================\n",
"downloaded 296 bytes")
head(iris)
```

Try to loot it yourself, that's all you need:

```{r, eval = FALSE}
remotes::install_github("moodymudskipper/shootnloot")
library(shootnloot)
options(shootnloot.ids = c(antoine = "1XzarXBNkLDYoeA5XsBa6NUUlYFUGcx4j"))
loot_object("antoine")
```

Different permissions can be set using arguments in `new_id()`, I might want to
set a location accessible only to my team for instance :

```
new_id(type = "domain", domain = "mycompany.com")
# in my .RProfile
options(shootnloot.ids = c(default = , = ))
# in my team mate's .RProfile
options(shootnloot.ids = c( = ))
# And then I can shoot safely :
shoot_object(mydata, "")
# And they can loot as above
loot_object("")
```

We can shoot and loot the entire global environment with `shoot_workspace()` and `loot_workspace()`.

If we're using RStudio we can shoot and loot a file `shoot_file()` and `loot_file()`. By default `shoot_file()` uploads the current script including unsaved changes. `loot_file()` fetches the file and
opens it in a new editor tab.

# Aknowledgements

This wraps the {googledrive} package. Thanks to Lucy D'Agostino McGowan, Jennifer Bryan
and other contributors to this great package.