Reading a Licor LI-6800 Excel log file
read_licor_6800_Excel.Rd
Tool for reading Excel log files created by Licor LI-6800 instruments and
storing their contents in exdf
objects.
Usage
read_licor_6800_Excel(
file_name,
column_name = 'obs',
get_oxygen = TRUE,
check_for_zero = c('A', 'gsw'),
...
)
Arguments
- file_name
A relative or absolute path to an Excel file containing Licor data.
- column_name
A column name that should be present in the log file; used to identify the beginning of the data block in the file.
- get_oxygen
A logical value indicating whether to get the oxygen percentage from the file's preamble using
get_oxygen_from_preamble
.- check_for_zero
The names of columns whose values should not all be zero; see below for details.
- ...
Additional arguments; currently unused.
Details
Licor LI-6800 instruments create two types of log files: a plain-text file and
an Excel file, each containing the same information. In general, the Excel
files are much easier to modify, for example, deleting rows or adding new
columns. For this reason, it is helpful to be able to read these files in R.
Unfortunately, base R does not have any functionality for reading Excel files,
so here the openxlsx
package is used.
read_licor_6800_Excel
looks for a particular data column
(column_name
) in order to identify the start of the data table within
the contents of the Licor file. Rows above the main data table are assumed to
be part of the preamble (or header), which are broken into pairs of rows
representing names and values.
"Calculating" formula values: By default, Licor Excel files do not
"calculate" formula values. This causes a problem when reading them in R,
since any data entry determined from a formula will be read as 0. To fix this
issue for a Licor Excel file, open it in in Excel, go to the Formulas
menu, and choose Calculate Now
. (Alternatively, press F9.) Then save
the file and close it. See these articles for more information about this
issue:
read_licor_6800_Excel
attempts to detect this issue by checking the
values of key columns (specified by the check_for_zero
input argument).
If any of these columns are all 0, then an error message will be sent. This
feature can be disabled by setting check_for_zero = c()
when calling
read_licor_6800_Excel
or read_gasex_file
.
File structure: Not that this function is not foolproof and may not be able to read some LI-6800 log files. For example, this function assumes that the logged points are contained in a single table. If user constants are logged as rows rather than columns, the file will instead contain multiple tables, and this function will not be able to read it.
Value
An exdf
object that fully includes all the data from the Licor Excel
file. In addition to the elements described in the documentation for
read_gasex_file
, the following "extra" elements are also
included:
preamble
: A data frame containing the "preamble" (or "header") information from the file.data_row
: The line of the file where the column name was found.
Examples
# Example 1: Reading a Licor Excel file that is included with the PhotoGEA
# package.
licor_file <- PhotoGEA:::read_licor_6800_Excel(
PhotoGEA_example_file_path('ball_berry_1.xlsx')
)
# Example 2: Reading a Licor Excel file that is included with the PhotoGEA
# package; here we use a different column name to identify the data block within
# the file's contents.
licor_file <- PhotoGEA:::read_licor_6800_Excel(
PhotoGEA_example_file_path('ball_berry_1.xlsx'),
column_name = 'A'
)