<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:12pt;font-family:Bitstream Vera Sans">
<p>On Monday 01 January 2007 23:42, SJR wrote:</p>
<p>> I checked it and unfortunately this is not what I need. Basically would it</p>
<p>> work conveniently  if you work with only one vector. But if you investigate</p>
<p>> a buch of data in a  batch any calculation will stop if only one vector is</p>
<p>> not in the given range. Better would be a textual output. Therefore I think</p>
<p>> something for the php file would make more sense. For example:</p>
<p>></p>
<p>> if "option is for test chosen" AND "numeric vector is in range" THEN</p>
<p>> "perform test" ELSE "write 'Data not in Range'"</p>
<p></p>
<p>That might translate into</p>
<p></p>
<p>i <- 0</p>
<p>for (object in objects) {</p>
<p>       i <- i + 1</p>
<p>       if (optionx) {</p>
<p>               if (length (object) < 8) {</p>
<p>                       warning ("Data not in Range")</p>
<p>                       next            # skip object</p>
<p>               }</p>
<p></p>
<p>               results[i] <- do.some.test (object)</p>
<p>       }</p>
<p>}</p>
<p></p>
<p>Note in this example, that</p>
<p>length (object)</p>
<p>will return the length of the object *including* NAs, which may not be, what is needed.</p>
<p></p>
<p>Typically, the test itself will know more exactly what conditions to check for, and it may not be sensible to try to duplicate all those checks. Hence, a different approach might be:</p>
<p></p>
<p>i <- 0</p>
<p>for (object in objects) {</p>
<p>       i <- i + 1</p>
<p>       try ( {         # basically "try ()" means: continue on errors</p>
<p>               results[i] <- do.some.test (object)</p>
<p>       } )</p>
<p>}</p>
<p></p>
<p>or (with more elaborate handling):</p>
<p></p>
<p>errors <- list ()</p>
<p>i <- 0</p>
<p>for (object in objects) {</p>
<p>       i <- i + 1</p>
<p>       tryCatch ( {</p>
<p>               results[i] <- do.some.test (object)</p>
<p>       }, error = function (e) {</p>
<p>               errors[[i]] <- paste (objectname, e$message, sep=": ")</p>
<p>       } )</p>
<p>}</p>
<p></p>
<p># in printout</p>
<p>if (length (errors) >= 1) {</p>
<p>       cat ("Errors were encountered while processing the following objects:\n")</p>
<p>       for (error in errors) {</p>
<p>               cat (error, "\n")</p>
<p>       }</p>
<p>}</p>
<p></p>
<p>Does any of this help?</p>
</body></html>