-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathREADME.Rmd
59 lines (41 loc) · 1.88 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
output:
md_document:
variant: markdown_github
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
snippr: publish, install, and share RStudio code snippets
------------------------------------------
snippr provides tools to manage and install [RStudio code snippets](http://blog.rstudio.org/2015/04/13/rstudio-v0-99-preview-code-snippets/), including installing them from public repositories.
### Setup
You can install `snippr` with the [devtools](https://github.com/hadley/devtools) package:
```{r eval = FALSE}
devtools::install_github("dgrtwo/snippr")
```
### Sharing and installing snippets
snippr lets you share RStudio snippets with others by publishing them as a [GitHub repository](https://github.com/) or a [Gist](https://gist.github.com/).
To share your snippets, create a GitHub repository with one or more `.snippets` file at the top level: see the [dgrtwo/snippets](https://github.com/dgrtwo/snippets) repository for an example. Anyone can then install your snippets using the code:
```{r eval = FALSE}
library(snippr)
snippets_install_github("dgrtwo/snippets")
```
Note that you may need to restart RStudio for the snippets to load. If you want to install only for one of the languages in the repo, you can use the `language` argument:
```{r eval = FALSE}
snippets_install_github("dgrtwo/snippets", language = "r")
```
Or you can choose to install only a single snippet:
```{r eval = FALSE}
snippets_install_github("dgrtwo/snippets", language = "r", name = "S3")
```
If you prefer, you can share one .snippets file as a GitHub Gist (like [this one](https://gist.github.com/dgrtwo/ecc6aec8d37af42cdd83)), and install it with its ID:
```{r eval = FALSE}
snippets_install_gist("ecc6aec8d37af42cdd83", language = "r")
```
See the vignettes for more.