read_rw_csv: 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.
Value
A tibble (data frame) containing the data in the csv.
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.