Skip to content

Commit

Permalink
provide a default method when id = NULL
Browse files Browse the repository at this point in the history
- no nested listing if `id = NULL`.
  • Loading branch information
elong0527 committed Apr 10, 2024
1 parent 94afc94 commit cadbf46
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions R/interactive_table1.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ interactive_table1 <- function(meta,
keep_missing = TRUE,
total = TRUE,
column_header = TRUE,
show_listing = TRUE,
var_listing = NULL,
download = "none",
type = NULL,
Expand All @@ -31,6 +32,7 @@ interactive_table1 <- function(meta,
if (!listing) {
message("Drill-down listing is not provided because there are more than ", max_row, " rows in the datasets")
}
listing <- show_listing & listing

tbl <- metalite::collect_n_subject(meta,
population = population,
Expand Down
11 changes: 10 additions & 1 deletion R/metalite_table1.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#' @export
metalite_table1 <- function(formula,
data,
id,
id = NULL,
var_listing = NULL,
total = TRUE,
header = NULL,
Expand All @@ -34,6 +34,14 @@ metalite_table1 <- function(formula,
stop("There is no records in the input dataset")
}

if(is.null(id)){
data$.id <- 1:nrow(data)
id = ".id"
show_listing <- FALSE
}else{
show_listing <- TRUE
}

if (formula[[2]][[1]] == "|") {
var <- all.vars(formula[[2]][[2]])
group <- all.vars(formula[[2]][[3]])
Expand Down Expand Up @@ -112,6 +120,7 @@ metalite_table1 <- function(formula,
htmltools::browsable(
htmltools::tagList(metalite::meta_run(
meta,
show_listing = show_listing,
var_listing = var_listing,
download = download,
type = record_name
Expand Down

0 comments on commit cadbf46

Please sign in to comment.