[R] problems with outer

Faheem Mitha faheem at email.unc.edu
Sun May 7 01:37:47 CEST 2000


Dear R people,

I have a mysterious problem I have been tearing my hair over for some
time. I have a function that looks as follows:

covexp <- function(point,pair,theta,a,b)
{ pointnum <- length(pair$lags)
  x <- seq(pointnum)
  y <- x
  tempexpbinsumsq <- function(x,y) {expbinsumsq(point,pair,x,y,a,b,theta)}
  tempmatrix <- outer(x,y,tempexpbinsumsq)
  tempmatrix 
} 

This returns a matrix of dim pointnum times pointnum with
all entries zero. Now, if I try covexp(topo.point,topo.pair,c(1,1,1),2,3)
I get a matrix of all zeros, which cannot be correct. However, if I do
expbinsumsq(topo.point,topo.pair,1,2,2,3,c(1,1,1))  I don't get zero but
some decimal. So at least the (2,3) element of the matrix should have been
non-zero.

Note that my function tempexpbinsumsq merely exists for the purpose of
outer. I could have done 
tempmatrix <-
outer(x,y,function(x,y) expbinsumsq(point,pair,x,y,a,b,theta))
but I don't know if that would be correct usage.

Can someone explain what is going on? I'm at my wits end.

                                 Sincerely, Faheem Mitha.

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list