ReadGeoData: Read a 'GeoData.txt' file

View source: R/functioncollection_import.R

ReadGeoDataR Documentation

Read a 'GeoData.txt' file

Description

Import a GeoData file into R.

Usage

ReadGeoData(
  filename = "GeoData.txt",
  sep = "\t",
  encoding = c("unknown", "UTF-8", "Latin-1"),
  remove.na.cols = TRUE
)

Arguments

filename

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

sep

character string. Field separator character as described in read.table.

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.

remove.na.cols

Logical, remove columns which have all NA values.

Details

ReadGeoData uses fread from the data.table::data.table package with type numeric type for columns AREA and RIVLEN (if they exist), and upper-case column names.

Value

If the imported file is a HYPE-conform GeoData file, ReadGeoData returns an object of S3 class HypeGeoData (see the class description there), providing its own summary method. If mandatory GeoData columns are missing, a standard dataframe is returned along with informative warning messages.

Examples

te <- ReadGeoData(filename = system.file("demo_model", "GeoData.txt", package = "HYPEtools"))
summary(te)


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