flattenStats: Flattens a statistic list into a numeric or character vector.

View source: R/Statistic.R

flattenStatsR Documentation

Flattens a statistic list into a numeric or character vector.

Description

Margin statitics are list valued, however, it is often useful to break them down into separate statistics for each state. In particular, this facilitates putting the data into a data.frame format for further analysis.

Usage

flattenStats(statlist)

Arguments

statlist

A named list contatining the statsitics.

Details

Vector valued tatistics produces by PnodeMargin are replaced by multiple statistics with the state name appended (after a dot) to the variable name.

Scalar valued statistics are left as is.

Value

A vector with the statistics. If all statistics are numeric, it will be a numeric vector. If some are character valued (e.g., PnodeMode), it will be a character vector.

Author(s)

Russell Almond

See Also

PnodeMargin, PnodeEAP, PnodeMode,

Examples


slist <- list("Physics_EAP"=.3,
              "Physics_Margin"=c("High"=.5,"Medium"=.3,"Low"=.2),
              "Physics_Mode"="High")
flattenStats(slist)



ralmond/Peanut documentation built on Sept. 19, 2023, 8:27 a.m.