[Bioc-devel] A quick questions on writing R functions
Li, Dongmei
Dongmei_Li at URMC.Rochester.edu
Fri Feb 20 15:10:43 CET 2015
Hi,
I'm developing an R package and got the following suggestions for revising the functions:
"When a function returns a named list, a good practise is to start the
\value section with the following:
A named list with the following components:
and then to itemize the components"
This is an example of my current function:
eval<-
function (ord_vec_t, ord_vec_pvalue, eval_matrix_t, eval_matrix_pvalue, repetition)
{
rowsdim <- length(ord_vec_t)
p_pvalue <- rep(NA, rowsdim)
p_tstat <- rep(NA, rowsdim)
for (g in 1:rowsdim) {
p_pvalue[g] <- sum(eval_matrix_pvalue[g, ] <= ord_vec_pvalue[g])/repetition
p_tstat[g] <- sum(abs(eval_matrix_t[g, ]) >= abs(ord_vec_t[g]))/repetition
}
mylist <- list(p_pvalue = p_pvalue, p_tstat = p_tstat)
return(mylist)
}
Anyone could offer some suggestions on revising the function based on the comments? Thanks so much for all your help!
Best,
Dongmei
More information about the Bioc-devel
mailing list