[R] How to write an error to output

2013-10-16 Thread Katherine Gobin
Dear R forum, The example below is just an indicative one and I have constructed it. My real life data and conditions are different. I have a data.frame as given below mydat = data.frame(A = c(19, 20, 19, 19, 19, 18, 16, 18, 19, 20), B = c(19, 20, 20, 19, 20, 18, 19, 18, 17, 16)) if

Re: [R] How to write an error to output

2013-10-16 Thread jim holtman
Will this work for you: mydat = data.frame(A = c(19, 20, 19, 19, 19, 18, 16, 18, 19, 20), B = c(19, 20, 20, 19, 20, 18, 19, 18, 17, 16)) if (length(mydat$A) 10) { write.csv(data.frame(error = A has length more than 10), 'result.csv', row.names = FALSE) stop(A has length more than 10) }else

Re: [R] How to write an error to output

2013-10-16 Thread Katherine Gobin
Dear sir, Thanks a lot for your wonderful suggestion. Regards Katherine On Wednesday, 16 October 2013 5:28 PM, jim holtman jholt...@gmail.com wrote: Will this work for you: mydat = data.frame(A = c(19, 20, 19, 19, 19, 18, 16, 18, 19, 20), B = c(19, 20, 20, 19, 20, 18, 19, 18, 17, 16))