% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/0_CellIndices.R
\name{cellIndices}
\alias{cellIndices}
\title{Assign Observations to Tessellation Cells}
\usage{
cellIndices(x, tess, dim, metric = "E", members)
}
\arguments{
\item{x}{A numeric matrix of covariates where each row is an observation.}

\item{tess}{A numeric matrix representing the tessellation centres, where each
row is a unique centre.}

\item{dim}{An integer vector specifying the column indices of \code{x} to be used
for calculating distance.}

\item{metric}{Either "Euclidean" or "Spherical".}

\item{members}{A vector indicating covariate membership.}
}
\value{
A numeric vector of integers where each element corresponds to a row
in \code{x} and its value is the row index of the nearest centre in \code{tess}.
}
\description{
For a given tessellation, this function identifies which cell
(centre) each observation belongs to based on nearest neighbour classification.
}
\details{
It finds the closest tessellation centre for each observation (row) in
the covariate matrix, considering only the specified dimensions. This is
achieved using the k-nearest neighbour algorithm where k=1.
}
