vendredi 27 février 2015

Dygraph multiple plots - turn them on and off with R and dySeries options

Good afternoon everyone, I am discovering dyGraph for R and it is an amazing tool. I need to plot only two variables ("Lifetime.Engaged.Users" & "Lifetime.Post.Total.Reach") of my 32 variables xts matrix.


My problem is as follow, even if I specify the two series I want to be plotted (with dySeries), dyGraph plots all the 32 variables, making the graph totally unreadable. Here is the code.



# Read the insights from xls export
facebook.insight <- read.xlsx(
"Facebook Insights (Post Level)",
sheetIndex = 1)
# Convert the facebook insights to a Time Series with library(xts)
facebook.insight.TimeSerie <- xts(
facebook.insight[,-7],
order.by = facebook.insight$Posted
)
# Plot the desired series that are ("Lifetime.Engaged.Users" &
#"Lifetime.Post.Total.Reach") with dyGraph package

dygraph(facebook.insight.TimeSerie, main ="Facebook Insights") %>%
dySeries(name = "Lifetime.Engaged.Users", label = "Engaged Users") %>%
dySeries(name = "Lifetime.Post.Total.Reach", label = "Post Total Reach")


In conclusion, what shall I do to plot only the two desired series ("Lifetime.Engaged.Users" & "Lifetime.Post.Total.Reach"), without having to create 33 xts dataframes ?


Aucun commentaire:

Enregistrer un commentaire