0

Here is what I have:

A data frame which contains a date field, and a number of summary statistics.

Here's what I want:

I want a chart that allows me to compare the time series week over week, to see how the performance of the process this week compares to the previous one, for example.

What I have done so far:

##Get the week day name to display
summaryData$WeekDay <- format(summaryData$Date, format = '%A')
##Get the week number to differentiate the weeks
summaryData$Week <- format(summaryData$Date, format = '%V')

summaryData %>% 
  ggvis(x = ~WeekDay, y = ~Referrers) %>%
  layer_lines(stroke = ~Week)`

I expected it to create a chart with multiple coloured lines, each one representing a week in my data set. It does not do what I expect

hrbrmstr
  • 77,368
  • 11
  • 139
  • 205
Ryan Fry
  • 61
  • 2
  • 1
    Consider adding some example data to make your problem reproducible. See [here](http://stackoverflow.com/a/5963610/2461552) for some good tips on how to do this. – aosmith Aug 10 '15 at 23:16

1 Answers1

1

Try looking at reshaper to convert your data with a factor variable for each week, or split up the data with a dplyr::lag() command.

A general way of doing graphs of multiple columns in ggivs is to use the following format

summaryData %>% ggvis() %>% layer_lines(x = ~WeekDay, y = ~Referrers)%>% layer_lines(x=~WeekDay, y= ~Other)

I hope this helps

James Maine
  • 289
  • 2
  • 10