Skip to content
Prev 9518 / 63424 Next

range checking

I'm tidying up the gld package at the moment, and the following is my best
effort at checking if values are outside the range of the function
(which is [0,1] in this case).  

It seems incredibly messy - is there something better?

outside.range <- !as.logical(((p<1)*(p>0))|(sapply(p,
all.equal,1)=="TRUE")|(sapply(p, all.equal, 0)=="TRUE"))

----
Robert King, Statistics, School of Mathematical & Physical Sciences,
University of Newcastle, Australia
Room V133  ph +61 2 4921 5548
Robert.King@newcastle.edu.au   http://maths.newcastle.edu.au/~rking/

"It's easy to lie with statistics.  It's even easier to lie without them."
	-- Frederick Mosteller