Learn R Programming

IRISMustangMetrics (version 2.4.7)

metricList2DF: Convert a MetricList into a Tidy Dataframe

Description

The metricList2DF function converts a list of SingleValueMetrics into a "tidy" dataframe with one value per row..

Usage

metricList2DF(metricList)

Value

A dataframe with one row per metric measurement.

Arguments

metricList

a list of SingleValueMetric objects

Author

Jonathan Callahan jonathan@mazamascience.com

Details

Metrics functions return lists of SingleValueMetric objects. A long metricList may be built up by appending the results of different metrics functions or the same metrics function operating on different seismic signals. A metricList generated by any of the MUSTANG Rscripts can be stored as an .RData file and reloaded for examination.

A metricList may contain values for many different metrics. This function creates a single "tidy" dataframe with the following colulmns: metricName, value, snclq, starttime, endtime, qualityFlag.

See Also

SingleValueMetric-class, metricList2Xml

Examples

Run this code
  if (FALSE) {
# Open a connection to EarthScope webservices
client <- new("IrisClient")

# Get the waveforms
starttime <- as.POSIXct("2012-01-24", tz="GMT")
endtime <- as.POSIXct("2012-01-25", tz="GMT")
st1 <- getDataselect(client,"AK","PIN","","BHE",starttime,endtime)
st2 <- getDataselect(client,"AK","PIN","","BHN",starttime,endtime)
st3 <- getDataselect(client,"AK","PIN","","BHZ",starttime,endtime)

# Calculate metrics and append them to the metricList
metricList <- stateOfHealthMetric(st1)
metricList <- append(metricList, basicStatsMetric(st1))
metricList <- append(metricList, basicStatsMetric(st2))
metricList <- append(metricList, basicStatsMetric(st3))

# Create dataframe
metricDF <- metricList2DF(metricList)
head(metricDF)
  }

Run the code above in your browser using DataLab