New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shadow_shift handling infinite values #90

Closed
njtierney opened this Issue Aug 3, 2017 · 1 comment

Comments

Projects
1 participant
@njtierney
Owner

njtierney commented Aug 3, 2017

The handling of infinite values currently returns NaN - it should ideally return a shifted missing value and issue a warning for handling infinite values (ideally they should not be in your dataset, right?)

There should also be some way of turning off this behaviour / the loud noise that it makes

Below is some testing code for handling this.

library(naniar)
df_inf <-  data.frame(x = c(-Inf,rnorm(2), NA, Inf))

df_inf

df_inf %>%
  add_shadow_shift(x)

# use the minimum for the non infinite values
xmin <- min(df_inf$x[!is.infinite(df_inf$x)], na.rm = TRUE)

x_shift <- xmin - xmin*0.1

# set the seed here
# set.seed(seed_shift)
x_jitter <- (stats::runif(length(df_inf$x))-0.50)*x_shift*0.10

ifelse(is.na(df_inf$x),
       yes = x_shift + x_jitter,
       no = df_inf$x)

@njtierney njtierney added the V0.2.0 label Aug 3, 2017

@njtierney njtierney added this to To Do in CRAN Version 0.2.0 Aug 7, 2017

@njtierney njtierney moved this from To Do to Priority in CRAN Version 0.2.0 Dec 18, 2017

@njtierney njtierney moved this from Priority to To Do in CRAN Version 0.2.0 Jan 9, 2018

@njtierney

This comment has been minimized.

Owner

njtierney commented Jan 10, 2018

Perhaps shadow_shift need to use range() instead of min() to shift missing values?

@njtierney njtierney moved this from To Do to Priority in CRAN Version 0.2.0 Jan 19, 2018

@njtierney njtierney moved this from Priority to In Progress in CRAN Version 0.2.0 Jan 26, 2018

njtierney added a commit that referenced this issue Jan 27, 2018

@njtierney njtierney moved this from In Progress to Done in CRAN Version 0.2.0 Jan 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment