Generic Coercion Function

DESCRIPTION:

Coerces an object from one class to another.

USAGE:

as(object, Class, coerce=T)

REQUIRED ARGUMENTS:

object
S-PLUS expression evaluating to an object to be coerced.
Class
character string specifying class object is to be coerced to.

OPTIONAL ARGUMENTS:

coerce
logical flag. If TRUE, a method for the generic coerce() is selected. If FALSE, if an is relation exists for object and class, this will be used. An error results if the coerce method or the is relation fails to exist, in the two cases.

VALUE:

the coerced object, now having the desired class.

DETAILS:

This is the SV4 generic coercion function.

SEE ALSO:

.

EXAMPLES:

as(1:10, "character")