Description Usage Arguments Value Author(s) References Examples
View source: R/impute_NA_covariate.R
Impute / copy over missing covariate values in a data.frame
1 | impute_NA_covariate(XX, colname_01, colname_02, stop_if_both_missing = TRUE)
|
XX |
data.frame with two columns to be copied one from another |
colname_01 |
character name of column with possibly NA values. |
colname_02 |
character name of column with possibly NA values. |
stop_if_both_missing |
logical whether to stop() if both entries are missing. |
An R data.frame with identical columns under colname_01 & colname_02.
Bill Forrest <forrest@gene.com>
Bill Forrest forrest@gene.com
1 2 3 4 5 6 7 8 9 | test_levels <- c( 'one', 'two', 'three', 'four' )
DF_with_NA <-
data.frame( First = factor( c( NA, 'two', NA, 'four' ), levels = test_levels ),
Second = factor( c( NA, NA, 'three', NA ), levels = test_levels ),
Third = factor( test_levels, levels = test_levels )
)
DF_imputed_12 <- maeve:::impute_NA_covariate( DF_with_NA, 'First', 'Second',
stop_if_both_missing = FALSE )
DF_imputed_13 <- maeve:::impute_NA_covariate( DF_with_NA, 'First', 'Third' )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.