NEFSC / READ-SSB-CHAJI-Effort-Displacement---Scallop

Other
0 stars 0 forks source link

Can't show both a plot and a table in the tiny report #213

Closed mle2718 closed 1 year ago

mle2718 commented 1 year ago

https://github.com/NEFSC/READ-SSB-CHAJI-Effort-Displacement---Scallop/blob/7b41af8889251f86f0561edece3540ed4a8c7047/analysis_code/scallop_analysis_tiny_report.Rmd#L643-L671

In this code, when out_switch!="table", the code looks like it should show both a table and a plot. However, when this is knit to html, the 2nd object (zone_out$plot) overwrite the first (zone_out$table). So, you cannot get both a table and a plot in the same chunk of r code.

I think it is not possible for Rmarkdown to have both a table and a figure in single code chunk.

I have a ugly ish fix. Set a logical based on the value of out_switch and then evaluate the next code chunk based on that logical.

See 87bc343272eb77e7a011f87121756221012fa1e6

@mchaji : Can you propagate this fix to the relevant code chunks in the tiny report?

mchaji commented 1 year ago

This was fixed using Min-Yang's code suggestions