2014-03-30 12:39:03 -04:00
|
|
|
priority -50
|
|
|
|
|
|
|
|
snippet #! "Hashbang for Rscript (#!)" b
|
2014-03-29 17:46:23 -04:00
|
|
|
#!/usr/bin/env Rscript
|
|
|
|
endsnippet
|
|
|
|
|
2014-03-31 22:11:47 -04:00
|
|
|
snippet lib "Import a library"
|
2014-03-29 17:46:23 -04:00
|
|
|
library(${0:package})
|
|
|
|
endsnippet
|
|
|
|
|
2014-03-31 22:11:47 -04:00
|
|
|
snippet req "Require a file"
|
2014-03-29 17:46:23 -04:00
|
|
|
require(${0:package})
|
|
|
|
endsnippet
|
|
|
|
|
2014-03-31 22:11:47 -04:00
|
|
|
snippet source "Source a file"
|
2014-03-29 17:46:23 -04:00
|
|
|
source('${0:file}')
|
|
|
|
endsnippet
|
|
|
|
|
2014-03-31 22:11:47 -04:00
|
|
|
snippet if "If statement"
|
2014-03-30 12:39:03 -04:00
|
|
|
if (${1}) {
|
2014-03-29 17:46:23 -04:00
|
|
|
${0}
|
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2014-03-31 22:11:47 -04:00
|
|
|
snippet eif "Else-If statement"
|
2014-03-30 12:39:03 -04:00
|
|
|
else if (${1}) {
|
|
|
|
${0}
|
|
|
|
}
|
|
|
|
|
2014-03-31 22:11:47 -04:00
|
|
|
snippet el "Else statement"
|
2014-03-29 17:46:23 -04:00
|
|
|
else {
|
|
|
|
${0}
|
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2014-03-31 22:11:47 -04:00
|
|
|
snippet ife "if .. else"
|
2014-03-30 12:39:03 -04:00
|
|
|
if (${1}) {
|
|
|
|
${2}
|
|
|
|
} else {
|
|
|
|
${3}
|
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2014-03-31 22:11:47 -04:00
|
|
|
snippet wh "while loop"
|
2014-03-30 12:39:03 -04:00
|
|
|
while(${1}) {
|
|
|
|
${2}
|
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2014-03-31 22:11:47 -04:00
|
|
|
snippet for "for loop"
|
2014-04-24 21:14:31 -04:00
|
|
|
for (${1:item} in ${2:list}) {
|
2014-03-30 12:39:03 -04:00
|
|
|
${3}
|
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2014-03-31 22:11:47 -04:00
|
|
|
snippet fun "Function definition"
|
2014-03-30 12:39:03 -04:00
|
|
|
${1:name} <- function (${2}) {
|
2014-03-29 17:46:23 -04:00
|
|
|
${0}
|
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2014-03-31 22:11:47 -04:00
|
|
|
snippet ret "Return call"
|
2014-03-29 17:46:23 -04:00
|
|
|
return(${0})
|
|
|
|
endsnippet
|
|
|
|
|
2014-03-31 22:11:47 -04:00
|
|
|
snippet df "Data frame"
|
2014-03-29 17:46:23 -04:00
|
|
|
${1:name}[${2:rows}, ${0:cols}]
|
|
|
|
endsnippet
|
|
|
|
|
2014-03-31 22:11:47 -04:00
|
|
|
snippet c "c function"
|
2014-03-29 17:46:23 -04:00
|
|
|
c(${0:items})
|
|
|
|
endsnippet
|
|
|
|
|
2014-03-31 22:11:47 -04:00
|
|
|
snippet li "list function"
|
2014-03-29 17:46:23 -04:00
|
|
|
list(${0:items})
|
|
|
|
endsnippet
|
|
|
|
|
2014-03-31 22:11:47 -04:00
|
|
|
snippet mat "matrix function"
|
2014-03-30 02:04:00 -04:00
|
|
|
matrix(${1:data}, nrow = ${2:rows}, ncol = ${0:cols})
|
2014-03-29 17:46:23 -04:00
|
|
|
endsnippet
|
|
|
|
|
2014-03-30 12:39:03 -04:00
|
|
|
snippet apply "apply function"
|
2014-03-29 17:46:23 -04:00
|
|
|
apply(${1:array}, ${2:margin}, ${0:function})
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet lapply "lapply function"
|
|
|
|
lapply(${1:list}, ${0:function})
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet sapply "sapply function"
|
|
|
|
lapply(${1:list}, ${0:function})
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet vapply "vapply function"
|
|
|
|
vapply(${1:list}, ${2:function}, ${0:type})
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet mapply "mapply function"
|
|
|
|
mapply(${1:function}, ${0:...})
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet tapply "tapply function"
|
|
|
|
tapply(${1:vector}, ${2:index}, ${0:function})
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet rapply "rapply function"
|
2014-03-30 02:04:00 -04:00
|
|
|
rapply(${1:list}, ${0:function})
|
2014-04-01 00:59:21 -04:00
|
|
|
endsnippet
|
2014-03-29 17:46:23 -04:00
|
|
|
|
2014-03-31 22:11:47 -04:00
|
|
|
snippet pl "Plot function"
|
2014-03-29 17:46:23 -04:00
|
|
|
plot(${1:x}, ${0:y})
|
|
|
|
endsnippet
|
|
|
|
|
2014-03-31 22:11:47 -04:00
|
|
|
snippet ggp "ggplot2 plot"
|
2014-03-29 17:46:23 -04:00
|
|
|
ggplot(${1:data}, aes(${0:aesthetics}))
|
|
|
|
endsnippet
|
|
|
|
|
2014-03-31 22:11:47 -04:00
|
|
|
snippet fis "Fisher test"
|
2014-03-29 17:46:23 -04:00
|
|
|
fisher.test(${1:x}, ${0:y})
|
|
|
|
endsnippet
|
|
|
|
|
2014-03-31 22:11:47 -04:00
|
|
|
snippet chi "Chi Squared test"
|
2014-03-29 17:46:23 -04:00
|
|
|
chisq.test(${1:x}, ${0:y})
|
|
|
|
endsnippet
|
|
|
|
|
2014-03-31 22:11:47 -04:00
|
|
|
snippet tt "t-test"
|
2014-03-29 17:46:23 -04:00
|
|
|
t.test(${1:x}, ${0:y})
|
|
|
|
endsnippet
|
|
|
|
|
2014-03-31 22:11:47 -04:00
|
|
|
snippet wil "Wilcox test"
|
2014-03-29 17:46:23 -04:00
|
|
|
wilcox.test(${1:x}, ${0:y})
|
|
|
|
endsnippet
|
|
|
|
|
2014-03-31 22:11:47 -04:00
|
|
|
snippet cor "Correlation test"
|
2014-03-29 17:46:23 -04:00
|
|
|
cor.test(${1:x}, ${0:y})
|
|
|
|
endsnippet
|
|
|
|
|
2014-03-31 22:11:47 -04:00
|
|
|
snippet fte "FTE test"
|
2014-03-29 17:46:23 -04:00
|
|
|
var.test(${1:x}, ${0:y})
|
|
|
|
endsnippet
|
|
|
|
|
2014-03-31 22:11:47 -04:00
|
|
|
snippet kvt "KV test"
|
2014-03-29 17:46:23 -04:00
|
|
|
kv.test(${1:x}, ${0:y})
|
|
|
|
endsnippet
|