% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils_wrangling.R
\name{save_wrangled_output}
\alias{save_wrangled_output}
\title{Save the output to disk after ensuring column specs}
\usage{
save_wrangled_output(
  df,
  path,
  data_type = c("wrangled_data", "projected_data", "final_data"),
  na_rm = FALSE,
  compression = "gzip"
)
}
\arguments{
\item{df}{data frame the output}

\item{path}{the path where the output should be saved}

\item{data_type}{(string): the type of data
\itemize{
\item \code{wrangled_data} (default): raw data that has been wrangled into a suitable
form for analysis.
\item \code{projected_data}:  data that has been fully projected to the target year but
has not yet been transformed or calculated upon.
\item \code{final_data}: the complete set of billions data with transformed values,
contributions, and all calculations available.
}}

\item{na_rm}{(logical) Specifies whether to remove rows where \code{value} is missing.
Defaults to \code{FALSE}.}

\item{compression}{Compression algorithm to use for parquet format. \code{"gzip"} by
default}
}
\value{
A data frame. Note that this is the modified version of in the input
the function (such as from removing empty rows when \code{na_rm = TRUE}) are carried
over to the output.
}
\description{
Helper functions that saves a wrangled output data frame to the disk if it has
the correct columns as required by the Triple Billions xMart tables.
}
\details{
The function returns a data frame (like \code{readr::write_csv()}) in order to allow
it to work with pipes better.
}
\seealso{
Wrangle data functions
\code{\link{add_missing_xmart_rows}()},
\code{\link{get_data_lake_name}()},
\code{\link{get_whdh_path}()},
\code{\link{has_xmart_cols}()},
\code{\link{save_gho_backup_to_whdh}()},
\code{\link{wrangle_gho_data}()},
\code{\link{wrangle_gho_rural_urban_data}()},
\code{\link{wrangle_unsd_data}()},
\code{\link{xmart_col_types}()},
\code{\link{xmart_cols}()}
}
\concept{whdh}
