% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/generate_record_key.R
\name{generate_record_key_from_ons_id}
\alias{generate_record_key_from_ons_id}
\title{Generate Record Key from ONS ID}
\usage{
generate_record_key_from_ons_id(data, record_key_col)
}
\arguments{
\item{data}{A \code{data.table} containing the \code{ons_id} column.}

\item{record_key_col}{A character string specifying the name of the new
record key column to create.}
}
\value{
A \code{data.table} with the new record key column added.
}
\description{
This function creates a new record key column by taking the modulo 4096 of
the \code{ons_id} column. It converts \code{ons_id} to numeric, preserving \code{NA} for
non-numeric values, and assigns the result as an integer.
}
\details{
\itemize{
\item The function checks that \code{data} is a \code{data.table}.
\item Non-numeric values in \code{ons_id} are converted to \code{NA}.
\item The record key is computed as \code{ons_id \%\% 4096} and stored as integer.
}
}
