diff --git a/R/causal_idx.R b/R/causal_idx.R index 6eccb7c..28a9fad 100644 --- a/R/causal_idx.R +++ b/R/causal_idx.R @@ -53,6 +53,8 @@ as_causal_idx <- function(x) { # printing +# (tests skipped on CI) +# nocov start #' @export format.causal_idx <- function(x, ...) { vapply(vctrs::vec_data(x), format_index_line, "") @@ -60,6 +62,7 @@ format.causal_idx <- function(x, ...) { format_index_line <- function(y) { paste0("(", paste0(formatC(y[!is.na(y)]), collapse=","), ")") } +# nocov end # vctrs ------------------------------------------------------------------- diff --git a/R/causal_mod.R b/R/causal_mod.R index 0f8ec87..d37a1aa 100644 --- a/R/causal_mod.R +++ b/R/causal_mod.R @@ -35,7 +35,9 @@ new_causal_mod <- function(x = list(), fitted = double(0), idx = seq_along(fitte #' #' d <- rbind(NA, npk) #' m_mis <- lm(yield ~ block + N*P*K, data=d) +#' fitted(m_mis) # length doesn't match rows of `d` #' causal_mod(m_mis) # NA for missing value +#' attr(causal_mod(m_mis), "idx") #' #' @order 1 #' @export @@ -70,14 +72,17 @@ is_causal_mod <- function(x) { # printing +# (tests skipped on CI) +# nocov start #' @export format.causal_mod <- function(x, ...) { formatC(vctrs::vec_data(x)) } #' @export str.causal_mod <- function(object, max.level=2, ...) { - NextMethod(max.level=max.level, ...) # nocov + NextMethod(max.level=max.level, ...) } +# nocov end # vctrs ------------------------------------------------------------------- diff --git a/R/causal_tbl.R b/R/causal_tbl.R index 4a72464..19f14a6 100644 --- a/R/causal_tbl.R +++ b/R/causal_tbl.R @@ -109,7 +109,8 @@ reconstruct.causal_tbl <- function(data, old) { #' that a `causal_tbl` has the necessary columns set via helpers like #' [has_treatment()], [has_outcome()], etc. #' -#' @param ... passed on to [tibble()] +#' @param ... passed on to [vctrs::df_list()] (for `causal_tbl` only) then +#' [vctrs::new_data_frame()] (both constructors). #' @param .outcome the column containing the outcome variable (tidy-selected). #' Can be set later with [set_outcome()]. #' @param .treatment the column containing the treatment variable (tidy-selected). @@ -223,6 +224,8 @@ assert_df <- function(data, arg) { # Printing ----------------------------------------------------------------- +# (tests skipped on CI) +# nocov start #' @importFrom pillar tbl_sum #' @method tbl_sum causal_tbl @@ -278,3 +281,5 @@ ctl_new_pillar.causal_tbl <- function(controller, x, width, ..., title = NULL) { data = out$data )) } + +# nocov end diff --git a/man/causal_mod.Rd b/man/causal_mod.Rd index 93977f3..6e6f2fc 100644 --- a/man/causal_mod.Rd +++ b/man/causal_mod.Rd @@ -49,6 +49,8 @@ causal_mod(m) d <- rbind(NA, npk) m_mis <- lm(yield ~ block + N*P*K, data=d) +fitted(m_mis) # length doesn't match rows of `d` causal_mod(m_mis) # NA for missing value +attr(causal_mod(m_mis), "idx") } diff --git a/man/causal_tbl.Rd b/man/causal_tbl.Rd index 84cbb5f..74e7150 100644 --- a/man/causal_tbl.Rd +++ b/man/causal_tbl.Rd @@ -16,7 +16,8 @@ as_causal_tbl(x) is_causal_tbl(x) } \arguments{ -\item{...}{passed on to \code{\link[=tibble]{tibble()}}} +\item{...}{passed on to \code{\link[vctrs:df_list]{vctrs::df_list()}} (for \code{causal_tbl} only) then +\code{\link[vctrs:new_data_frame]{vctrs::new_data_frame()}} (both constructors).} \item{.outcome}{the column containing the outcome variable (tidy-selected). Can be set later with \code{\link[=set_outcome]{set_outcome()}}.} diff --git a/tests/testthat/test-causal_idx.R b/tests/testthat/test-causal_idx.R index 313a5d9..41644d3 100644 --- a/tests/testthat/test-causal_idx.R +++ b/tests/testthat/test-causal_idx.R @@ -29,6 +29,9 @@ test_that("causal_idx slicing", { test_that("causal_idx printing", { + skip_on_ci() + skip_on_cran() + idx <- causal_idx(list(2, c(1, NA, 3), 2)) expect_snapshot(print(idx)) diff --git a/tests/testthat/test-causal_mod.R b/tests/testthat/test-causal_mod.R index e0f9a2d..0da387a 100644 --- a/tests/testthat/test-causal_mod.R +++ b/tests/testthat/test-causal_mod.R @@ -35,6 +35,9 @@ test_that("causal_mod slicing", { test_that("causal_mod printing", { + skip_on_ci() + skip_on_cran() + m <- lm(yield ~ block + N*P*K, data=npk) x <- causal_mod(m) diff --git a/tests/testthat/test-causal_tbl.R b/tests/testthat/test-causal_tbl.R index caad879..29b1db0 100644 --- a/tests/testthat/test-causal_tbl.R +++ b/tests/testthat/test-causal_tbl.R @@ -98,6 +98,9 @@ test_that("causal_tbl slicing and renaming", { }) test_that("causal_tbl printing", { + skip_on_ci() + skip_on_cran() + x <- causal_tbl(milk_first = c(0, 1, 0, 1, 1, 0, 0, 1), guess = c(0, 1, 0, 1, 1, 0, 0, 1), .outcome = guess,