Xinxin Yang's avatar
Xinxin Yang committed
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/check_column_names.R
\name{check.column}
\alias{check.column}
\title{Check the variables/column names for calculating the aggregate variables}
\usage{
check.column(importfilepath, jsonfile, rewrite_json = TRUE, extraction_dir)
}
\arguments{
\item{importfilepath}{A fadn.raw.rds or fadn.raw.csv file address.}

\item{jsonfile}{A json file address.}

\item{rewrite_json}{Logical, if TRUE (default), a new json file without unmatched variables will be saved. The string "rewrite" will be added in front of the original file name, and they are separated through "_". For example, the name of original json file is A.json, the new json file will be saved as rewrite_A.json.
Otherwise, do not rewrite json file.}

\item{extraction_dir}{Extraction_dir is the folder for extracting the data.}
}
\value{
A list of multiple objects. The objects are in the json-file, which have the unmatched variables.
}
\description{
The check.column function checks the variables if they exist in a json-file matching the variables
 in the fadn.raw.rds or fadn.raw.csv (csv-file from FADN-AGRI),
returning a list of variables which are not in the raw data file. Then a new json file without unmatched variables can be saved in the extraction_dir.
A txt-file (my_logfile.txt) is created in a specific directory (spool.dir) where stores the output messages.
}
\details{
If variables exist in a json-file and not in the fadn.raw.rds file or fadn csv file, then returning all unmatched variables.
Json file has 6 objects/categries: "id", "info", "costs", "crops", "subsides", "livstock".
}
\examples{
check.column("./fadn.raw.2009.BEL.rds", "./2014_after.json", TRUE, "./OV")
check.column("BEL2009.csv", "2013_before.json", TRUE, "./OV")


}
\author{
Xinxin Yang <xinxin.yang@thuenen.de>
}