This function is used to compute an arbitrary function of every region in a set of vertex files.
vertexApply(filenames, fun, ..., mask = NULL, parallel = NULL, collate = simplify_masked, transpose = FALSE)
filenames | vertex file names |
---|---|
fun | A function to be applied to each vertex |
... | additional arguments to |
mask | A vector of filename indicating a vertex mask ( |
parallel | A two component vector indicating how to parallelize the computation. If the first element is "local" the computation will be run via the parallel package, otherwise it will be computed using batchtools, see pMincApply for details. The element should be numeric indicating the number of jobs to split the computation into. |
collate | A function to reduce the (potentially masked) list of results into a nice structure. Defaults to simplify_masked |
transpose | Whether to alternatively transpose the vertex matrix and apply a function to each subject |
The a matrix with a row of results for each vertex
# NOT RUN { getRMINCTestData() gf = read.csv("/tmp/rminctestdata/CIVET_TEST.csv") gf = civet.getAllFilenames(gf,"ID","TEST","/tmp/rminctestdata/CIVET","TRUE","1.1.12") gf = civet.readAllCivetFiles("/tmp/rminctestdata/AAL.csv",gf) vm <- vertexApply(gf$CIVETFILES$nativeRMStlink20mmleft, mean) # }