load_file: Load and prep elevation data

Description Usage Arguments Details Value

View source: R/LITAP_load.R

Description

This function is used by the mapper functions to load input files and prepare them for analysis. It can also be used to load input files independently for plotting with flow_plot and/or trouble-shooting.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
load_file(
  file,
  nrow = NULL,
  ncol = NULL,
  missing_value = -9999,
  rlim = NULL,
  clim = NULL,
  grid = NULL,
  edge = TRUE,
  verbose = TRUE
)

Arguments

file

Character. The location of the file containing elevation data. See details for accepted file types

nrow

Numeric. Number of rows in dem file (required for dbf files with a single column, but can be automatically assessed from files with x and y coordinates.

ncol

Numeric. Number of columns in dem file (required for dbf files with a single column, but can be automatically assessed from files with x and y coordinates.

missing_value

Vector. The number or character string specifying missing data.

rlim

Vector. Two numbers specifying the start and end of a subset of rows to extract

clim

Vector. Two numbers specifying the start and end of a subset of columns to extract

grid

Numeric. Grid size in m of the input DEM file

edge

Logical. Whether to add an edge (buffer) around the data.

verbose

Logical. Output extra progress messages.

Details

All x/y data must be in a format such that greater values indicate East or North respectively.

This function uses file extensions to guess the file type to be loaded.

dBase files: These files are loaded via the read.dbf function from the foreign package. Columns must be named and must have a valid name (case doesn't not matter). X/Y coordinates are optional and must be named as "x", "lon", "long", "longitude", or "y", "lat", "latitude". Elevation columns can be "elev", "elevation", or "z". If no "x" and "y" columns are suppled, nrow and ncol arguments must be supplied. Column names matter, column order does not. Extra columns, if present, are ignored.

Grid file types: These file types are loaded via the raster function.

Text/Spreadsheet file types: Data in these files are all assumed to be arranged in three columns reflecting x, y, and z dimensions (z = elevation). Column order is important. Column names don't matter, but they should be present.

Value

Returns a data frame containing elevation data in a format suitable for analysis


steffilazerte/LITAP documentation built on Feb. 9, 2022, 8:11 a.m.