ReadClassData: Read a 'ClassData.txt' File

View source: R/functioncollection_import.R

ReadClassDataR Documentation

Read a 'ClassData.txt' File

Description

This is a convenience wrapper function to import a ClassData file as data frame into R. ClassData files contain definitions of SLC (Soil and Land use Crop) classes in five to 15 predefined columns, see ClassData.txt documentation.

Usage

ReadClassData(
  filename = "ClassData.txt",
  encoding = c("unknown", "UTF-8", "Latin-1"),
  verbose = TRUE
)

Arguments

filename

Path to and file name of the ClassData file to import. Windows users: Note that Paths are separated by '/', not '\'.

encoding

Character string, encoding of non-ascii characters in imported text file. Particularly relevant when importing files created under Windows (default encoding "Latin-1") in Linux (default encoding "UTF-8") and vice versa. See also argument description in fread.

verbose

Print information on number of data columns in imported file.

Details

ReadClassData is a convenience wrapper function of fread, with treatment of leading comment rows. Column names are created on import, optional comment rows are imported as strings in attribute 'comment'. Optional inline comments (additional non-numeric columns) are automatically identified and imported along with data columns.

Value

ReadClassData returns a data frame with added attribute 'comment'.

See Also

ReadGeoClass

Examples

te <- ReadClassData(filename = system.file("demo_model", "ClassData.txt", package = "HYPEtools"))
te


HYPEtools documentation built on Sept. 11, 2024, 8:34 p.m.