mpdougherty / razviz

An R package to produce standard graphs for HEC-RAS models.
Creative Commons Zero v1.0 Universal
2 stars 0 forks source link

Add factor levels to Lengthen Hydro graph Function #4

Closed laallison closed 4 years ago

laallison commented 4 years ago

This will keep the legends in the same order throughout the report.

function (hydrograph_df) { long_hydrograph <- tidyr::pivot_longer(hydrograph_df, cols = c(WS_Elev, Obs_WS, Model_Q, Obs_Q), names_to = "Type", values_to = "value") long_hydrograph$Type <- factor(long_hydrograph$Type,levels = c("WS_Elev","Obs_WS", "Model_Q", "Obs_Q"), labels = c("WS_Elev","Obs_WS", "Model_Q", "Obs_Q")) return(long_hydrograph) }

laallison commented 4 years ago

Could we add the na.omit() capability to this as well?

mpdougherty commented 4 years ago

Ordered the Type factor and omitted NAs: bb79a1996cf5b3c76e6bc3658e786a6b6e272bf4