powered by
This method generalizes `base::apply` to dual objects.
# S4 method for dual apply(X, MARGIN, FUN, ..., simplify = TRUE)
The returned value depends on the values returned by `FUN`, similarly to `base::apply`
a dual object (with array or matrix shape)
a vector giving the subscript which the function will be applied over
the function to be applied
extra arguments for `FUN`
a logical indicating whether the results should be simplified
apply
A <- matrix( c(1,2,3,4), 2, 2) x <- dual(A) cs <- apply(x, 2, sum) cs d(cs) # prefered method for summing over the columns colSums(x)
Run the code above in your browser using DataLab