1

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 ?

  • 1
    you can try subsetting your `xts` before plotting, in the dygraph, replace `facebook.insight.TimeSerie` by `facebook.insight.TimeSerie[,c("Lifetime.Engaged.Users","Lifetime.Post.Total.Reach")]` – NicE Feb 27 '15 at 13:26

0 Answers0