Skip to content

Commit

Permalink
updated get_design_tbl to work with just the design
Browse files Browse the repository at this point in the history
  • Loading branch information
shackett committed Sep 9, 2024
1 parent a388978 commit a217c1a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions R/design.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,25 @@
#'
#' Get a tabular summary of all variables.
#'
#' @inheritParams tomic_to
#' @param tomic_or_design Either a \code{tomic} object or its embedded design list
#'
#' @returns a tibble reflecting the \code{tomic} object's design.
#'
#' @examples
#' get_design_tbl(brauer_2008_triple)
#' get_design_tbl(brauer_2008_triple$design)
#'
#' @export
get_design_tbl <- function(tomic) {
tomic$design[c("features", "samples", "measurements")] %>%
get_design_tbl <- function(tomic_or_design) {

if (inherits(tomic_or_design, "tomic")) {
design <- tomic_or_design$design
} else {
check_design(tomic_or_design)
design <- tomic_or_design
}

design[c("features", "samples", "measurements")] %>%
{
purrr::map2(unname(.), names(.), function(x, y) {
x %>%
Expand Down

0 comments on commit a217c1a

Please sign in to comment.