read_rw_csv: Read RiverWare/RiverSMART produced csv files

View source: R/read_rw_csv.R

read_rw_csvR Documentation

Read RiverWare/RiverSMART produced csv files

Description

read_rw_csv() reads in a CSV file created from RiverWare. If the CSV file does not contain column names that RiverWare always uses (see Details), then it assumes that the CSV file was not created from RiverWare and throws an error. It also removes spaces from the column names, and adjusts the Object.Slot and ⁠Slot Value⁠ columns to be ObjectSlot and Value, respectively.

Usage

read_rw_csv(file)

Arguments

file

The name of the file which the data are to be read from. Either an absolute or relative path.

Details

The required column names are: ⁠Run Number⁠, ⁠Trace Number⁠, Object.Slot, Timestep, ⁠Slot Value⁠. See the CSV output section of the RiverWare documentation for more information on the other optional column names.

This function uses data.table::fread() to read in the CSV file, and forces it to expect a CSV file, expect headers, and return data.frame.

Value

A tibble (data frame) containing the data in the csv.

See Also

read.rdf()

Examples

zz <- read_rw_csv(system.file(
  "extdata/Scenario/ISM1988_2014,2007Dems,IG,Most",
  "KeySlots.csv",
  package = "RWDataPlyr"
))


BoulderCodeHub/RWDataPlyr documentation built on May 8, 2023, 3:55 a.m.