Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


HYPEtools (version 1.6.4)

ReadGeoData: 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
)

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.

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.

Examples

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

Run the code above in your browser using DataLab