[R] try to silence errors

2011-12-22 Thread statfan
I am trying to use the dmt function in the package {mnormt}. Throughout my algorithm, the covariance matrix is sometime calculated to be singular. When attempting to calculate the dmt function with a covariance that is not positive definite, I would like it to return Inf or NaN instead of an

Re: [R] try to silence errors

2011-12-22 Thread MacQueen, Don
Something like the following may be what you are looking for. try.out - try(dmt(y[,j],new$mu[,,4],sigij,ceiling(new$nu[4])),silent=TRUE) if (class(try.out) == 'try-error'} ) { out - NaN } else { out - try.out } -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave.,