Title: | Simple wrapper to use dygraphs directly with data frame (no xts object needed) |
---|---|
Description: | Simple wrapper to use dygraphs directly with data frame (no xts object needed) |
Authors: | Sebastian Kranz |
Maintainer: | Sebastian Kranz <[email protected]> |
License: | GPL >= 3.0 |
Version: | 0.1.0 |
Built: | 2024-12-21 03:24:30 UTC |
Source: | https://github.com/skranz/dyplot |
The function is a wrapper to the dygraph function in the package dygraph. It shows time series plots with interactive java script. While dygraph needs an xts time series object, dyplot works with a data frame. Missing observations can be filled if period is provided.
dyplot( data, xcol = colnames(data)[1], ycol = setdiff(colnames(data), xcol), var_col = NULL, val_col = NULL, interval = NULL )
dyplot( data, xcol = colnames(data)[1], ycol = setdiff(colnames(data), xcol), var_col = NULL, val_col = NULL, interval = NULL )
data |
a data.frame |
xcol |
name of the column with the x-Axis variable. Ideally a datetime object |
ycol |
names of the columns that are shown on the yaxis (used for a wide data fram) |
var_col |
the column with the values for a data frame in long format |
interval |
if you have missing rows you can specify the interval of you data, e.g. "day" or "year" or "hour" to fill the gaps |
Transform a data from to an xts object
to.xts( dat, time.col, interval = NULL, time = dat[[time.col]], fill = !is.null(interval) )
to.xts( dat, time.col, interval = NULL, time = dat[[time.col]], fill = !is.null(interval) )