mjg211 / multiarm

Design of single- and multi-stage multi-arm clinical trials
https://mjg211.github.io/multiarm/
Other
13 stars 6 forks source link

How to print single graphs? #2

Open pdeninis opened 2 years ago

pdeninis commented 2 years ago

First, and most importantly, thank you for the very interesting package!

I was trying to print the graphs in an instance of R using the function:

tables_and_figs<-plot(design,
                        density     = 100,
                        output      = TRUE,
                        print_plots = TRUE)

but all of the graphs are plotted in the same window (the next plot overwrites the previously printed one). Setting the mfrow parameter in the options does not work since they are ggplot graph.

I tried to watch inside the object to isolate each single plot but the output is longer than the R buffer can contain and I could not.

What is the intended way to get each single graph? Thank you again.

Paolo

PS It would be useful to have a technical file of the package or a vignette with the description and the working of the functions. Maybe I was unable to search it but all I found was the original paper Grayling and Wason (2020)

Considering its predictably very wide audience, I think that a video-tutorial explaining comparatively the practical significance of all the terms and their relevance in each analysis type and showing them by means of examples would be a most effective tool, too.

Congratulations for your already great result!

mjg211 commented 2 years ago

Hi Paolo,

If you're working within RStudio you can use the back arrow in a plot pane to navigate to whatever plot you're interested in. Alternatively, you can look in table_and_figs$plots. E.g., you get just the plot of the various error rates with table_and_figs$plots$equal_error.

There is a package vignette, but as yet it doesn't go much beyond the original paper. It is on my to-do list to extend this, along with providing other methods of explanation like video tutorials.

Glad you like the package!

pdeninis commented 2 years ago

Thank you for the super-fast reply!!

I had tried exactly with:

str(tables_and_figs$plots)

to know the function names of the specific plots, but even to partial the output with the $plots specification was not enough to have it complete!

I will search to know the list of names of the graphs and I'll succeed, using them as you have shown.

EDIT: It was simpler than I guessed. The code below does the job:

> names(tables_and_figs$plots)
[1] "boundaries"          "equal_power"         "equal_error"         "equal_other"         "equal_sample_size"   "shifted_power"       "shifted_sample_size" "pmf_N" 

My best wishes for your project!!