% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/to_taxstats.R
\name{ato_to_taxstats}
\alias{ato_to_taxstats}
\title{Remap an ato_tbl to the taxstats microdata column schema}
\usage{
ato_to_taxstats(df, direction = c("to_taxstats", "from_taxstats"))
}
\arguments{
\item{df}{An \code{ato_tbl} or data frame.}

\item{direction}{\code{"to_taxstats"} (default, aggregate -> microdata)
or \code{"from_taxstats"} (microdata -> aggregate).}
}
\value{
A data frame with renamed columns. \code{ato_tbl} class and
provenance attributes preserved.
}
\description{
Takes an \code{ato_tbl} with aggregate column names (produced by any
\verb{ato_*} function) and renames columns to match the \code{taxstats}
(or \code{taxstats2}) 2\% microdata sample schema used by Hugh
Parsonage's DRAT package. Enables consistent variable
definitions when moving between aggregate views and microdata
prototyping.
}
\details{
The bundled schema map (\code{ato_schema_map()}) mirrors the
column names from Parsonage's \code{taxstats} and \code{taxstats2}
packages, which in turn use the ATO Individual Sample File
variable names. Because \code{taxstats} is DRAT-distributed and not
on CRAN, this function imposes the mapping as a static table
rather than programmatically introspecting the \code{taxstats}
namespace. Re-check the bundled map against the \code{taxstats}
NAMESPACE when the ATO publishes a revised Sample File schema.

Unknown columns pass through unchanged. Use
\code{\link{ato_harmonise}} first if the input panel has drift
in source column names.
}
\examples{
df <- data.frame(postcode = "2000", taxable_income = 80000,
                 medicare_levy = 1600)
ato_to_taxstats(df)
}
\references{
Parsonage, H. (2019). \emph{taxstats: 2 per cent Individual
Sample File from the Australian Taxation Office}. R package
(DRAT).
\url{https://github.com/HughParsonage/taxstats}

Parsonage, H. (2024). \emph{grattan: Perform Common Quantitative
Tasks for Australian Analysts}. R package version 2026.1.1.
\url{https://cran.r-project.org/package=grattan}

Australian Taxation Office (2024). \emph{Taxation Statistics:
Individual Sample File documentation}.
}
\seealso{
Other harmonisation: 
\code{\link{ato_crosswalk}()},
\code{\link{ato_deflate}()},
\code{\link{ato_harmonise}()},
\code{\link{ato_per_capita}()},
\code{\link{ato_reconcile}()},
\code{\link{ato_schema_map}()}
}
\concept{harmonisation}
