metricList2DF: Convert a MetricList into a Tidy Dataframe

View source: R/Class-Metric.R

metricList2DFR Documentation

Convert a MetricList into a Tidy Dataframe


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





a list of SingleValueMetric objects


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.


A dataframe with one row per metric measurement.


Jonathan Callahan

See Also

SingleValueMetric-class, metricList2Xml


  ## Not run: 
# Open a connection to IRIS DMC 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)
## End(Not run)

IRISMustangMetrics documentation built on April 28, 2022, 1:06 a.m.