Hello,

In my simulation I use the try()-function to catch possible errors when fitting models. I run the simulationon a Linux-server using the command " R CMD BATCH nameOfFile.R &". When executing the code as batch-job I get the problem that the execution is halted without giving an error message. But when I run the code interactivly the error is catched by try() as it would be expected.

The problem is somewhat strange as it only occurs when the code is executed as a batch-job and when the package "Matrix" is loaded.

I wrote a small example reproducing the error. (In my code the error occurs in mgcv:::fixDependence, which looks like the code I'm using below in order to get a small reproducible example. I realized that the code makes no sense...)

######################################
library(Matrix)

R <- matrix(abs(rnorm(25)), 5, 5)
r0 <- r <- nrow(R)

# while-loop produces error that should be catched by the function try()
try(
while (mean(R[r0:r, r0:r]) > 0) r0 <- r0 - 1
)

# so "Hello" should be printed
print("Hello")
######################################

I use R version 2.15.1 (2012-06-22) on a x86_64-pc-linux-gnu (64-bit) platform.

I would be grateful for help.

Best regards,
Sarah Brockhaus

PHD-student
Department of Statistics
University of Munich

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to