I was looking, so please forgive me if I missed something.
Suppose a data frame contains a name, a date, calories, where calories are the total number of calories a person consumes on that day.
Name Date Calories Amy 1/1/01 1500 Amy 1/2/01 1600 Amy ... ... Sue 1/1/01 1450 Sue 1/1/02 1500 Sue ... ... Jim ... ...
What I would like to do is use ggvis to calculate calories for each person (Name). I know that I can use dplyr group_by and get it on one plot, but it will be too busy. And I know that I can use the dplyr filter and filter each person and schedule for each person, but it does not scale.
Is there a way for ggvis to automatically dig out a daily calorie schedule for each person?
Please note that I tried to create a function like the one below:
makeCharts <- function(myName){ myTbl %>% filter(Name == myName) %>% ggvis(~Date, ~Calories) }
It works great when you call it manually:
makeCharts("Amy")
But when you call it via sapply:
sapply(levels(myTbl$Name), makeCharts)
The result is as follows:
Amy Sue Jim John Sally Frank Sandy etc... marks List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 data List,1 List,1 List,1 List,1 List,1 List,1 List,1 List,1 List,1 List,1 List,1 List,1 List,1 List,1 List,1 props List,1 List,1 List,1 List,1 List,1 List,1 List,1 List,1 List,1 List,1 List,1 List,1 List,1 List,1 List,1 reactives List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 scales List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 axes List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 legends List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 controls List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 connectors List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 handlers List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 options List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 List,0 cur_data ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cur_props List,2 List,2 List,2 List,2 List,2 List,2 List,2 List,2 List,2 List,2 List,2 List,2 List,2 List,2 List,2 cur_vis NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL