Replace_Missing {Colossus} | R Documentation |
Automatically assigns missing values in listed columns
Description
Replace_Missing
checks each column and fills in NA values
Usage
Replace_Missing(df, name_list, MSV, verbose = FALSE)
Arguments
df |
a data.table containing the columns of interest |
name_list |
vector of string column names to check |
MSV |
value to replace na with, same used for every column used |
verbose |
boolean to control if additional information is printed to the console, also accepts 0/1 integer |
Value
returns a filled datatable
See Also
Other Data Cleaning Functions:
Check_Dupe_Columns()
,
Check_Trunc()
,
Correct_Formula_Order()
,
Date_Shift()
,
Def_Control()
,
Def_Control_Guess()
,
Def_model_control()
,
Def_modelform_fix()
,
Joint_Multiple_Events()
,
Time_Since()
,
factorize()
,
factorize_par()
,
gen_time_dep()
,
interact_them()
Examples
library(data.table)
## basic example code reproduced from the starting-description vignette
df <- data.table::data.table("UserID"=c(112, 114, 213, 214, 115, 116, 117),
"Starting_Age"=c(18, 20, 18, 19, 21, 20, 18),
"Ending_Age"=c(30, 45, NA, 47, 36, NA, 55),
"Cancer_Status"=c(0, 0, 1, 0, 1, 0, 0))
df <- Replace_Missing(df, c("Starting_Age","Ending_Age"), 70)
[Package Colossus version 1.1.1 Index]