This is an old revision of the document!


Collection of Snippets for R

# Looping and iterative snippets
for=for(%cursor% in %cursor%)%block_cursor%
apply=apply(%cursor%, %cursor%,\n\tFUN = %cursor%)
sapply=sapply(%cursor%,\n\tFUN = %cursor%)
lapply=lapply(%cursor%,\n\tFUN = %cursor%)
# Graphics devices autoclosing
png=png(%cursor%)\n\ndev.off()
pdf=pdf(%cursor%)\n\ndev.off()
bmp=bmp(%cursor%)\n\ndev.off()
postscript=ps(%cursor%)\n\ndev.off()
jpeg=jpeg(%cursor%)\n\ndev.off()
sink=sink(%cursor%)\n\nsink()
# Misc.
function= <- function(%cursor%)%block_cursor%
try= tryCatch(%cursor%,\n\terror = %cursor%)
collapse=paste(%cursor%, collapse = "%cursor%")
Print/export