Description Usage Arguments Examples
View source: R/clean_and_format.R
Cleaning and format procedures, including coercing variables as numeric or factor, excluding columns (constants, perturbed, unreliable) and rows (incomplete data, outliers).
| 1 2 3 | 
| data | Data frame, a data frame to be prepared for applying cerUB protocols. | 
| categorical_columns | Character/Numeric, vector with the names/indexes of the categorical variables. | 
| numerical_columns | Character/Numeric, vector with the names/indexes of the numeric variables. | 
| completion_variable | Character, vector with two elements (name, value) referencing the column that indicates wheter observations (rows) are completed. For instance,  | 
| as_na | Character, vector that specifies values to be considered as NA. | 
| method | Character, method to be used in for replacing NA, if any ( | 
| columns_to_exclude | Character/Numeric, vector with the names/indexes of columns to exclude. | 
| rows_to_exclude | Character/Numeric, vector with the names/indexes of rows to exclude. | 
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## Not run: 
dt <- data.frame("First" = c(1,2,2,3,5,1,6,0,4,10),
                 "Second" = c("A","A","A","A","A","A","A","A","A","A"),
                 "Third" = c("1","2","2","3","5","1","6","0","4","10"),
                 "Fourth" = c("A","B","C","D","E","F","G","H","I","J"),
                 "dummy" = c("bla","ble","bli","blo","blu","bla","ble",
                             "bli","blo","blu"),
                 "checked" = c("yes","yes","no","yes","no","yes","yes",
                               "no","yes","yes"))
row.names(dt) <- 1:10
dt_clean <- clean_and_format(dt,
                             categorical_columns = c("Second", "Fourth"),
                             numerical_columns = c("First", "Third"),
                             completion_variable = c("checked","yes"),
                             as_na = c("D"),
                             method = "random",
                             columns_to_exclude = c("dummy"),
                             rows_to_exclude = c(1, 10)
                 )
## End(Not run)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.