cgApply | R Documentation |
These functions are apply-type functions for ContactGroup objects.
cgApply(cg, FUN, mc.cores=1, ...)
cgBandApply(cg, FUN, nbands=NULL, mc.cores=1, bstart=2, ...)
cg |
A ContactGroup object. |
FUN |
A function to be applied. For |
mc.cores |
The number of cores to be used. Defaults to 1 |
bstart |
The first band to apply a function to. Defaults to 2.
Only applicable to |
nbands |
The last band to apply a function to. Default is
|
... |
Passed to |
These methods make it easy to apply functions to either all contact
matrices or a set of bands in all contact matrices. Both methods
accept a function FUN
. For cgApply
, the first argument
should be cg
, the contact group itself. For
cgBandApply
, the first argument should also be cg
, and
the second argument should be a specific band number. Additionally,
the bands to be iterated are specified through bstart:nbands
: bstart
indicates the starting band, and nbands
indicates the
last band.
For cgApply
, a ContactGroup object. For cgBandApply
, a
list whose elements are the returned value of FUN
.
ContactGroup
,
getBandMatrix
,
band
data(cgEx)
cgEx.1 <- cgApply(cgEx, FUN=function(xx){ xx + 1 })
band.matrix.list <- cgBandApply(cgEx, FUN=getBandMatrix, bstart=2, nbands=5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.