Description Usage Arguments Value Author(s) Examples
An iterator applying a user-defined function to an object of 'databel-class'.
1 2 |
... |
arguments passed to the |
dfodata |
'databel' object which is iterated over |
anFUN |
user-defined analysis function |
MAR |
which margin to iterate over (default = 2, usually these are 'columns' used to store SNP data) |
procFUN |
function to process the output and present that as a fixed-number-of-columns matrix or fixed-length vector. Can be missing if standard functions listed below are used. Pre-defined processors included are "process_lm_output" (can process functions "lm", "glm", "coxph") and "process_simple_output" (process output from "sum", "prod", "sum_not_NA" [no. non-missing obs], "sum_NA" [no. missing obs.]) |
outclass |
output to ("matrix" or "databel") |
outfile |
if output class is "databel", the generated object
is bound to the |
type |
if output class is "databel", what data type to use for storage |
transpose |
whether to transpose the output |
A matrix (or 'databel'-matrix) containing results of applying the function
Yurii Aulchenko
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | a <- matrix(rnorm(50), 10, 5)
rownames(a) <- paste("id", 1:10, sep="")
colnames(a) <- paste("snp", 1:5, sep="")
b <- as(a, "databel")
apply(a, FUN="sum", MAR=2)
apply2dfo(SNP, dfodata=b, anFUN="sum")
tA <- apply2dfo(SNP, dfodata=b, anFUN="sum",
outclass="databel", outfile="tmpA")
tA
as(tA, "matrix")
apply2dfo(SNP, dfodata=b, anFUN="sum", transpose=FALSE)
tB <- apply2dfo(SNP, dfodata=b, anFUN="sum", transpose=FALSE,
outclass="databel", outfile="tmpB")
tB
as(tB, "matrix")
sex <- 1*(runif(10)>.5)
trait <- rnorm(10) + sex + as(b[, 2], "vector") +
as(b[, 2], "vector") * sex * 5
apply2dfo(trait~SNP*sex, dfodata=b, anFUN="lm")
tC <- apply2dfo(trait ~ SNP * sex, dfodata=b, anFUN="lm",
outclass="databel", outfile="tmpC")
tC
as(tC, "matrix")
apply2dfo(trait ~ SNP * sex, dfodata=b, anFUN="lm", transpose=FALSE)
tD <- apply2dfo(trait ~ SNP * sex, dfodata=b, anFUN="lm",
transpose=FALSE, outclass="databel", outfile="tmpD")
tD
as(tD, "matrix")
rm(tA, tB, tC, tD)
gc()
unlink("tmp*")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.