to_longtable: Reformat As Long Table

Description Usage Arguments Value Examples

View source: R/export.r

Description

Reformat RAS data from wide table format (stations are individual columns) to long table format (stations and data are collapsed to key-value column format.

Usage

1
2
to_longtable(d, data.col, gather.cols, station.col = "Station",
  gather.attr = c("River", "Reach"))

Arguments

d

The data table, i.e. output from read_table or read_sediment.

data.col

The name of the new column holding data values.

gather.cols

The column names to gather data from. If not specified, all columns with the prefix "XS_" will be used.

station.col

The name of the new column holding station IDs.

gather.attr

The attributes to include in the resulting long-format table. By default the "River" and "Reach" attributes are added as additional columns to the long-format table.

Value

The original data table in long format.

Examples

1
2
3
4
5
6
7
simple.quasi = system.file("sample-data/SampleQuasiUnsteady.hdf",
  package = "RAStestR")
quasi.flow = read_standard(simple.quasi, "Flow")
to_longtable(quasi.flow, "Flow")

quasi.volincum = read_sediment(simple.quasi, "Vol In Cum")
to_longtable(quasi.volincum, "VolumeIn")

mkoohafkan/RAStestR documentation built on July 14, 2019, 11:41 p.m.