# R-snippets

R snippets for Sublimetext

## Details

## Installs

- Total 10K
- Win 5K
- Mac 4K
- Linux 2K

Sep 30 | Sep 29 | Sep 28 | Sep 27 | Sep 26 | Sep 25 | Sep 24 | Sep 23 | Sep 22 | Sep 21 | Sep 20 | Sep 19 | Sep 18 | Sep 17 | Sep 16 | Sep 15 | Sep 14 | Sep 13 | Sep 12 | Sep 11 | Sep 10 | Sep 9 | Sep 8 | Sep 7 | Sep 6 | Sep 5 | Sep 4 | Sep 3 | Sep 2 | Sep 1 | Aug 31 | Aug 30 | Aug 29 | Aug 28 | Aug 27 | Aug 26 | Aug 25 | Aug 24 | Aug 23 | Aug 22 | Aug 21 | Aug 20 | Aug 19 | Aug 18 | Aug 17 | Aug 16 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|

Windows | 0 | 1 | 3 | 0 | 2 | 3 | 2 | 1 | 0 | 2 | 0 | 2 | 0 | 0 | 0 | 1 | 2 | 2 | 1 | 2 | 2 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 4 | 0 | 1 | 0 | 0 | 2 | 3 | 1 | 2 | 3 | 1 | 2 | 0 | 1 | 0 | 1 |

Mac | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 2 | 1 | 0 | 2 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 2 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |

Linux | 0 | 0 | 0 | 2 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 2 | 1 | 2 | 1 | 0 | 3 | 3 | 1 | 0 | 0 | 0 | 0 |

## Readme

- Source
- raw.githubusercontent.com

# R-snippets

This package includes a selection of R snippets for Sublimetext that I find useful when using R through SublimeREPL

Check out the project page at http://www.jvcasillas.com/code/projects/R-snippets

Just type the trigger and hit the tab key. For example…

```
lm
```

Expands to…

```
# load lme4 for mixed models
library(lme4)
# random intercept and random slope model
modelName <- lmer(DV ~ fixedFactor1 +* fixedFactor2 + (1 + randomSlope|randomInt), data=df)
summary(modelName)
```

## Main triggers

- “plot”: templates for plotting in base R
- “edit”: options useful for data cleansing and saving
- “desc”: descriptive statistics of data
- “ttest”: distinct types of t-test
- “aov”: distinct analysis of variance models
- “lm”: linear and logistic regression
- “lmem”: linear mixed effects models

## Extras

- “subset”: make subsets of a DF
- “read”: read/load/install data/packages into R
- “save”: save plots, dfs, tables, etc.
- “tikz”: template for creating R plots in LaTeX

**Note** All snippets have the following scopes:

```
source.r, text.html.markdown.knitr, text.tex.latex, text.html.markdown.rmarkdown
```

## To add

- knitr
- dplyr
- coursera