to_widetable: Reformat As Wide Table

Description Usage Arguments Value Examples

View source: R/export.r

Description

Reformat RAS data from long table format (i.e. output of to_longtable) to wide table format (key values are mapped to individual columns).

Usage

1
2
to_widetable(d, key.col, value.col, key.prefix, key.attr = c("River",
  "Reach"))

Arguments

d

The data table, i.e. output from to_longtable.

key.col

The name of the column holding data keys.

value.col

The name of the column holding data values.

key.prefix

Text to prepend to the new columns created from keys in key.col.

key.attr

Columns to maintain as attributes in the resulting wide-format table. By default, columns "River" and "Reach" will be searched for and maintained as attributes in the output wide-format

Value

The original data table in wide format.

Examples

1
2
3
4
5
6
simple.quasi = system.file("sample-data/SampleQuasiUnsteady.hdf",
  package = "RAStestR")
quasi.volincum = read_sediment(simple.quasi, "Vol In Cum")
quasi.long = to_longtable(quasi.volincum, "VolIn")
to_widetable(quasi.long, "Station", "VolIn")
to_widetable(quasi.long, "GrainClass", "VolIn")

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