ronkeizer / vpc

R library to create visual predictive checks (VPC)
Other
36 stars 20 forks source link

how to implement returning vpcdb? #25

Closed dpastoor closed 9 years ago

dpastoor commented 9 years ago

I'd like to add an option to return the vpcdb after all binning/calcluations etc rather than just the plot object.

I just played around with trying to extract the object with ggplot$data but there are some issues that make it very cumbersome/impossible to do some things.

Of course the easiest option would be just an argument like vpcdb = FALSE and if true would return the vpcdb rather than the plot object.

A slightly more complex method would be to return a list of class vpc then assign the show method to just return the plot (so I think it should behave as it currently does but keeps all the data available at the same time. The issue I have with this is I don't know how that would play out when overloading the + operator to add additional plot elements like vpc1 + PKPDmisc::base_theme()

For now I'd propose just adding a final vpcdb = FALSE arg but wanted to check your thoughts before I threw it in.

ronkeizer commented 9 years ago

yes, using the ggplot$data won't work well the vpcdb=FALSE approach is fine with me. With the more complex method I see indeed the same issue you mention. It's probably not worth the effort too look into.

dpastoor commented 9 years ago

added in 833c99788576df04b116e3174b8def82f0e8f7b2