Closed tomjemmett closed 2 years ago
One confusion is that if you run ptd_spc()
without assigning the result, it does return a plot. If you run result <- ptd_spc()
you get a dataframe.
Is there an accepted way to describe that behaviour that could be included in the docs?
Strictly speaking, ptd_spc()
never returns a plot. It always returns a data.frame
derived object.
In an interactive session running this function in a console calls the print()
method. This method in turn calls plot()
.
This is the pretty much the same behaviour as ggplot
- if you run in the console and don't assign it immediately calls the underlying plotting method from print()
.
I'll have a look to see how it's described there and borrow any useful wordings.
Gotcha, that makes sense. I never realised that there were things going on outside of the package that caused that behaviour.
I've started to work on this in #137, but would value some other pairs of eyes to have a look and come up with some better description of what this function returns.
ptd_spc
documentation suggests that this function returns a ggplot object - it does not. Theplot
/ptd_create_ggplot
do return ggplot objects, butptd_spc
returns ac("ptd_spc_df", "tbl_df", "tbl", "data.frame")
. Need to update the documentation