From 7051b8fa000963d7a8155052533f2d63bb231ebe Mon Sep 17 00:00:00 2001 From: Nicholas Tierney Date: Wed, 4 Jul 2018 16:35:37 +1000 Subject: [PATCH] use tibble not data_frame --- R/internals.R | 6 +++--- R/vis-compare.R | 3 +-- man/miss_guide_label.Rd | 2 +- tests/testthat/test_variable_spaces.R | 8 ++++---- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/R/internals.R b/R/internals.R index ea11fbd..ca450b4 100644 --- a/R/internals.R +++ b/R/internals.R @@ -200,7 +200,7 @@ label_col_missing_pct <- function(x, #' #' @param x is a dataframe passed from vis_miss(x). #' -#' @return a data_frame with two columns `p_miss_lab` and `p_pres_lab`, +#' @return a tibble with two columns `p_miss_lab` and `p_pres_lab`, #' containing the labels to use for present and missing. A dataframe is #' returned because I think it is a good style habit compared to a list. #' @@ -239,8 +239,8 @@ miss_guide_label <- function(x) { sep = "") } - label_frame <- dplyr::data_frame(p_miss_lab = paste(p_miss_lab), - p_pres_lab = paste(p_pres_lab)) + label_frame <- tibble::tibble(p_miss_lab = paste(p_miss_lab), + p_pres_lab = paste(p_pres_lab)) return(label_frame) diff --git a/R/vis-compare.R b/R/vis-compare.R index b09e7c6..3f1e19e 100644 --- a/R/vis-compare.R +++ b/R/vis-compare.R @@ -36,8 +36,7 @@ vis_compare <- function(df1, v_identical <- Vectorize(identical) - df_diff <- purrr::map2(df1, df2, v_identical) %>% - dplyr::as_data_frame() + df_diff <- purrr::map2_df(df1, df2, v_identical) d <- df_diff %>% as.data.frame() %>% diff --git a/man/miss_guide_label.Rd b/man/miss_guide_label.Rd index 52ed0f5..d521478 100644 --- a/man/miss_guide_label.Rd +++ b/man/miss_guide_label.Rd @@ -10,7 +10,7 @@ miss_guide_label(x) \item{x}{is a dataframe passed from vis_miss(x).} } \value{ -a data_frame with two columns \code{p_miss_lab} and \code{p_pres_lab}, +a tibble with two columns \code{p_miss_lab} and \code{p_pres_lab}, containing the labels to use for present and missing. A dataframe is returned because I think it is a good style habit compared to a list. } diff --git a/tests/testthat/test_variable_spaces.R b/tests/testthat/test_variable_spaces.R index 88f176d..c0f7af6 100644 --- a/tests/testthat/test_variable_spaces.R +++ b/tests/testthat/test_variable_spaces.R @@ -2,10 +2,10 @@ context("Test names with spaces") library(visdat) -messy_names <- dplyr::data_frame(`Sepal Width` = iris$Sepal.Width, - `Sepal Length` = iris$Sepal.Length, - `Petal Length` = iris$Petal.Length, - `Species Names` = iris$Species) +messy_names <- tibble::tibble(`Sepal Width` = iris$Sepal.Width, + `Sepal Length` = iris$Sepal.Length, + `Petal Length` = iris$Petal.Length, + `Species Names` = iris$Species) test_that("vis_dat works on dataframes with irregular variable names", {