

Hi,

I apply "optim" a given input-matrix "imat" by row in the following way:

apply(imat, 1, function(x) try(optim(0.1, gf, method="BFGS", y=x)$par,
silent=1))

where gr<-function(x,y) is defined upstream.

Now, for several rows I get an error message from the "optim", so the
output matrix get the error message as a string and turns into a matrix of
strings. Instead, I want NA in the output matrix each time an error in
"optim" occurs. I thought try() would handle this? What's the best way of
doing this?

Thanks,
Serguei Kaniovski
	[[alternative HTML version deleted]]

