The CGATS text format supports a preamble followed by N tables, where N ≥ 1.
Each table can have a separate header.
A table may or may not contain spectral data, see Note.
The function converts each table to a
data.frame with attributes;
the path name of a single file, in CGATS format
The returned list is given attributes:
and (if present)
The attribute values are all character vectors.
The value of attribute
"path" is the argument
and the other values are extracted from
The length of
"preamble" is (typically) greater than 1, and the others have length 1.
Each line of the preamble is a keyword-value pair.
ORIGINATOR is converted to attribute
FILE_DESCRIPTOR is converted to attribute
CREATED is converted to attributes
The list is also given
If the keyword
TABLE_NAME is present in the table header, then its value is used.
Otherwise the names are
data.frame in the list is assigned attributes:
and (if present)
The length of
"header" is (typically) greater than 1, and
"descriptor" has length 1.
Each line of the table header is a keyword-value pair.
are converted to attribute
For the lines between
two conventions for separating the values are supported:
In the standard convention, fields are separated by contiguous spaces or tabs, and character strings (which may have embedded spaces or even tabs)
are enclosed by double-quotes.
This is is the convention in the CGATS standard.
scan() is used here.
In the non-standard convention, fields are separated by a single tab,
and character strings (which may have embedded spaces but not tabs) are not enclosed by double-quotes.
This convention is often easier to work with in spreadsheet software.
strsplit() is used here.
readCGATS() selects the separation convention
by examining the line after
If this line is split by a single tab and the number of fields
matches that given on the
then the non-standard convention is selected;
otherwise, the standard convention is selected.
readCGATS() returns a list of
data.frame for each table found in
The list and each individual
data.frame have attributes, see Details.
path has only a single table (the majority of files have only 1)
TRUE, then the attributes of the list
are copied to those of the
data.frame is then returned.
The name of the table is lost.
If there is an error in any table, then the function returns
field names may not be quoted and may not have embedded spaces.
The CGATS standard allows duplicated field names, and
readCGATS() returns them as they appear, with no attempt to append numbers
in order to make them unique.
Examples of field names which may be duplicated are:
for more on these see
No attempt is made to recognize those tables that contain spectral data. For conversion of spectral data to colorSpec objects, see
ANSI/CGATS.17. Graphic technology - Exchange format for colour and process control data using XML or ASCII text. https://webstore.ansi.org/ 2009.
ISO/28178. Graphic technology - Exchange format for colour and process control data using XML or ASCII text. https://www.iso.org/standard/44527.html. 2009.
CGATS.17 Text File Format. http://www.colorwiki.com/wiki/CGATS.17_Text_File_Format.
1 2 3 4 5
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.