Applies the fortify function to an xts object and updates the Index character column to a date column called 'Date'.

rvn_fortify_xts(x)

Arguments

x

xts formatted object to fortify to tibble

Value

tibble format of the xts data

Details

Useful in preparing data to plotting or other tidy-style analysis. This function is used internally in many RavenR plotting functions.

Examples

ff <- system.file("extdata","run1_Hydrographs.csv", package="RavenR")
hyd <- rvn_hyd_read(ff)$hyd
hyd_fortified <- rvn_fortify_xts(hyd)
head(hyd_fortified)
#>         Date   precip    Sub36 Sub36_obs    Sub43 Sub43_obs
#> 1 2002-10-01       NA  5.96354        NA 11.25050        NA
#> 2 2002-10-02 3.468690 11.96430     0.801 18.59070      3.07
#> 3 2002-10-03 1.189180 15.43700     0.828 25.74430      2.99
#> 4 2002-10-04 2.083260  8.76948     0.860 18.68610      3.06
#> 5 2002-10-05 6.474310  4.66501     0.903  9.82648      2.93
#> 6 2002-10-06 0.125591  4.20829     1.040  7.90952      3.15