2012-08-10 09:58:38 -04:00
|
|
|
snippet #!
|
|
|
|
#!/usr/bin/env Rscript
|
|
|
|
|
|
|
|
# includes
|
|
|
|
snippet lib
|
2013-07-25 17:17:32 -04:00
|
|
|
library(${0:package})
|
2012-08-10 09:58:38 -04:00
|
|
|
snippet req
|
2013-07-25 17:17:32 -04:00
|
|
|
require(${0:package})
|
2012-08-10 09:58:38 -04:00
|
|
|
snippet source
|
2013-07-25 17:17:32 -04:00
|
|
|
source('${0:file}')
|
2012-08-10 09:58:38 -04:00
|
|
|
|
|
|
|
# conditionals
|
|
|
|
snippet if
|
|
|
|
if (${1:condition}) {
|
2013-07-25 17:17:32 -04:00
|
|
|
${0}
|
2012-08-10 09:58:38 -04:00
|
|
|
}
|
2012-08-10 10:44:45 -04:00
|
|
|
snippet el
|
2012-08-10 09:58:38 -04:00
|
|
|
else {
|
2013-07-25 17:17:32 -04:00
|
|
|
${0}
|
2012-08-10 09:58:38 -04:00
|
|
|
}
|
|
|
|
snippet ei
|
|
|
|
else if (${1:condition}) {
|
2013-07-25 17:17:32 -04:00
|
|
|
${0}
|
2012-08-10 09:58:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
# functions
|
|
|
|
snippet fun
|
2014-03-21 09:21:33 -04:00
|
|
|
${1:name} <- function (${2:variables}) {
|
2013-07-25 17:17:32 -04:00
|
|
|
${0}
|
2012-08-10 09:58:38 -04:00
|
|
|
}
|
|
|
|
snippet ret
|
2013-07-25 17:17:32 -04:00
|
|
|
return(${0})
|
2012-08-10 10:44:45 -04:00
|
|
|
|
|
|
|
# dataframes, lists, etc
|
|
|
|
snippet df
|
2013-07-25 17:17:32 -04:00
|
|
|
${1:name}[${2:rows}, ${0:cols}]
|
2012-08-10 10:44:45 -04:00
|
|
|
snippet c
|
2013-07-25 17:17:32 -04:00
|
|
|
c(${0:items})
|
2012-08-10 10:44:45 -04:00
|
|
|
snippet li
|
2013-07-25 17:17:32 -04:00
|
|
|
list(${0:items})
|
2012-08-10 10:44:45 -04:00
|
|
|
snippet mat
|
2014-03-21 09:21:33 -04:00
|
|
|
matrix(${1:data}, nrow = ${2:rows}, ncol = ${0:cols})
|
2012-08-10 10:44:45 -04:00
|
|
|
|
|
|
|
# apply functions
|
|
|
|
snippet apply
|
2013-07-25 17:17:32 -04:00
|
|
|
apply(${1:array}, ${2:margin}, ${0:function})
|
2012-08-10 10:44:45 -04:00
|
|
|
snippet lapply
|
2013-07-25 17:17:32 -04:00
|
|
|
lapply(${1:list}, ${0:function})
|
2012-08-10 10:44:45 -04:00
|
|
|
snippet sapply
|
2013-07-25 17:17:32 -04:00
|
|
|
lapply(${1:list}, ${0:function})
|
2012-08-10 10:44:45 -04:00
|
|
|
snippet vapply
|
2013-07-25 17:17:32 -04:00
|
|
|
vapply(${1:list}, ${2:function}, ${0:type})
|
2012-08-10 10:44:45 -04:00
|
|
|
snippet mapply
|
2013-07-25 17:17:32 -04:00
|
|
|
mapply(${1:function}, ${0:...})
|
2012-08-10 10:44:45 -04:00
|
|
|
snippet tapply
|
2013-07-25 17:17:32 -04:00
|
|
|
tapply(${1:vector}, ${2:index}, ${0:function})
|
2012-08-10 10:44:45 -04:00
|
|
|
snippet rapply
|
2013-07-25 17:17:32 -04:00
|
|
|
rapply(${1:list}, ${0:function})
|
2012-08-10 10:44:45 -04:00
|
|
|
|
|
|
|
# plyr functions
|
|
|
|
snippet dd
|
2013-07-25 17:17:32 -04:00
|
|
|
ddply(${1:frame}, ${2:variables}, ${0:function})
|
2012-08-10 10:44:45 -04:00
|
|
|
snippet dl
|
2013-07-25 17:17:32 -04:00
|
|
|
dlply(${1:frame}, ${2:variables}, ${0:function})
|
2012-08-10 10:44:45 -04:00
|
|
|
snippet da
|
2013-07-25 17:17:32 -04:00
|
|
|
daply(${1:frame}, ${2:variables}, ${0:function})
|
2012-08-10 10:44:45 -04:00
|
|
|
snippet d_
|
2013-07-25 17:17:32 -04:00
|
|
|
d_ply(${1:frame}, ${2:variables}, ${0:function})
|
2012-08-10 10:44:45 -04:00
|
|
|
|
|
|
|
snippet ad
|
2013-07-25 17:17:32 -04:00
|
|
|
adply(${1:array}, ${2:margin}, ${0:function})
|
2012-08-10 10:44:45 -04:00
|
|
|
snippet al
|
2013-07-25 17:17:32 -04:00
|
|
|
alply(${1:array}, ${2:margin}, ${0:function})
|
2012-08-10 10:44:45 -04:00
|
|
|
snippet aa
|
2013-07-25 17:17:32 -04:00
|
|
|
aaply(${1:array}, ${2:margin}, ${0:function})
|
2012-08-10 10:44:45 -04:00
|
|
|
snippet a_
|
2013-07-25 17:17:32 -04:00
|
|
|
a_ply(${1:array}, ${2:margin}, ${0:function})
|
2012-08-10 10:44:45 -04:00
|
|
|
|
|
|
|
snippet ld
|
2013-07-25 17:17:32 -04:00
|
|
|
ldply(${1:list}, ${0:function})
|
2012-08-10 10:44:45 -04:00
|
|
|
snippet ll
|
2013-07-25 17:17:32 -04:00
|
|
|
llply(${1:list}, ${0:function})
|
2012-08-10 10:44:45 -04:00
|
|
|
snippet la
|
2013-07-25 17:17:32 -04:00
|
|
|
laply(${1:list}, ${0:function})
|
2012-08-10 10:44:45 -04:00
|
|
|
snippet l_
|
2013-07-25 17:17:32 -04:00
|
|
|
l_ply(${1:list}, ${0:function})
|
2012-08-10 10:44:45 -04:00
|
|
|
|
|
|
|
snippet md
|
2013-07-25 17:17:32 -04:00
|
|
|
mdply(${1:matrix}, ${0:function})
|
2012-08-10 10:44:45 -04:00
|
|
|
snippet ml
|
2013-07-25 17:17:32 -04:00
|
|
|
mlply(${1:matrix}, ${0:function})
|
2012-08-10 10:44:45 -04:00
|
|
|
snippet ma
|
2013-07-25 17:17:32 -04:00
|
|
|
maply(${1:matrix}, ${0:function})
|
2012-08-10 10:44:45 -04:00
|
|
|
snippet m_
|
2013-07-25 17:17:32 -04:00
|
|
|
m_ply(${1:matrix}, ${0:function})
|
2012-12-21 20:04:19 -05:00
|
|
|
|
|
|
|
# plot functions
|
|
|
|
snippet pl
|
2013-07-25 17:17:32 -04:00
|
|
|
plot(${1:x}, ${0:y})
|
2012-12-21 20:04:19 -05:00
|
|
|
snippet ggp
|
2013-07-25 17:17:32 -04:00
|
|
|
ggplot(${1:data}, aes(${0:aesthetics}))
|
2012-12-21 20:04:19 -05:00
|
|
|
snippet img
|
2014-03-21 09:21:33 -04:00
|
|
|
${1:(jpeg,bmp,png,tiff)}(filename = '${2:filename}', width = ${3}, height = ${4}, unit = '${5}')
|
2013-07-25 17:17:32 -04:00
|
|
|
${0:plot}
|
2012-12-21 20:04:19 -05:00
|
|
|
dev.off()
|
|
|
|
|
|
|
|
# statistical test functions
|
|
|
|
snippet fis
|
2013-07-25 17:17:32 -04:00
|
|
|
fisher.test(${1:x}, ${0:y})
|
2012-12-21 20:04:19 -05:00
|
|
|
snippet chi
|
2013-07-25 17:17:32 -04:00
|
|
|
chisq.test(${1:x}, ${0:y})
|
2012-12-21 20:04:19 -05:00
|
|
|
snippet tt
|
2013-07-25 17:17:32 -04:00
|
|
|
t.test(${1:x}, ${0:y})
|
2012-12-21 20:04:19 -05:00
|
|
|
snippet wil
|
2013-07-25 17:17:32 -04:00
|
|
|
wilcox.test(${1:x}, ${0:y})
|
2012-12-21 20:04:19 -05:00
|
|
|
snippet cor
|
2013-07-25 17:17:32 -04:00
|
|
|
cor.test(${1:x}, ${0:y})
|
2012-12-21 20:04:19 -05:00
|
|
|
snippet fte
|
2013-07-25 17:17:32 -04:00
|
|
|
var.test(${1:x}, ${0:y})
|
2013-06-20 17:39:31 -04:00
|
|
|
snippet kvt
|
2013-07-25 17:17:32 -04:00
|
|
|
kv.test(${1:x}, ${0:y})
|