1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
\name{ScalarObject-class}
\docType{class}
\alias{ScalarObject-class}
\alias{ScalarCharacter-class}
\alias{ScalarLogical-class}
\alias{ScalarInteger-class}
\alias{ScalarNumeric-class}
\alias{mkScalar}
\alias{show,ScalarObject-method}
\alias{show,ScalarCharacter-method}
\title{Utility classes for length one (scalar) objects}
\usage{
mkScalar(obj)
}
\arguments{
\item{obj}{An object of type \code{character}, \code{logical},
\code{integer}, or \code{double}}
}
\description{
These classes represent scalar quantities, such as a string or a
number and are useful because they provide their own validity
checking. The classes \code{ScalarCharacter}, \code{ScalarLogical},
\code{ScalarInteger}, and \code{ScalarNumeric} all extend their
respective base vector types and can be used interchangeably (except
they should always have length one).
The \code{mkScalar} factory function provides a convenient way of
creating \code{Scalar<type>} objects (see the examples section below).
}
\author{Seth Falcon}
\examples{
v <- list(mkScalar("a single string"),
mkScalar(1),
mkScalar(1L),
mkScalar(TRUE))
sapply(v, class)
sapply(v, length)
}
\keyword{classes}
|