% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pep_import.R
\name{pep_import}
\alias{pep_import}
\title{Import and preprocess PEP725 phenological data}
\usage{
pep_import(path = "data/Data_PEP725_all", flags = FALSE, add_country = TRUE)
}
\arguments{
\item{path}{path to the folder containing PEP725 CSV files (default is \code{"data/Data_PEP725_all/"}).}

\item{flags}{Logical indicating whether the pep data contains quality control flags (default is \code{FALSE}).}

\item{add_country}{Logical indicating whether to add country information based on station coordinates (default is \code{TRUE}).}
}
\value{
A \code{\link[=new_pep]{pep}} object (extends \code{data.table}) containing the combined and preprocessed PEP725 data.
}
\description{
This function imports all CSV files from the specified folder,
reads them efficiently using \pkg{data.table}, and combines them into a single
data table. It performs several preprocessing steps, including:
\itemize{
\item Converting selected columns to factors (\code{provider_id}, \code{s_id}, \code{gss_id}, \code{genus}, \code{species}, \code{subspecies}).
\item Replacing missing altitude values coded as \code{-9999} with \code{NA}.
\item Creating a combined altitude variable \code{alt2} using \code{alt} and \code{alt_dem}.
\item Converting the \code{date} column to \code{Date} class.
\item Recoding cultivation season (\code{cult_season}) and quality control flags (\code{qc_ori_flag}) into labeled factors.
\item Removing unused or problematic columns (\code{affected_flag}, \code{qc_flag}).
}
}
\details{
This function is intended for importing raw PEP725 station data into a standardized
format suitable for further phenological analysis, such as sensitivity and trend estimation.
}
\examples{
# Small example files shipped with the package
path <- system.file("extdata", package = "pep725")
pep_data <- pep_import(path = path, add_country = FALSE)
print(pep_data)
}
\seealso{
\code{\link[data.table]{fread}}, \code{\link[data.table]{rbindlist}}
}
\author{
Matthias Templ (FHNW)
}
