Check for a Legitimate Factor Object

DESCRIPTION:

Checks a factor object and returns a message of the problem encountered.

USAGE:

check.factor(x) 

REQUIRED ARGUMENTS:

x
an object that supposedly can be interpreted as a factor.

VALUE:

either NULL if there are no problems, or a character string giving the problem encountered. This is primarily support for various factor methods.

SEE ALSO:

.

EXAMPLES:

# this is how print.factor() uses it 
if(length(xx <- check.factor(x))) 
    stop(paste("cannot be interpreted as a factor:\\n\\t",xx))