Description Usage Arguments Details Author(s) See Also Examples
Computes cumulative sums for each set of consecutively identical group levels.
1 | cumSumGroup(x, group)
|
x |
Vector with doubles that should be cumulatively summed. |
group |
Vector with integers that identify group levels. |
Assumes that all entries, affiliated to a particular group level, are consecutive.
Kjetil Røysland <kjetil.roysland@medisin.uio.no>
1 2 3 4 5 6 7 8 9 10 11 12 13 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (x, group)
{
if (length(x) != length(group))
stop("Length of x and group differs")
r <- .C("cumSumGroup", w = as.double(x), as.integer(length(x)),
as.integer(group))
return(r$w)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.