Skip to content
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

bind_shadow should only add columns for variables that have missing values #106

Closed
dicook opened this issue Aug 31, 2017 · 2 comments

Comments

@dicook
Copy link
Contributor

commented Aug 31, 2017

When a variable has NO missing there is no need to add a shadow column

@njtierney

This comment has been minimized.

Copy link
Owner

commented Aug 31, 2017

Good point!

@njtierney njtierney added this to Priority in CRAN Version 0.2.0 Nov 20, 2017

@njtierney njtierney moved this from Priority to In Progress in CRAN Version 0.2.0 Dec 15, 2017

@njtierney njtierney added this to To Do in CRAN Version 0.3.0 Dec 18, 2017

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

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

@njtierney

This comment has been minimized.

Copy link
Owner

commented Jan 19, 2018

I've added an option in bind_shadow to take care of this, but default this is turned off. This is because other flavours of missing values #50 will make use of variables that might be "present", but could be values like -99. So you will want to have the full range of variables available to you to do this.

Example behaviour

library(naniar)

bind_shadow(airquality)
#> # A tibble: 153 x 12
#>    Ozone Solar.R  Wind  Temp Month   Day Ozone_NA Solar.R_NA Wind_NA
#>    <int>   <int> <dbl> <int> <int> <int> <fct>    <fct>      <fct>  
#>  1    41     190  7.40    67     5     1 !NA      !NA        !NA    
#>  2    36     118  8.00    72     5     2 !NA      !NA        !NA    
#>  3    12     149 12.6     74     5     3 !NA      !NA        !NA    
#>  4    18     313 11.5     62     5     4 !NA      !NA        !NA    
#>  5    NA      NA 14.3     56     5     5 NA       NA         !NA    
#>  6    28      NA 14.9     66     5     6 !NA      NA         !NA    
#>  7    23     299  8.60    65     5     7 !NA      !NA        !NA    
#>  8    19      99 13.8     59     5     8 !NA      !NA        !NA    
#>  9     8      19 20.1     61     5     9 !NA      !NA        !NA    
#> 10    NA     194  8.60    69     5    10 NA       !NA        !NA    
#> # ... with 143 more rows, and 3 more variables: Temp_NA <fct>, Month_NA
#> #   <fct>, Day_NA <fct>
# bind only the variables that contain missing values
bind_shadow(airquality, only_miss = TRUE)
#> # A tibble: 153 x 8
#>    Ozone Solar.R  Wind  Temp Month   Day Ozone_NA Solar.R_NA
#>    <int>   <int> <dbl> <int> <int> <int> <fct>    <fct>     
#>  1    41     190  7.40    67     5     1 !NA      !NA       
#>  2    36     118  8.00    72     5     2 !NA      !NA       
#>  3    12     149 12.6     74     5     3 !NA      !NA       
#>  4    18     313 11.5     62     5     4 !NA      !NA       
#>  5    NA      NA 14.3     56     5     5 NA       NA        
#>  6    28      NA 14.9     66     5     6 !NA      NA        
#>  7    23     299  8.60    65     5     7 !NA      !NA       
#>  8    19      99 13.8     59     5     8 !NA      !NA       
#>  9     8      19 20.1     61     5     9 !NA      !NA       
#> 10    NA     194  8.60    69     5    10 NA       !NA       
#> # ... with 143 more rows

@njtierney njtierney closed this in ea09578 Jan 19, 2018

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

@njtierney njtierney moved this from To Do to Done in CRAN Version 0.3.0 Jan 26, 2018

@njtierney njtierney removed the V0.3.0 label Jun 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
2 participants
You can’t perform that action at this time.