ropensci / visdat

Preliminary Exploratory Visualisation of Data
https://docs.ropensci.org/visdat/
Other
450 stars 47 forks source link

vis_miss fails with single column of numbers #72

Closed sfirke closed 6 years ago

sfirke commented 6 years ago
x <- data.frame(a = 1:1000)
vis_miss(x)

Error in if (zero_range(from) || zero_range(to)) { : missing value where TRUE/FALSE needed

njtierney commented 6 years ago

Heya Sam,

Thank you for posting this!

It looks like this is happening around line 156 of vis_miss - I'll have a look in the next week.

njtierney commented 6 years ago

Just to confirm here, this is a problem with single columns only - weird!

x <- data.frame(a = 1:1000)
y <- data.frame(a = c(1:1000, rep(NA, 100)))
z <- data.frame(a = c(1:1000, rep(NA, 100)),
                b = c(rep(NA, 100), 1:1000))

library(visdat)
vis_miss(x)
#> Error in if (zero_range(from) || zero_range(to)) {: missing value where TRUE/FALSE needed
vis_miss(y)
#> Error in if (zero_range(from) || zero_range(to)) {: missing value where TRUE/FALSE needed
vis_miss(z)

Created on 2018-06-07 by the reprex package (v0.2.0).

njtierney commented 6 years ago

Here is the current behaviour:

x <- data.frame(a = 1:1000)
y <- data.frame(a = c(1:1000, rep(NA, 100)))
z <- data.frame(a = c(1:1000, rep(NA, 100)),
                b = c(rep(NA, 100), 1:1000))

library(visdat)
vis_miss(x)

vis_miss(y)

vis_miss(z)

Created on 2018-06-07 by the reprex package (v0.2.0).

Thanks for posting this issue @sfirke :)