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, ...)



string, R Markdown file (.Rmd)


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.


string, Title of report in platform


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


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.


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

    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.


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


# Publish a standard report

# Publish a parameterized R Markdown document
# See:
params <- list("region" = "east", start = as.Date("2015-02-01"))
publish_rmd("my_parameterized_doc.Rmd", params=params)
# }