Ran into the perfect tidyr
use case today:
library(plotly)
library(tidyr)
library(dplyr)
data("EuStockMarkets")
stocks <- as.data.frame(EuStockMarkets) %>%
gather(Index, Price) %>%
mutate(Date = rep(time(EuStockMarkets), 4))
plot_ly(stocks, x = Date, y = Price, color = Index)