Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions R/module_init_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,17 @@ srv_init_data <- function(id, data) {
hashes <- .get_hashes_code(data)
data_teal_report <- as(data, "teal_report")
if (!inherits(data, "teal_report")) {
current_card <- lapply(
teal.reporter::teal_card(data_teal_report),
function(x) {
if (inherits(x, "code_chunk")) {
attr(x, "always_keep") <- TRUE
x
}
}
)
teal.reporter::teal_card(data_teal_report) <- c(
teal.reporter::teal_card(),
"## Code preparation",
teal.reporter::teal_card(data_teal_report)
teal.reporter::teal_card("## Data preparation"), current_card
)
}
tdata <- do.call(
Expand Down
7 changes: 5 additions & 2 deletions R/teal_data_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ NULL
teal.reporter::teal_card(data) <- c(
teal.reporter::teal_card(data),
"## Data filtering",
teal.reporter::code_chunk(code)
teal.reporter::code_chunk(code, always_keep = TRUE)
)
methods::validObject(data)
}
Expand Down Expand Up @@ -55,11 +55,14 @@ NULL
inherits(this, "code_chunk") &&
identical(attr(x[[l]], "params"), attr(this, "params"))
) {
always_keep <- (attr(x[[l]], "always_keep", exact = TRUE) %||% FALSE) ||
(attr(this, "always_keep", exact = TRUE) %||% FALSE)
x[[length(x)]] <- do.call(
teal.reporter::code_chunk,
args = c(
list(code = paste(x[[l]], this, sep = "\n")),
attr(x[[l]], "params")
attr(x[[l]], "params"),
list(always_keep = always_keep)
)
)
x
Expand Down
Loading