This is an old revision of the document!
Collection of Snippets for R
# Looping and iterative snippets for=for(%cursor% in %cursor%)%block_cursor% while=while(%cursor% == %cursor%)%block_cursor% if=if(%cursor% == %cursor%)%block_cursor% ifelse=if(%cursor% == %cursor%)%block_cursor%else%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%")