Small utility functions
myouter(x, y, fun)
shiftleft(x, k = 1)
shiftright(x, k = 1)
a vector.
a vector.
a non-negative integer.
a function, see `Details'.
for myouter
, a matrix, as described in `Details'
for shiftleft
and shiftright
, a vector
myouter(x,y,fun)
computes the outer product of x
and
y
using the function fun
. The result is a matrix with
\((i,j)\)th element equal to fun(x[i],y[j])
. It is not
required for fun to be able to work with vector arguments. The function
does the computations in R using a simple double loop. So, it is a
convenience function, not a speed improving one.
shiftright(x,k)
rotates the vector x
k
positions
to the right.
shiftleft(x,k)
rotates the vector x
k
positions to
the left.