Skip to content

Commit

Permalink
Fix error reported in #75
Browse files Browse the repository at this point in the history
  where `vis_dat(diamonds)` errored `seq_len(nrow(x))` inside internal
  function `vis_gather_`, used to calculate the row numbers. Using
  `mutate(rows = dplyr::row_number())` solved the issue.
  • Loading branch information
njtierney committed Jun 6, 2018
1 parent 0eb7ffb commit 4878053
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: visdat
Title: Preliminary Visualisation of Data
Version: 0.2.3.9600
Version: 0.2.4.9000
Authors@R: c(
person("Nicholas", "Tierney", role = c("aut", "cre"),
email = "nicholas.tierney@gmail.com",
Expand Down
17 changes: 13 additions & 4 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
# visdat 0.2.4.9000 (2018/06/07)

## Bug Fix

* Fix error reported in [#75](https://github.com/ropensci/visdat/issues/75)
where `vis_dat(diamonds)` errored `seq_len(nrow(x))` inside internal
function `vis_gather_`, used to calculate the row numbers. Using
`mutate(rows = dplyr::row_number())` solved the issue.

# visdat 0.2.3.9700 (2018/06/04)

# New Feature
## New Feature

* added NA colours to `vis_expect`
* Added `show_perc` arg to `vis_expect` to show the percentage of expectations that are TRUE. #73

# visdat 0.2.3.9600 (2018/05/23)

# Bugfix
## Bugfix

* Fix visdat x axis alignment when show_perc_col = FALSE - [#82](https://github.com/ropensci/visdat/issues/82)

# visdat 0.2.3.9500 (2018/04/27)

# New feature
## New feature

* added CITATION for visdat to cite the JOSS article

# visdat 0.2.3.9400 (2018/04/24)

# New feature
## New feature

* Added draft `vis_expect` to make it easy to look at certain appearances of numbers in your data.

Expand Down
2 changes: 1 addition & 1 deletion R/internals.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#'
vis_gather_ <- function(x){
x %>%
dplyr::mutate(rows = seq_len(nrow(x))) %>%
dplyr::mutate(rows = dplyr::row_number()) %>%
tidyr::gather_(key_col = "variable",
value_col = "valueType",
gather_cols = names(.)[-length(.)])
Expand Down
4 changes: 2 additions & 2 deletions man/vis_expect.Rd

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

7 changes: 6 additions & 1 deletion tests/testthat/test-vis-dat.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ test_that("vis_dat creates the right plot",{
vis_dat_plot_pal_cb)
})

test_that("vis_dat doesn't fail when using diamonds",{
msg <- paste0(packageVersion("ggplot2"))
cat(msg)
expect_is(vis_dat(ggplot2::diamonds), "gg")
})

test_that("vis_dat fails when the wrong palette is provided",{
ver <- as.character(gdtools::version_freetype())
cat(sprintf("FreeType version: %s\n", ver))
testthat::expect_error(vis_dat(typical_data, palette = "wat"))
expect_error(vis_dat(typical_data, palette = "wat"))
})

0 comments on commit 4878053

Please sign in to comment.