Skip to contents

Convert data to numeric, and for the ID column convert with fixed levels.

Usage

mi_to_numer(
  data,
  levels = c("*", 0:9, letters, LETTERS, "_", ".", "-", " ", "/", "\\", ":")
)

Arguments

data

A tibble with n position column(pos1,pos2,...) and class column.

levels

Characters accommodated in IDs.

Value

A numeric data frame with numerical or factor type columns.

Examples

data(mi_data_procID)
mi_to_numer(mi_data_procID)
#> # A tibble: 4,997 × 21
#>     pos1  pos2  pos3  pos4  pos5  pos6  pos7  pos8  pos9 pos10 pos11 pos12 pos13
#>    <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#>  1    42    51    56    42     2     2     2     2     5    10     9    10     5
#>  2    53    41    46    38     8    66     4     2     3     1     1     1     1
#>  3    54    43    59     3     7     5     2     2     1     1     1     1     1
#>  4    42    51    56    42     2     2     2     2     4     4     3     2     2
#>  5    38    10    50    63    43     7     1     1     1     1     1     1     1
#>  6    60    41    55     7     6    66     4     3     2     1     1     1     1
#>  7    41    48    40     3    66     4     2     6     1     1     1     1     1
#>  8    51    50    64     2     2     3     5     8     6     9     3     3     1
#>  9    38    43     3    10     3     8     4     2     1     1     1     1     1
#> 10    42    51    56    42     2     2     2     2     5     7     4     8    11
#> # ℹ 4,987 more rows
#> # ℹ 8 more variables: pos14 <dbl>, pos15 <dbl>, pos16 <dbl>, pos17 <dbl>,
#> #   pos18 <dbl>, pos19 <dbl>, pos20 <dbl>, class <fct>