Dear R People:
I need to construct a matrix of the order (pn-1) x (pn-1).
The elements can be constructed as
z[i,j] = pn - max(i,j)
for (i,j) in 1:(pn - 1)
I was messing with a toy example in which n=4, p=3 and tried to use
outer:>x <- 1:11
>y <- 1:11
>outer(x,y,function(x,y)12-max(x,y))
Error in outer(x, y, function(x, y) 12 - max(x, y)) :
dim<- : dims [product 121] do not match the length of object
[1]>
Is there a better way to do this, please? I would like to avoid loops if
possible.
Thanks in advance.
Sincerely,
Laura Holt
mailto: lauraholt_983 at hotmail.com
R version 1.9.1 windows