The magic package implements functionality for manipulating high-dimensional arrays using efficient vectorised methods. The original application was high-dimensional magic hypercubes. This README shows some of the more useful functions in the package.
You can install the released version of magic
from CRAN with:
# install.packages("magic") # uncomment this to install the package
library("magic")
adiag()
binds arbitrarily-dimensioned arrays
corner-to-cornerapad()
pads arbitrarily-dimensioned
arraysapldrop()
is a replacement for APL’s dropaplus()
superimposes two arrays of different
dimensions and returns the sum of overlapping elementsarev()
is a multidimensional generalization of
rev()
arot()
is a generalization of matlab’s
rotdim
fnsd()
returns the first nonsingleton
dimension of an arbitrary dimensioned arrayashift()
shifts the origin of arbitrary
dimensioned arraysMuch of the package functionality is vectorised in array dimension.
For more detail, see the package vignette
vignette("magic")