[R] solution to outer question

Laura Holt lauraholt_983 at hotmail.com
Mon Aug 30 22:44:29 CEST 2004


Hi again!

"pmax" works instead of max.

>outer(x,y,function(x,y)12 - pmax(x,y))
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11]
[1,]   11   10    9    8    7    6    5    4    3     2     1
[2,]   10   10    9    8    7    6    5    4    3     2     1
[3,]    9    9    9    8    7    6    5    4    3     2     1
[4,]    8    8    8    8    7    6    5    4    3     2     1
[5,]    7    7    7    7    7    6    5    4    3     2     1
[6,]    6    6    6    6    6    6    5    4    3     2     1
[7,]    5    5    5    5    5    5    5    4    3     2     1
[8,]    4    4    4    4    4    4    4    4    3     2     1
[9,]    3    3    3    3    3    3    3    3    3     2     1
[10,]    2    2    2    2    2    2    2    2    2     2     1
[11,]    1    1    1    1    1    1    1    1    1     1     1
>

All is well.

Sorry for the trouble.

Sincerely,
Laura H
mailto: lauraholt_983 at hotmail.com




More information about the R-help mailing list