ts/man/ts_numeric.Rd
2025-02-24 14:35:02 +13:00

29 lines
734 B
R

% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/types.R
\name{ts_numeric}
\alias{ts_numeric}
\title{Numeric type}
\usage{
ts_numeric(n = -1L)
}
\arguments{
\item{n}{The length of the numeric vector. If \code{n = 1} then a single number is expected. If \code{n = 0} then any length is expected. If \code{n > 1} then a numeric vector of length \code{n} is expected.}
}
\value{
A ts object that accepts numeric scalars or vectors of length \code{n}.
}
\description{
Numbers are represented in Zod schema as either a number (\code{z.number()}),
or a Float64Array (\code{z.instanceof(Float64Array)}).
}
\examples{
x <- ts_numeric(1)
x$check(1)
\dontrun{
# this will fail
x$check(c(1, 2, 3))
x$check("a")
}
}