R scratchpad - References for experienced users

Simon

Cheatsheets

Cheetsheets including for:

ggplot

Articles

extensions and packages

All Your Figure Are Belong To Us ggplot2 extensions - gallery

tips

tidyverse tips

Other tips

Modelling

GLM helpers

Modelling packages

Other packages of note

Useful commands

General

clip(object_name) # copy an object to clipboard
do.call("function name") # constructs and executes a function call from a name or a function and a list of arguments to be passed to it
get("object name") # Return the Value of a Named Object
rm(list = ls()) # clear objects from workspace
readRDS() / saveRDS() # Functions to write a single R object to a file, and to restore it
View() # Invoke a spreadsheet-style data viewer on a matrix-like R object
%T>% # Pipe a value forward into a function- or call expression and return the original value instead of the result. This is useful when an expression is used for its side-effect, say plotting or printing.

Benchmarking

ptm <- proc.time() # Initiate a timer
proc.time() - ptm # Stop the timer
system.time() # time a particular command
 
# alternative library
library("rbenchmark")

Memory usage

source: Advanced R - Memory

library(pryr)
tracemem() # memory address
mem_used() # memory usage of an object
mem_change() # memory change from a command

Other references

Excel

Blogs

References