Learn R Programming

efreadr (version 0.2.2)

read_ef_file: Load a CSV file from the European Flux Database

Description

File name is parsed to extract year, site identification and aggregation type. The file name must point to a valid European Fluxes file, in CSV format and must resolve to a valid file format name.

Usage

read_ef_file(file_name, aggregation = NA_character_, year = NA_integer_,
  fill_value = -9999L)

Arguments

file_name
Full path to 1 fluxes file
aggregation
character string, aggregation of the flux file to be imported (default NA_character_). This is important to properly define variable types for each aggregation type. When NA_character_ it is assumed no aggregation (eg L2 files).
year
integer value (default NA_integer). Important to correctly add efreadr_date field
fill_value
a code for a not available (NA) observation in CSV file. All the observations with 'fill_value' values are converted to NAs during import. Default is -9999L.

Value

a data frame as loaded from the file, added with 'pathname' column, and 'efreadr_date' column for half-hourly fluxes files

Details

File name is added as a field in the returned data frame as pathname. The pathname variable may be used to join a dataframe with file metadata such as year, site code, level, aggregation, as reaf_ef_files does.

The fluxes files code not available measures as -9999 (integer variables) or -9999.00 (floating point variables). Default behaviour of read_ef_file is to treat them as NAs. All -9999L, and -9999.0, -9999.00, -9999.000 values are converted to NA during import of files. Occasionally, -9999.00 (floting point representation of NA) appear in variables that are inherently integer (i.e. sqc variables in daily flux file). This forces a type conversion of the entire variable to double.

Examples

Run this code
file_name <- system.file(package = "efreadr", "examples", "CEIP_EC_L4_d_FABar_2015_v02.txt")
read_ef_file(file_name)

Run the code above in your browser using DataLab