Skip to contents

Reshape data and delete meaningless rows.

Usage

mi_clean_data(data, cols = everything(), placeholder = c("-"))

Arguments

data

A dataframe or tibble or data.table or matrix. Names of the column will be regard as the class of ID included in column.

cols

Character vectors. Columns of data that contain the IDs

placeholder

Character vectors. IDs included in placeholder will be omitted.

Value

A tibble with two columns("ID" and "class")

Examples

data <- tibble::tibble(
  "class1" = c("A", "B", "C", "D"),
  "class2" = c("E", "F", "G", "H"),
  "class3" = c("L", "M", "-", "O")
)
mi_clean_data(data)
#> # A tibble: 11 × 2
#>    ID    class 
#>    <chr> <chr> 
#>  1 A     class1
#>  2 E     class2
#>  3 L     class3
#>  4 B     class1
#>  5 F     class2
#>  6 M     class3
#>  7 C     class1
#>  8 G     class2
#>  9 D     class1
#> 10 H     class2
#> 11 O     class3