Skip to content

[Feature Request]: Subset teal_card elements when subsetting teal_report #394

Description

@averissimo

Feature description

When subsetting a teal_report object with [.teal_report function, the cards should also be subsetted.

There are some questions to solve as there is no 1-1 relationship between code that is subsetted and cards (there might be text/outputs/....)

Topics to discuss:

  • Should we keep manual cards & outputs (@m7pr thinks so)
    • Alternative: generate teal_cards from code (maybe using .code_to_card)?

Mock tests below:

test_that("Subsetting teal_report also subsets teal_cards", {
  q <- within(teal_report(), {
    data1 <- iris
    data2 <- mtcars
    summary(data1)
    summary(data2)
  })

  q2 <- q["data1"]
  expect_equal(
    teal_card(q2),
    teal_card(q)[c(1,3, 4)] 
    # Q: should we keep the output of the code
  )
})

test_that("Subsetting teal_report also subsets teal_cards", {
  q <- within(teal_report(), {
    data1 <- iris
    data2 <- mtcars
    summary(iris)
    summary(mtcars)
  })

  teal_card(q) <- c(teal_card(q), "My first manual card")

  q2 <- q["data1"]
  # Q: should we keep the manual cards
})

Code of Conduct

  • I agree to follow this project's Code of Conduct.

Contribution Guidelines

  • I agree to follow this project's Contribution Guidelines.

Security Policy

  • I agree to follow this project's Security Policy.

Metadata

Metadata

Assignees

No one assigned

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions