Re: [R] try/tryCatch

2013-03-19 Thread jim holtman
I would assume that if the code were as follows that the error could the caught and the loop continued: metatrials<-function(mydata){ a<-matrix(data=NA, nrow=dim(mydata)[3], ncol=5) colnames(a)=c("sens", "spec", "corr", "sens_se", "spec_se") for(ii in 1:dim(mydata)[3]){ tmp<-mydata[,,ii]

Re: [R] try/tryCatch

2013-03-18 Thread lisa
here is the error: > aa<-metatrialstry(beta_5_50) Error in asMethod(object) : matrix is not symmetric [1,2] metatrials, the function that i am attempting to convert with try/tryCatch, gives me back a matrix with as many rows are there are simulations (z) in the aray with dim(x,y,z). with the

Re: [R] try/tryCatch

2013-03-18 Thread jim holtman
It would help if you told us what type of error you are getting and to also provide sample data so that we could run it to see what happens. I use 'try' a lot to catch errors and have not had any problems with it. On Mon, Mar 18, 2013 at 6:11 AM, lisa wrote: > Hi All, > > I have tried every fix

Re: [R] try / tryCatch for download.file( ) within a for loop when URL does not exist

2007-10-16 Thread Vishal Belsare
Jim, Thanks. Actually I just got it working a few minutes ago with: tryCatch({download.file(url, destfile = file, quiet = FALSE, mode = "wb")}, silent = FALSE, condition = function(err) { } ) but I like your suggestion better. I'll attempt to log the list of url's downloaded ok and those which e

Re: [R] try / tryCatch for download.file( ) within a for loop when URL does not exist

2007-10-16 Thread jim holtman
I think this is closer to what you want. You can determine what you want to do; this one just goes to the next iteration: date <- as.POSIXlt(as.Date("2007-10-15", "%Y-%m-%d")) for (i in 1:difftime(as.POSIXlt(as.Date("2007-10-15", "%Y-%m-%d")),"2007-10-01")) { if (date$wday != 0 & da