Reads records in the CSV and TXT (TSV) formats exported by by IntChron. These are regular comma- and tab-delimited files with a few elements of non-standard formatting that mean they cannot be directly parsed by generic functions such as read.delim() or readr::read_delim() (see details).

read_intchron_csv() and read_intchron_tsv()/read_intchron_txt() are convenience aliases for read_intchron_delim(file, delim = ",") and read_intchron_delim(file, delim = "\t") respectively.

It is usually more robust to retrieve data from IntChron in JSON format using intchron() or intchron_request().

read_intchron_delim(file, delim = c(",", "\t"))

read_intchron_csv(file)

read_intchron_tsv(file)

read_intchron_txt(file)

Arguments

file

Records from IntChron in .csv or .txt format. Can be either a path to a downloaded file or a URL (with or without the file extension).

delim

Character used separate columns in the record data. Either "," for CSV or "\t" (a tab character) for TXT/TSV.

Value

A tibble containing the data from the record.

Associated metadata is discarded.

Details

Delimited files exported from IntChron have the following non-standard formatting:

  • Comment lines are denoted with '#' and contain metadata before and after the table of data itself.

  • The comment line immediately above the data contains the column headings

  • A variable number of empty columns occur at the beginning of rows

  • A trailing delimiter occurs at the end of every row except the header

  • Missing values may be coded as: "", "-"

Beyond this, some data tables are malformed (e.g. they contain unmatched quotes) and cannot be parsed.