Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/GegznaV/snippets
:heavy_check_mark: (R package) Manage RStudio snippets
https://github.com/GegznaV/snippets
r rstudio snippets
Last synced: 20 days ago
JSON representation
:heavy_check_mark: (R package) Manage RStudio snippets
- Host: GitHub
- URL: https://github.com/GegznaV/snippets
- Owner: GegznaV
- License: other
- Created: 2020-01-04T19:55:11.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-02-25T21:24:42.000Z (4 months ago)
- Last Synced: 2024-02-29T08:45:29.075Z (4 months ago)
- Topics: r, rstudio, snippets
- Language: Vim Snippet
- Homepage: https://gegznav.github.io/snippets/
- Size: 556 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Lists
- jimsghstars - GegznaV/snippets - :heavy_check_mark: (R package) Manage RStudio snippets (Vim Snippet)
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```[![CRAN status](https://www.r-pkg.org/badges/version/snippets)](https://CRAN.R-project.org/package=snippets)
[![GitHub version](https://img.shields.io/badge/GitHub-v`r packageVersion("snippets")`-brightgreen.svg)](https://github.com/GegznaV/snippets)
[![R build status](https://github.com/GegznaV/snippets/workflows/R-CMD-check/badge.svg)](https://github.com/GegznaV/snippets/actions)
[![Codecov test coverage](https://codecov.io/gh/GegznaV/snippets/branch/master/graph/badge.svg)](https://codecov.io/gh/GegznaV/snippets?branch=master)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
[![Updated-on](https://img.shields.io/badge/Updated%20on-`r gsub('-', '--', Sys.Date())`-yellowgreen.svg)]()# Package `snippets`
## Installation
To install package from CRAN-like repository:
```{r, eval=FALSE}
repos <- c("https://mokymai.github.io/download/", getOption("repos"))
install.packages("snippets", repos = repos)
```To install from [GitHub](https://github.com/):
```{r, eval=FALSE}
# install.packages("remotes")
remotes::install_github("GegznaV/snippets")
```## Quickstart
### Install Snippets from "snippets"
```{r eval=FALSE}
# Replace current files with snippets with those in package "snippets"
# (backup copies are created by default)
snippets::install_snippets_from_package("snippets")
``````{r, include=FALSE, eval=FALSE}
# Replace current R and Markdown snippets with those in package "snippets"
snippets::install_snippets_from_package("snippets", type = c("r", "markdown"), backup = TRUE)
```### More Examples
```{r eval=FALSE}
library(snippets)
``````{r eval=FALSE}
# Get the name of the directory where RStudio snippets are stored
get_path_rstudio_snippets_dir()
``````{r eval=FALSE}
# Open the directory with RStudio snippets
open_rstudio_snippets_dir()
``````{r eval=FALSE}
# Replace your R and Markdown snippets with those in package "snippets"
install_snippets_from_package("snippets", type = c("r", "markdown"), backup = TRUE)
list_snippet_file_backups()
``````{r eval=FALSE}
# View and edit file with snippets of certain type: r
open_rstudio_snippets_file(type = "r")
``````{r eval=FALSE}
# View and edit file with snippets of certain type: markdown
open_rstudio_snippets_file(type = "markdown")
```### Create and Clean-up Back-ups
```{r eval=FALSE}
# Create several back up files
backup_rstudio_snippets(type = "r")
Sys.sleep(1)
backup_rstudio_snippets(type = "r")
Sys.sleep(1)
backup_rstudio_snippets(type = "r")
``````{r eval=FALSE}
list_snippet_file_backups(type = "r")
``````{r eval=FALSE}
# Remove duplicated back-up files
remove_snippet_backup_duplicates()
```# Additional resources
## More on using and writing RStudio snippets
1. [Code Snippets](https://support.rstudio.com/hc/en-us/articles/204463668-Code-Snippets)
(on RStudio website).
All information is relevant to RStudio users.
2. [R tip: Save time with RStudio code snippets](https://www.youtube.com/watch?v=h_i__VTSurU)
(Case study on YouTube).
3. [Snippets](https://cloud9-sdk.readme.io/docs/snippets) (on Cloud9 SDK website).
Advanced topics on writing snippets.
Most sections (but not all) are relevant to RStudio users.## Similar projects
1. Package [**snippr**](https://github.com/dgrtwo/snippr).
## More snippets
1. [Snippets](https://github.com/dgrtwo/snippets) by @dgrtwo.
1. [Snippets](https://github.com/gadenbuie/snippets) by @gadenbuie.