% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/flux_match.R
\name{flux_match}
\alias{flux_match}
\title{Matching continuously measured fluxes with measurement IDs and meta data}
\usage{
flux_match(
  raw_conc,
  field_record,
  datetime_col,
  start_col,
  conc_col,
  startcrop,
  measurement_length,
  ratio_threshold = 0.5,
  time_diff = 0
)
}
\arguments{
\item{raw_conc}{dataframe of CO2 concentration measured continuously.
Has to contain at least a datetime column in ymd_hms format and
a gas concentration column as double.}

\item{field_record}{dataframe recording which measurement happened when.
Has to contain at least a column containing the start of each measurement,
and any other column identifying the measurements.}

\item{datetime_col}{datetime column in raw_conc (dmy_hms format)}

\item{start_col}{start column in field_record (dmy_hms format)}

\item{conc_col}{concentration column in raw_conc}

\item{startcrop}{how many seconds should be discarded at the beginning of
the measurement}

\item{measurement_length}{length of the measurement (in seconds)
from the start specified in the field_record}

\item{ratio_threshold}{ratio (number of concentration measurement compared to
length of measurement in seconds) below which the data should be flagged as
too little}

\item{time_diff}{time difference (in seconds) between the two datasets.
Will be added to the datetime column of the raw_conc dataset.
For situations where the time was not synchronized correctly.}
}
\value{
a dataframe with concentration measurements, corresponding datetime,
flux ID (\code{f_fluxid}), measurements start (\code{f_start}) and end (\code{f_end}),
flags in case of no data or low number of data (\code{f_flag_match}),
the number of datapoints per measurement (\code{f_n_conc}),
the ratio of number of datapoints over the length of each measurement
in seconds (\code{f_ratio}), and any variables present in one of the inputs.
}
\description{
Matching a dataframe of continuously measured
gas concentration data with measurement metadata from another dataframe.
Measurements are paired with their metadata based on datetime.
Extra variables in both dataframes are kept in the output.
}
\examples{
data(co2_df_short, record_short)
flux_match(co2_df_short, record_short, datetime, start, conc, startcrop = 10,
measurement_length = 180)
}
