[R] outer

Peter Dalgaard p.dalgaard at biostat.ku.dk
Thu Apr 29 09:10:40 CEST 2004


K Fung <fungile at yahoo.com> writes:

> > outer(m,n,cord.mag)
> 
> this gives me a matrix of zeroes
> 
> > outer(1,2,cord.mag)
> 
> this gives the right value on the other hand

Your cord.mag function probably doesn't vectorize. Try

Cord.mag <- function(m,n) mapply(cord.mag, m, n)
outer(m, n, Cord.mag)

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list