Skip to content

Commit

Permalink
Output chart report as a Word document only
Browse files Browse the repository at this point in the history
HTML support breaks the Word output and it is not used
Partial fix for #46
  • Loading branch information
AB-Kent committed Jun 14, 2021
1 parent a937501 commit 3e1d3b5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 21 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
**2021-06-10**

- Fix a critical bug in the consolidate and summarize addin
- Fix problems with chart generation in the analyze addin #46

# phenoptrReports 0.2.11
**2021-06-01**
Expand Down
13 changes: 2 additions & 11 deletions R/reports.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ write_summary_report = function(csd_path=NULL, csd=NULL,

#' Create summary charts from the results of an analysis
#'
#' Creates a Microsoft Word file or HTML report containing summary charts
#' derived from an analysis. The file type is determined by the file extension
#' of `output_path`, which must be either `.docx` or `.html`.
#' Creates a Microsoft Word document containing summary charts
#' derived from an analysis.
#' @param workbook_path Path to an Excel file containing sheets written
#' by [write_counts_sheet], etc.
#' @param output_path Path to write the resulting file.
Expand All @@ -57,19 +56,11 @@ write_summary_charts = function(workbook_path, output_path,
if (is.null(output_path))
stop('You must provide an output path.')

output_format = switch(tools::file_ext(output_path),
docx='word_document',
html='html_vignette')

if (is.null(output_format))
stop('Unsupported output format')

rmd_path = system.file("rmd", "Chart_report.Rmd",
package="phenoptrReports")

rmarkdown::render(rmd_path, output_file=output_path, quiet=TRUE,
intermediates_dir=temp_dir_by(output_path),
output_format=output_format,
params=list(workbook_path=workbook_path,
.by=.by,
max_slides_per_plot=max_slides_per_plot,
Expand Down
7 changes: 0 additions & 7 deletions inst/rmd/Chart_report.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
output:
word_document:
reference_docx: Chart_report_template.docx
html_vignette:
df_print: kable
params:
workbook_path:
input: file
Expand Down Expand Up @@ -42,11 +40,6 @@ library(tidyr)
knitr::opts_chunk$set(echo=FALSE,fig.width=10, fig.height=5.5,
comment=NA, warning=FALSE, message=FALSE)
# The default plot hook for vignettes creates a markdown image 'tag'
# which breaks in pandoc if there are any spaces in the image path.
# The standard HTML plot hook inserts an <img> tag which renders correctly.
knitr::knit_hooks$set(plot = knitr:::hook_plot_html)
workbook_path = params$workbook_path
max_slides_per_plot = params$max_slides_per_plot
max_heatmaps_per_plot = params$max_heatmaps_per_plot
Expand Down
5 changes: 2 additions & 3 deletions man/write_summary_charts.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3e1d3b5

Please sign in to comment.