Skip to content
Prev 279475 / 398506 Next

Argument validation within functions

Hi,

thank you... I think I will go for the if-stop approach
as the stop() stops the total function... So there is just
one little other question: What is the opposite of is.numeric?
Is ther isnot.numeric? How  can that be implemented in following
function:

f <- function(a){
	if(is.numeric(a)) stop("a is not numeric")
	if(0 > a && a > 1) stop("a must be a value between 0 and 1")	
	a
}

/Johannes

-------- Original-Nachricht --------
--