Skip to content

Commit

Permalink
removing tibble dep (#1792)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddsjoberg authored Jul 2, 2024
1 parent 6af7edb commit cf38775
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 25 deletions.
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ Imports:
gt (>= 0.10.0),
lifecycle (>= 1.0.3),
rlang (>= 1.1.1),
tibble (>= 3.2.1),
tidyr (>= 1.3.0),
vctrs
Suggests:
Expand Down
2 changes: 1 addition & 1 deletion R/as_tibble.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#' Logical argument adding the missing value formats.
#' @inheritParams rlang::args_dots_empty
#'
#' @return a [tibble][tibble::tibble-package]
#' @return a [tibble](https://tibble.tidyverse.org/)
#'
#' @author Daniel D. Sjoberg
#' @name as_tibble.gtsummary
Expand Down
2 changes: 1 addition & 1 deletion R/tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
#' The following table describes the argument inputs for each gtsummary table type.
#'
#' ```{r, echo = FALSE}
#' tibble::tribble(
#' dplyr::tribble(
#' ~`**argument**`, ~`**tbl_summary**`, ~`**tbl_svysummary**`, ~`**tbl_survfit**`, ~`**tbl_continuous**`,
#' "`data=`", "A data frame", "A survey object", "A `survfit()` object", "A data frame",
#' "`variable=`", "String variable name", "String variable name", "`NA`", "String variable name",
Expand Down
2 changes: 1 addition & 1 deletion R/utils-tbl_regression.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ tidy_prep <- function(x, tidy_fun, exponentiate, conf.level, intercept, label,
{dplyr::bind_cols(
.,
attributes(.)[names(attributes(.)) %in% c("N_obs", "N_event", "coefficients_type", "coefficients_label")] %>%
tibble::as_tibble()
dplyr::as_tibble()
)}
# styler: on

Expand Down
2 changes: 1 addition & 1 deletion data-raw/trial.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set.seed(8976)
n <- 200
trial <-
tibble::tibble(
dplyr::tibble(
trt = sample(c("Drug A", "Drug B"), n, replace = TRUE),
age = rnorm(n, mean = 50, sd = 15) %>% as.integer(),
marker = rgamma(n, 1, 1) %>% round(digits = 3),
Expand Down
2 changes: 1 addition & 1 deletion man/as_tibble.gtsummary.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tests/testthat/test-add_difference.tbl_summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ test_that("statistics are replicated within add_difference.tbl_summary()", {
verbose = FALSE
)
) |>
tibble::as_tibble() |>
dplyr::as_tibble() |>
select(-CI) |>
set_names(c("estimate", "conf.low", "conf.high")),
ignore_attr = TRUE
Expand All @@ -350,7 +350,7 @@ test_that("statistics are replicated within add_difference.tbl_summary()", {
verbose = FALSE
)
) |>
tibble::as_tibble() |>
dplyr::as_tibble() |>
select(-CI) |>
set_names(c("estimate", "conf.low", "conf.high")),
ignore_attr = TRUE
Expand Down
15 changes: 8 additions & 7 deletions tests/testthat/test-add_p.tbl_summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -502,13 +502,14 @@ test_that("add_p.tbl_summary() can be run after add_difference()", {
test_that("addressing GH #1513, where the default test was incorrect", {
expect_equal(
# before the fix, this was defaulting to a chi-squared, when it should be fisher
tibble::tibble(type = character(), answer = character()) |>
tibble::add_row(tidyr::uncount(tibble::tibble(type = "A", answer = "C1"), 5)) |>
tibble::add_row(tidyr::uncount(tibble::tibble(type = "B", answer = "C1"), 10)) |>
tibble::add_row(tidyr::uncount(tibble::tibble(type = "A", answer = "C2"), 100)) |>
tibble::add_row(tidyr::uncount(tibble::tibble(type = "B", answer = "C2"), 305)) |>
tibble::add_row(tidyr::uncount(tibble::tibble(type = "A", answer = NA), 400)) |>
tibble::add_row(tidyr::uncount(tibble::tibble(type = "B", answer = NA), 300)) |>
dplyr::bind_rows(
tidyr::uncount(dplyr::tibble(type = "A", answer = "C1"), 5),
tidyr::uncount(dplyr::tibble(type = "B", answer = "C1"), 10),
tidyr::uncount(dplyr::tibble(type = "A", answer = "C2"), 100),
tidyr::uncount(dplyr::tibble(type = "B", answer = "C2"), 305),
tidyr::uncount(dplyr::tibble(type = "A", answer = NA), 400),
tidyr::uncount(dplyr::tibble(type = "B", answer = NA), 300)
) |>
tbl_summary(by = type) |>
assign_tests(include = "answer", calling_fun = "add_p") |>
getElement(1L) |>
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-add_stat.R
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ test_that("add_stat() for 'tbl_continuous'", {
)

add_stat_test1 <- function(data, variable, by, ...) {
tibble::tibble(addtl = "Data from elsewhere")
dplyr::tibble(addtl = "Data from elsewhere")
}

expect_equal(
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-as_gt.R
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ test_that("as_gt passes appended glance statistics correctly", {
gt_tbl <- tbl |> as_gt()

loc_hline <- tbl$table_body |>
tibble::rownames_to_column() |>
rownames_to_column() |>
dplyr::filter(!!tbl$table_styling$horizontal_line_above) |>
dplyr::pull(rowname) |>
as.numeric()
Expand Down
14 changes: 7 additions & 7 deletions vignettes/gtsummary_definition.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ The `header` table has the following columns and is one row per column found in
The table contains styling information that applies to entire column or the columns headers.

```{r, echo=FALSE}
tibble::tribble(
dplyr::tribble(
~Column, ~Description,
"column", "Column name from `.$table_body`",
"hide", "Logical indicating whether the column is hidden in the output. This column is also scoped in `modify_header()` (and friends) to be used in a selecting environment",
Expand Down Expand Up @@ -99,7 +99,7 @@ Updates/changes to footnote are appended to the bottom of the tibble.
A footnote of `NA_character_` deletes an existing footnote.

```{r, echo=FALSE}
tibble::tribble(
dplyr::tribble(
~Column, ~Description,
"column", "Column name from `.$table_body`",
"rows", "expression selecting rows in `.$table_body`, `NA` indicates to add footnote to header",
Expand All @@ -125,7 +125,7 @@ Updates/changes to styling functions are appended to the bottom of the tibble.


```{r, echo=FALSE}
tibble::tribble(
dplyr::tribble(
~Column, ~Description,
"column", "Column name from `.$table_body`",
"rows", "expression selecting rows in `.$table_body`",
Expand All @@ -151,7 +151,7 @@ Updates/changes to styling functions are appended to the bottom of the tibble.


```{r, echo=FALSE}
tibble::tribble(
dplyr::tribble(
~Column, ~Description,
"column", "Column name from `.$table_body`",
"rows", "expression selecting rows in `.$table_body`",
Expand Down Expand Up @@ -179,7 +179,7 @@ For example, reference rows in `tbl_regression()` are shown with an em-dash.
Updates/changes to styling functions are appended to the bottom of the tibble.

```{r, echo=FALSE}
tibble::tribble(
dplyr::tribble(
~Column, ~Description,
"column", "Column name from `.$table_body`",
"rows", "expression selecting rows in `.$table_body`",
Expand All @@ -205,7 +205,7 @@ This tibble gives instructions for merging columns into a single column.
The implementation in `as_gt()` will be updated after `gt::cols_label()` gains a `rows=` argument.

```{r, echo=FALSE}
tibble::tribble(
dplyr::tribble(
~Column, ~Description,
"column", "Column name from `.$table_body`",
"rows", "expression selecting rows in `.$table_body`",
Expand Down Expand Up @@ -309,7 +309,7 @@ While the statistics contained in each `"df_stats"` tibble can vary within a sin

Each tibble contain the following columns
```{r, echo = FALSE}
tibble::tribble(
dplyr::tribble(
~Column, ~Description,
"`variable`", "String of the variable name",
"`label`", "String matching the variable's values in `.$table_body$label`",
Expand Down
2 changes: 1 addition & 1 deletion vignettes/inline_text.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ The `pattern` argument syntax follows `glue::glue()` format with referenced R ob
The default is `pattern = "{estimate} ({conf.level*100}% CI {conf.low}, {conf.high}; {p.value})"`. You have access the to following fields within the `pattern` argument.

```{r, echo = FALSE}
tibble::tribble(
dplyr::tribble(
~Parameter, ~Description,
"`{estimate}`", "primary estimate (e.g. model coefficient, odds ratio)",
"`{conf.low}`", "lower limit of confidence interval",
Expand Down

0 comments on commit cf38775

Please sign in to comment.