readHFD: 'readHFD()' reads a standard HFD .txt table as a 'data.frame'

View source: R/readHFD.R

readHFDR Documentation

readHFD() reads a standard HFD .txt table as a data.frame

Description

This calls read.table() with all the necessary defaults to avoid annoying surprises. The Age column is also stripped of "-" and "+" and converted to integer, and a logical indicator column called OpenInterval is added to show where these were located. Output is invisibly returned, so you must assign it to take a look. This is to avoid lengthy console printouts.

Usage

readHFD(filepath, fixup = TRUE, item = NULL, ...)

Arguments

filepath

path or connection to the HFD text file, including .txt suffix.

fixup

logical. Should columns be made more user-friendly, e.g., forcing Age to be integer?

item

character string of the data product code, which is the base file name, but excluding the country code and file extension .txt. For instance, "mabRR" or "tfrVHbo". This will be passed in, potentially, by the reader.

...

other arguments passed to read.table, not likely needed.

Details

No details of note.

Value

data.frame of standard HFD output, except the Age column has been cleaned, and a new open age indicator column has been added.

Note

original function submitted by Josh Goldstein, modified by Tim Riffe.


HMDHFDplus documentation built on April 3, 2025, 6:02 p.m.