Skip to content

Commit

Permalink
tbl → tibble
Browse files Browse the repository at this point in the history
  • Loading branch information
flying-sheep committed Sep 6, 2020
1 parent 7baa0ae commit 04239d0
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ r:
r_packages:
# Enhanced packages
- data.table
- dplyr
- tibble
- htmlwidgets
- plotly
# - geojsonio # not available
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Suggests:
leaflet
Enhances:
data.table,
dplyr,
tibble,
htmlwidgets,
vegalite,
plotly,
Expand Down
2 changes: 1 addition & 1 deletion R/repr_matrix_df.r
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ repr_text.matrix <- function(
cols = getOption('repr.matrix.max.cols')
) {
if (inherits(obj, c('tbl', 'data.table'))) {
# Coerce to data.frame to avoid special printing in dplyr and data.table.
# Coerce to data.frame to avoid special printing in tibble and data.table.
obj <- as.data.frame(obj)
}
limited_obj <- ellip_limit_arr(obj, rows, cols)
Expand Down
34 changes: 17 additions & 17 deletions tests/testthat/test_array_manipulation.r
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ context('Array and vector truncation')
options(stringsAsFactors = FALSE)

has_dt <- requireNamespace('data.table', quietly = TRUE)
has_dplyr <- requireNamespace('dplyr', quietly = TRUE)
has_tibble <- requireNamespace('tibble', quietly = TRUE)

#has_dt <- FALSE

Expand Down Expand Up @@ -51,8 +51,8 @@ test_that('ellip_limit_arr doesn\'t change arrays that are small', {
limited_dt_mat <- ellip_limit_arr(test_dt)
expect_identical(limited_dt_mat, expected_df_mat)
}
if (has_dplyr) {
test_tbl <- dplyr::as.tbl(test_df)
if (has_tibble) {
test_tbl <- tibble::as_tibble(test_df)
limited_tbl_mat <- ellip_limit_arr(test_tbl)
expect_identical(limited_tbl_mat, expected_df_mat)
}
Expand Down Expand Up @@ -92,8 +92,8 @@ test_that('ellip_limit_arr limits arrays that are wide (but not long)', {
limited_dt <- ellip_limit_arr(test_dt)
expect_identical(limited_dt, expected_df_mat)
}
if (has_dplyr) {
test_tbl <- dplyr::as.tbl(test_df)
if (has_tibble) {
test_tbl <- tibble::as_tibble(test_df)
limited_tbl <- ellip_limit_arr(test_tbl)
expect_identical(limited_tbl, expected_df_mat)
}
Expand All @@ -114,7 +114,7 @@ test_that('ellip_limit_arr limits arrays that are wide (but not long)', {
limited_dt <- ellip_limit_arr(test_dt)
expect_identical(limited_dt, expected_df_mat)
}
if (has_dplyr) {
if (has_tibble) {
limited_tbl <- ellip_limit_arr(test_tbl)
expect_identical(limited_tbl, expected_df_mat)
}
Expand Down Expand Up @@ -156,8 +156,8 @@ test_that('ellip_limit_arr limits arrays that are long (but not wide)', {
limited_dt <- ellip_limit_arr(test_dt)
expect_identical(limited_dt, expected_df_mat)
}
if (has_dplyr) {
test_tbl <- dplyr::as.tbl(test_df)
if (has_tibble) {
test_tbl <- tibble::as_tibble(test_df)
limited_tbl <- ellip_limit_arr(test_tbl)
expect_identical(limited_tbl, expected_df_mat)
}
Expand All @@ -179,7 +179,7 @@ test_that('ellip_limit_arr limits arrays that are long (but not wide)', {
limited_dt <- ellip_limit_arr(test_dt)
expect_identical(limited_dt, expected_df_mat)
}
if (has_dplyr) {
if (has_tibble) {
limited_tbl <- ellip_limit_arr(test_tbl)
expect_identical(limited_tbl, expected_df_mat)
}
Expand Down Expand Up @@ -222,9 +222,9 @@ test_that('ellip_limit_arr preserves rownames when limiting rows', {
limited_dt <- ellip_limit_arr(test_dt)
expect_identical(limited_dt, expected_df_mat)
}
if (has_dplyr) {
test_tbl <- dplyr::as.tbl(test_df)
# tbl removes rownames, so we have to reset them
if (has_tibble) {
test_tbl <- tibble::as_tibble(test_df)
# tibble removes rownames, so we have to reset them
suppressWarnings(rownames(test_tbl) <- rownames(test_df))
limited_tbl <- ellip_limit_arr(test_tbl)
expect_identical(limited_tbl, expected_df_mat)
Expand All @@ -247,7 +247,7 @@ test_that('ellip_limit_arr preserves rownames when limiting rows', {
limited_dt <- ellip_limit_arr(test_dt)
expect_identical(limited_dt, expected_df_mat)
}
if (has_dplyr) {
if (has_tibble) {
limited_tbl <- ellip_limit_arr(test_tbl)
expect_identical(limited_tbl, expected_df_mat)
}
Expand Down Expand Up @@ -298,8 +298,8 @@ test_that('ellip_limit_arr limits arrays that are long and wide', {
limited_dt <- ellip_limit_arr(test_dt)
expect_identical(limited_dt, expected_df_mat)
}
if (has_dplyr) {
test_tbl <- dplyr::as.tbl(test_df)
if (has_tibble) {
test_tbl <- tibble::as_tibble(test_df)
limited_tbl <- ellip_limit_arr(test_tbl)
expect_identical(limited_tbl, expected_df_mat)
}
Expand All @@ -324,7 +324,7 @@ test_that('ellip_limit_arr limits arrays that are long and wide', {
limited_dt <- ellip_limit_arr(test_dt)
expect_identical(limited_dt, expected_df_mat)
}
if (has_dplyr) {
if (has_tibble) {
limited_tbl <- ellip_limit_arr(test_tbl)
expect_identical(limited_tbl, expected_df_mat)
}
Expand All @@ -351,7 +351,7 @@ test_that('ellip_limit_arr limits arrays that are long and wide', {
limited_dt <- ellip_limit_arr(test_dt)
expect_identical(limited_dt, expected_df_mat)
}
if (has_dplyr) {
if (has_tibble) {
limited_tbl <- ellip_limit_arr(test_tbl)
expect_identical(limited_tbl, expected_df_mat)
}
Expand Down
22 changes: 11 additions & 11 deletions tests/testthat/test_escaping.r
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
context('LaTeX and HTML escaping')

has_dt <- requireNamespace('data.table', quietly = TRUE)
has_dplyr <- requireNamespace('dplyr', quietly = TRUE)
has_tibble <- requireNamespace('tibble', quietly = TRUE)



Expand Down Expand Up @@ -109,8 +109,8 @@ test_that('Factors are maintained in small arrays for text', {
answer <- repr_text(dt)
expect_id_text(answer, expected)
}
if (has_dplyr) {
dtbl <- dplyr::as.tbl(df)
if (has_tibble) {
dtbl <- tibble::as_tibble(df)
answer <- repr_text(dtbl)
expect_id_text(answer, expected)
}
Expand Down Expand Up @@ -139,8 +139,8 @@ test_that('Factors are maintained in small arrays for HTML', {
dt <- data.table::as.data.table(df)
expect_id_text(repr_html(dt), sub('data\\.frame', 'data.table', expected))
}
if (has_dplyr) {
dtbl <- dplyr::as.tbl(df)
if (has_tibble) {
dtbl <- tibble::as_tibble(df)
expect_id_text(repr_html(dtbl), sub('data\\.frame', 'tibble', expected))
}
})
Expand Down Expand Up @@ -168,8 +168,8 @@ test_that('Factors are sanitized in small data.frames for HTML', {
dt <- data.table::as.data.table(df)
expect_id_text(repr_html(dt), sub('data\\.frame', 'data.table', expected))
}
if (has_dplyr) {
dtbl <- dplyr::as.tbl(df)
if (has_tibble) {
dtbl <- tibble::as_tibble(df)
expect_id_text(repr_html(dtbl), sub('data\\.frame', 'tibble', expected))
}
})
Expand All @@ -194,8 +194,8 @@ test_that('Factors are maintained in small arrays for LaTeX', {
dt <- data.table::as.data.table(df)
expect_id_text(repr_latex(dt), sub('data\\.frame', 'data.table', expected))
}
if (has_dplyr) {
dtbl <- dplyr::as.tbl(df)
if (has_tibble) {
dtbl <- tibble::as_tibble(df)
expect_id_text(repr_latex(dtbl), sub('data\\.frame', 'tibble', expected))
}
})
Expand All @@ -220,8 +220,8 @@ test_that('Factors are sanitized in small data.frames for LaTeX', {
dt <- data.table::as.data.table(df)
expect_id_text(repr_latex(dt), sub('data\\.frame', 'data.table', expected))
}
if (has_dplyr) {
dtbl <- dplyr::as.tbl(df)
if (has_tibble) {
dtbl <- tibble::as_tibble(df)
expect_id_text(repr_latex(dtbl), sub('data\\.frame', 'tibble', expected))
}
})
Expand Down

0 comments on commit 04239d0

Please sign in to comment.