Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
| Ctrl+C | copy current line (if no selection) |
| Ctrl+X | cut current line (if no selection) |
| Ctrl+⇧+K | delete line |
| Ctrl+↩ | insert line after |
Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
| Ctrl+C | copy current line (if no selection) |
| Ctrl+X | cut current line (if no selection) |
| Ctrl+⇧+K | delete line |
| Ctrl+↩ | insert line after |
| ############################################ | |
| # Syntax highlighting for R # | |
| # by Stephen Haptonstahl # | |
| # March 15, 2009 # | |
| # http://srh.ucdavis.edu/drupal/node/20 # | |
| # edited by Mike Miller # | |
| # Placed on GitHub by Alan O'Callaghan # | |
| # (could no longer find the original) # | |
| ############################################ |
| library("ggplot2") | |
| library("usmap") | |
| library("httr") | |
| library("readxl") | |
| # Read data | |
| GET("https://query.data.world/s/pth2w34nwc6uhg7mmvr7n56257y2gw", write_disk(tf <- tempfile(fileext = ".xlsx"))) | |
| pets <- read_excel(tf) | |
| pets <- pets[!colnames(pets) %in% "X"] |
| library("scRNAseq") | |
| library("scater") | |
| library("scran") | |
| library("flexmix") | |
| library("mixtools") | |
| library("viridis") | |
| library("annotables") | |
| theme_set(theme_bw()) | |
| sce <- ZeiselBrainData() |
| # R port of Dmitry Kobak's excellent PCA animations. | |
| # See https://gist.github.com/anonymous/7d888663c6ec679ea65428715b99bfdd | |
| # for matlab/octave code | |
| dir.create("gif", showWarnings = FALSE) | |
| set.seed(42) | |
| X <- matrix(rnorm(200), ncol = 2) | |
| X <- X %*% chol(matrix(c(1, 0.6, 0.6, 0.6), ncol = 2, byrow = TRUE)) | |
| X <- apply(X, 2, function(col) col - mean(col)) |
| library(utils) | |
| for (pkg in rownames(installed.packages(priority="base"))) library(pkg, character.only=TRUE) | |
| pkgs <- c( | |
| "NHANES", | |
| "RNHANES", | |
| "ggplot2", | |
| "jtools", | |
| "interactions", | |
| "patchwork", |
| #!/usr/bin/env bash | |
| set -eu | |
| if [ -f ~/miniconda3/etc/profile.d/conda.sh ]; then | |
| [ -z "${CONDA_EXE}" ] && echo "Error, missing \$CONDA_EXE !" && exit 1 | |
| CONDA_BASE=$(${CONDA_EXE} info --base) | |
| ADDR2LINE="" | |
| source $CONDA_BASE/etc/profile.d/conda.sh | |
| conda activate $1 || exit 1 | |
| fi |
| ## using natbib | |
| ## when finished adding refs, run | |
| bibexport --nosave -o [LOCAL_BIB_FILE] main.aux | |
| ## then switch the \bibliography command from the central file to the local one, ie change | |
| # % \bibliography{[CENTRAL_BIB_FILE]} | |
| # % \bibliography{[LOCAL_BIB_FILE]} | |
| # % with biblatex you would run something like | |
| jabref -n --aux main.aux,[LOCAL_BIB_FILE] [CENTRAL_BIB_FILE] | |
| ## and again switch which bib file you're working with |
| library("ggplot2") | |
| library("ggdist") | |
| library("latex2exp") | |
| set.seed(42) | |
| means <- rnorm(4) | |
| df_slabplot <- rbind( | |
| data.frame( | |
| method = "hmc", | |
| bj = rnorm(4000, mean = rep(means, each = 1000)), |