Learn R Programming

teal.reporter (version 0.6.0)

teal_report: Comprehensive data integration function for teal applications

Description

[Stable]

Initializes a reportable data for teal application.

Usage

teal_report(
  ...,
  teal_card = NULL,
  code = character(0),
  join_keys = teal.data::join_keys()
)

as.teal_report(x)

Value

A teal_report object.

Arguments

...

any number of objects (presumably data objects) provided as name = value pairs.

teal_card

(teal_card) object containing the report content.

code

(character, language) optional code to reproduce the datasets provided in .... Note this code is not executed and the teal_data may not be reproducible

Use verify() to verify code reproducibility.

join_keys

(join_keys or single join_key_set) optional object with datasets column names used for joining. If empty then no joins between pairs of objects.

x

(qenv or teal_data) object to convert to teal_report.

See Also

teal.data::teal_data

Examples

Run this code
# Initialize teal_report with existing h2 header
report <- teal_report(teal_card = teal_card("## Analysis Report"))

# Use within() to execute code and add code-chunk
report <- within(report, {
  data <- iris
  summary_stats <- summary(data)
})

# Access objects created within the report
report$data
report$summary_stats

# within() automatically captures code and outputs
report <- within(report, {
  head(iris)
})

# Add arbitrary markdown content to the card
teal_card(report) <- c(
  teal_card(report),
  teal_card("### Conclusion", "The analysis is complete.")
)

# View the generated card with code chunks
teal_card(report)

# View report in HTML format
tools::toHTML(report)

if (interactive()) {
  # Render the report to various formats
  render(report, output_format = rmarkdown::html_document())
  render(report, output_format = rmarkdown::pdf_document())
}

Run the code above in your browser using DataLab