Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dgrtwo/snippr
Manage, share, and install RStudio code snippets
https://github.com/dgrtwo/snippr
Last synced: about 2 months ago
JSON representation
Manage, share, and install RStudio code snippets
- Host: GitHub
- URL: https://github.com/dgrtwo/snippr
- Owner: dgrtwo
- Created: 2015-04-14T19:01:00.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-03-20T12:43:15.000Z (over 6 years ago)
- Last Synced: 2024-10-09T22:05:40.253Z (2 months ago)
- Language: R
- Homepage:
- Size: 133 KB
- Stars: 78
- Watchers: 8
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
- jimsghstars - dgrtwo/snippr - Manage, share, and install RStudio code snippets (R)
README
---
output:
md_document:
variant: markdown_github
---```{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.