Re: [R] Checking if a matrix exists/is defined

2014-10-19 Thread Steven Yen
Thank you Rich. It works like a charm! Earlier I worked around by judging its determinant: dd<-NULL if (invH) dd<-det(obj$hessian) if (invH & exists("dd")){ ... } Now I do if (!is.null(obj$hessian) & invH){ ... } which is more direct. Thanks again. Steven At 01:50 AM 10/19/2014, Richard M.

Re: [R] Checking if a matrix exists/is defined

2014-10-18 Thread Johannes Huesing
Steven Yen [Sun, Oct 19, 2014 at 06:17:48AM CEST]: > Hello > Can someone help me with the following, specifically in judging > whether a matrix exists. exists(my.matrix) > I have trouble with the first line below. In > this case, matrix obj$hessian exists and is 74 x 74. I receive the > erro

Re: [R] Checking if a matrix exists/is defined

2014-10-18 Thread Richard M. Heiberger
all() takes a logical argument, not numeric. See ?all I think you are looking for is.null(obj$hessian) If this isn't what you are looking for, please send a reproducible example to the entire list. Rich On Sun, Oct 19, 2014 at 12:17 AM, Steven Yen wrote: > Hello > Can someone help me with the

[R] Checking if a matrix exists/is defined

2014-10-18 Thread Steven Yen
Hello Can someone help me with the following, specifically in judging whether a matrix exists. I have trouble with the first line below. In this case, matrix obj$hessian exists and is 74 x 74. I receive the error message: Warning message: In all(w$hessian) : coercing argument of type 'double' t