Files
ROBITools/man/createS3Class.Rd

51 lines
1.2 KiB
R

% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/s3objects.R
\name{createS3Class}
\alias{createS3Class}
\title{create basic functions to manipulate a new S3 class}
\usage{
createS3Class(classname)
}
\arguments{
\item{classname}{a \code{character string} indicating the name
of the new class.}
}
\description{
createS3Class function create in the \code{package:ROBITools}
environment an \code{is.xxx} function and an \code{as.xxx} function
allowing to test if an abject belong the class \code{xxx} and to add
the class \code{xxx} to the class list of an object. \code{xxx} is a
generic class name that is specified through the \code{classname}
argument of the function.
}
\note{
Take care that the new functions are created in the
\code{package:ROBITools} environment.
}
\examples{
# Create a new S3 class named mynewclass
createS3Class('mynewclass')
#create a new vector object
x=c(1,4,6)
# test if it belongs the new class, that is false
is.mynewclass(x)
# Associate x to the new class
as.mynewclass(x)
# test again if x belongs the new class, that is now true
is.mynewclass(x)
}
\seealso{
\code{\link{rmS3Class}}
}
\author{
Eric Coissac
}
\keyword{function}
\keyword{system}