Learn R Programming

efreadr (version 0.2.2)

read_ef_files: Load all European Fluxes CSV files in one or more directories, bind all observations in a list of dataframes

Description

European fluxes CSV files are distributed as one or more zip-compressed files from http://gaia.agraria.unitus.it . Once unzipped, all CSV files are to be found in uniquely identifed directories.

Usage

read_ef_files(dirs = getwd(), only_level = NULL, only_aggr = NULL, ...)

Arguments

dirs
a vector of directories where fluxes files are looked for. Defaults to current directory.
only_level
levels of fluxes files (defaults to NULL). Allowed levels are (currently) 3 and 4. When NULL, either L3 and L4 files are looked for.
only_aggr
aggregations of data (defaults to NULL). Allowed aggregations are (currently) "h" (half-hourly) and "d" (daily). When NULL, either "d" and "h" files are looked for.
...
additional arguments to be passed to read_ef_file, specifically fill_value

Value

a data frame of 3 variables: level, aggr, and fluxes. fluxes is a dataframe that binds the rows of all fluxes files imported for each level/aggregation combination found. Additional columns to fluxes include metadata parsed from the file names: For levels 3 and 4: project, level, aggr, country_id, site_id, year, version, pathname, dirname For level 2: project, level, type, country_id, site_id, year, version, time_res, pathname, dirname

Details

All CSV files in that or those directories will be loaded and returned as a single row-wise bound data frame. The function assumes the file name regular expression pattern is like ^[A-Z]{4}_EC_Ln_a_[A-Z]{2}[a-ZA-Z]{3}_20[0-9]{2}_v[0-9]{2}\.txt$ where n is level [1-4] and a is aggregation period [hdwm] (optionally given as function arguments)

Examples

Run this code
dir_name <- system.file(package = "efreadr", "examples")
read_ef_files(dir_name)

Run the code above in your browser using DataLab