Publish an R Markdown file to Platform Reports

publish_rmd(
  rmd_file,
  report_id = NULL,
  report_name = NULL,
  provide_api_key = NULL,
  project_id = NULL,
  ...
)

Arguments

rmd_file

string, R Markdown file (.Rmd)

report_id

integer, ID of an existing report, if provided, the contents of the report will be replaced. If report_id is NULL, a new report will be created.

report_name

string, Title of report in platform

provide_api_key

bool, Set to true to include API key in report.

project_id

integer, Project_id that the report should be added to.

...

additional parameters to send to rmarkdown::render. Note: A temporary file will be used for output_file if output_file is not explicitly set and input will be overwritten with rmd_file.

Details

This function also supports passing report_id, report_name, provide_api_key and project_id as metadata in the report's YAML front matter. Just as the title of an RMarkdown document can be set with title: "my title!", these parameters can be set like

  civis:
    report_name: "My Report Name"
    report_id: 9000

Since report_id is set, this code will overwrite the existing report with that number, which may be useful when updating a report on a schedule. Any argument passed in explicitly to publish_rmd will be used in place of the corresponding argument set in YAML metadata.

Note

rmarkdown::render depends on a recent version of pandoc. pandoc is distributed with RStudio and thus, publish_rmd will work in an RStudio environment. Outside of RStudio pandoc may be installed or knitr::knit2html can be used to convert an R Markdown document into html. The html can then be published to Civis with publish_html.

See also

publish_html to publish html to Civis

Examples

if (FALSE) { # Publish a standard report publish_rmd("my_beautiful_doc.Rmd") # Publish a parameterized R Markdown document # See: http://rmarkdown.rstudio.com/developer_parameterized_reports.html params <- list("region" = "east", start = as.Date("2015-02-01")) publish_rmd("my_parameterized_doc.Rmd", params=params) }