k-Nearest Neighbour Imputation based on a variation of the Gower Distance for numerical, categorical, ordered and semi-continous variables.

kNN(
  data,
  variable = colnames(data),
  metric = NULL,
  k = 5,
  dist_var = colnames(data),
  weights = NULL,
  numFun = median,
  catFun = maxCat,
  makeNA = NULL,
  NAcond = NULL,
  impNA = TRUE,
  donorcond = NULL,
  mixed = vector(),
  mixed.constant = NULL,
  trace = FALSE,
  imp_var = TRUE,
  imp_suffix = "imp",
  addRF = FALSE,
  onlyRF = FALSE,
  addRandom = FALSE,
  useImputedDist = TRUE,
  weightDist = FALSE,
  methodStand = "range",
  ordFun = medianSamp
)

Arguments

data

data.frame or matrix

variable

variables where missing values should be imputed

metric

metric to be used for calculating the distances between

k

number of Nearest Neighbours used

dist_var

names or variables to be used for distance calculation

weights

weights for the variables for distance calculation. If weights = "auto" weights will be selected based on variable importance from random forest regression, using function ranger::ranger(). Weights are calculated for each variable seperately.

numFun

function for aggregating the k Nearest Neighbours in the case of a numerical variable

catFun

function for aggregating the k Nearest Neighbours in the case of a categorical variable

makeNA

list of length equal to the number of variables, with values, that should be converted to NA for each variable

NAcond

list of length equal to the number of variables, with a condition for imputing a NA

impNA

TRUE/FALSE whether NA should be imputed

donorcond

list of length equal to the number of variables, with a donorcond condition as character string. e.g. a list element can be ">5" or c(">5","<10). If the list element for a variable is NULL no condition will be applied for this variable.

mixed

names of mixed variables

mixed.constant

vector with length equal to the number of semi-continuous variables specifying the point of the semi-continuous distribution with non-zero probability

trace

TRUE/FALSE if additional information about the imputation process should be printed

imp_var

TRUE/FALSE if a TRUE/FALSE variables for each imputed variable should be created show the imputation status

imp_suffix

suffix for the TRUE/FALSE variables showing the imputation status

addRF

TRUE/FALSE each variable will be modelled using random forest regression (ranger::ranger()) and used as additional distance variable.

onlyRF

TRUE/FALSE if TRUE only additional distance variables created from random forest regression will be used as distance variables.

addRandom

TRUE/FALSE if an additional random variable should be added for distance calculation

useImputedDist

TRUE/FALSE if an imputed value should be used for distance calculation for imputing another variable. Be aware that this results in a dependency on the ordering of the variables.

weightDist

TRUE/FALSE if the distances of the k nearest neighbours should be used as weights in the aggregation step

methodStand

either "range" or "iqr" to be used in the standardization of numeric vaiables in the gower distance

ordFun

function for aggregating the k Nearest Neighbours in the case of a ordered factor variable

Value

the imputed data set.

References

A. Kowarik, M. Templ (2016) Imputation with R package VIM. Journal of Statistical Software, 74(7), 1-16.

See also

Other imputation methods: hotdeck(), impPCA(), irmi(), matchImpute(), medianSamp(), rangerImpute(), regressionImp(), sampleCat()

Author

Alexander Kowarik, Statistik Austria

Examples


data(sleep)
kNN(sleep)
#>     BodyWgt BrainWgt NonD Dream Sleep  Span  Gest Pred Exp Danger BodyWgt_imp
#> 1  6654.000  5712.00  3.2   0.8   3.3  38.6 645.0    3   5      3       FALSE
#> 2     1.000     6.60  6.3   2.0   8.3   4.5  42.0    3   1      3       FALSE
#> 3     3.385    44.50 12.8   2.4  12.5  14.0  60.0    1   1      1       FALSE
#> 4     0.920     5.70 10.4   2.4  16.5   3.2  25.0    5   2      3       FALSE
#> 5  2547.000  4603.00  2.1   1.8   3.9  69.0 624.0    3   5      4       FALSE
#> 6    10.550   179.50  9.1   0.7   9.8  27.0 180.0    4   4      4       FALSE
#> 7     0.023     0.30 15.8   3.9  19.7  19.0  35.0    1   1      1       FALSE
#> 8   160.000   169.00  5.2   1.0   6.2  30.4 392.0    4   5      4       FALSE
#> 9     3.300    25.60 10.9   3.6  14.5  28.0  63.0    1   2      1       FALSE
#> 10   52.160   440.00  8.3   1.4   9.7  50.0 230.0    1   1      1       FALSE
#> 11    0.425     6.40 11.0   1.5  12.5   7.0 112.0    5   4      4       FALSE
#> 12  465.000   423.00  3.2   0.7   3.9  30.0 281.0    5   5      5       FALSE
#> 13    0.550     2.40  7.6   2.7  10.3   7.0  45.0    2   1      2       FALSE
#> 14  187.100   419.00  3.2   0.7   3.1  40.0 365.0    5   5      5       FALSE
#> 15    0.075     1.20  6.3   2.1   8.4   3.5  42.0    1   1      1       FALSE
#> 16    3.000    25.00  8.6   0.0   8.6  50.0  28.0    2   2      2       FALSE
#> 17    0.785     3.50  6.6   4.1  10.7   6.0  42.0    2   2      2       FALSE
#> 18    0.200     5.00  9.5   1.2  10.7  10.4 120.0    2   2      2       FALSE
#> 19    1.410    17.50  4.8   1.3   6.1  34.0 225.0    1   2      1       FALSE
#> 20   60.000    81.00 12.0   6.1  18.1   7.0  35.0    1   1      1       FALSE
#> 21  529.000   680.00  3.2   0.3   3.8  28.0 400.0    5   5      5       FALSE
#> 22   27.660   115.00  3.3   0.5   3.8  20.0 148.0    5   5      5       FALSE
#> 23    0.120     1.00 11.0   3.4  14.4   3.9  16.0    3   1      2       FALSE
#> 24  207.000   406.00  8.3   1.5  12.0  39.3 252.0    1   4      1       FALSE
#> 25   85.000   325.00  4.7   1.5   6.2  41.0 310.0    1   3      1       FALSE
#> 26   36.330   119.50 12.8   2.4  13.0  16.2  63.0    1   1      1       FALSE
#> 27    0.101     4.00 10.4   3.4  13.8   9.0  28.0    5   1      3       FALSE
#> 28    1.040     5.50  7.4   0.8   8.2   7.6  68.0    5   3      4       FALSE
#> 29  521.000   655.00  2.1   0.8   2.9  46.0 336.0    5   5      5       FALSE
#> 30  100.000   157.00 10.9   2.3  10.8  22.4 100.0    1   1      1       FALSE
#> 31   35.000    56.00 11.0   0.9   9.8  16.3  33.0    3   5      4       FALSE
#> 32    0.005     0.14  7.7   1.4   9.1   2.6  21.5    5   2      4       FALSE
#> 33    0.010     0.25 17.9   2.0  19.9  24.0  50.0    1   1      1       FALSE
#> 34   62.000  1320.00  6.1   1.9   8.0 100.0 267.0    1   1      1       FALSE
#> 35    0.122     3.00  8.2   2.4  10.6   9.8  30.0    2   1      1       FALSE
#> 36    1.350     8.10  8.4   2.8  11.2   3.9  45.0    3   1      3       FALSE
#> 37    0.023     0.40 11.9   1.3  13.2   3.2  19.0    4   1      3       FALSE
#> 38    0.048     0.33 10.8   2.0  12.8   2.0  30.0    4   1      3       FALSE
#> 39    1.700     6.30 13.8   5.6  19.4   5.0  12.0    2   1      1       FALSE
#> 40    3.500    10.80 14.3   3.1  17.4   6.5 120.0    2   1      1       FALSE
#> 41  250.000   490.00  3.2   1.0   3.1  23.6 440.0    5   5      5       FALSE
#> 42    0.480    15.50 15.2   1.8  17.0  12.0 140.0    2   2      2       FALSE
#> 43   10.000   115.00 10.0   0.9  10.9  20.2 170.0    4   4      4       FALSE
#> 44    1.620    11.40 11.9   1.8  13.7  13.0  17.0    2   1      2       FALSE
#> 45  192.000   180.00  6.5   1.9   8.4  27.0 115.0    4   4      4       FALSE
#> 46    2.500    12.10  7.5   0.9   8.4  18.0  31.0    5   5      5       FALSE
#> 47    4.288    39.20 11.0   1.8  12.5  13.7  63.0    2   2      2       FALSE
#> 48    0.280     1.90 10.6   2.6  13.2   4.7  21.0    3   1      3       FALSE
#> 49    4.235    50.40  7.4   2.4   9.8   9.8  52.0    1   1      1       FALSE
#> 50    6.800   179.00  8.4   1.2   9.6  29.0 164.0    2   3      2       FALSE
#> 51    0.750    12.30  5.7   0.9   6.6   7.0 225.0    2   2      2       FALSE
#> 52    3.600    21.00  4.9   0.5   5.4   6.0 225.0    3   2      3       FALSE
#> 53   14.830    98.20  3.2   0.7   2.6  17.0 150.0    5   5      5       FALSE
#> 54   55.500   175.00  3.2   0.6   3.8  20.0 151.0    5   5      5       FALSE
#> 55    1.400    12.50 11.0   1.8  11.0  12.7  90.0    2   2      2       FALSE
#> 56    0.060     1.00  8.1   2.2  10.3   3.5  42.0    3   1      2       FALSE
#> 57    0.900     2.60 11.0   2.3  13.3   4.5  60.0    2   1      2       FALSE
#> 58    2.000    12.30  4.9   0.5   5.4   7.5 200.0    3   1      3       FALSE
#> 59    0.104     2.50 13.2   2.6  15.8   2.3  46.0    3   2      2       FALSE
#> 60    4.190    58.00  9.7   0.6  10.3  24.0 210.0    4   3      4       FALSE
#> 61    3.500     3.90 12.8   6.6  19.4   3.0  14.0    2   1      1       FALSE
#> 62    4.050    17.00 13.8   3.9  17.4  13.0  38.0    3   1      1       FALSE
#>    BrainWgt_imp NonD_imp Dream_imp Sleep_imp Span_imp Gest_imp Pred_imp Exp_imp
#> 1         FALSE     TRUE      TRUE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 2         FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 3         FALSE     TRUE      TRUE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 4         FALSE     TRUE      TRUE     FALSE     TRUE    FALSE    FALSE   FALSE
#> 5         FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 6         FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 7         FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 8         FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 9         FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 10        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 11        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 12        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 13        FALSE    FALSE     FALSE     FALSE     TRUE     TRUE    FALSE   FALSE
#> 14        FALSE     TRUE      TRUE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 15        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 16        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 17        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 18        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 19        FALSE    FALSE     FALSE     FALSE    FALSE     TRUE    FALSE   FALSE
#> 20        FALSE    FALSE     FALSE     FALSE    FALSE     TRUE    FALSE   FALSE
#> 21        FALSE     TRUE     FALSE      TRUE    FALSE    FALSE    FALSE   FALSE
#> 22        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 23        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 24        FALSE     TRUE      TRUE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 25        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 26        FALSE     TRUE      TRUE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 27        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 28        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 29        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 30        FALSE     TRUE      TRUE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 31        FALSE     TRUE      TRUE      TRUE    FALSE    FALSE    FALSE   FALSE
#> 32        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 33        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 34        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 35        FALSE    FALSE     FALSE     FALSE     TRUE    FALSE    FALSE   FALSE
#> 36        FALSE    FALSE     FALSE     FALSE     TRUE    FALSE    FALSE   FALSE
#> 37        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 38        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 39        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 40        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 41        FALSE     TRUE     FALSE      TRUE    FALSE    FALSE    FALSE   FALSE
#> 42        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 43        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 44        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 45        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 46        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 47        FALSE     TRUE      TRUE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 48        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 49        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 50        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 51        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 52        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 53        FALSE     TRUE      TRUE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 54        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 55        FALSE     TRUE      TRUE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 56        FALSE    FALSE     FALSE     FALSE    FALSE     TRUE    FALSE   FALSE
#> 57        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 58        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 59        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 60        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 61        FALSE    FALSE     FALSE     FALSE    FALSE    FALSE    FALSE   FALSE
#> 62        FALSE     TRUE      TRUE      TRUE    FALSE    FALSE    FALSE   FALSE
#>    Danger_imp
#> 1       FALSE
#> 2       FALSE
#> 3       FALSE
#> 4       FALSE
#> 5       FALSE
#> 6       FALSE
#> 7       FALSE
#> 8       FALSE
#> 9       FALSE
#> 10      FALSE
#> 11      FALSE
#> 12      FALSE
#> 13      FALSE
#> 14      FALSE
#> 15      FALSE
#> 16      FALSE
#> 17      FALSE
#> 18      FALSE
#> 19      FALSE
#> 20      FALSE
#> 21      FALSE
#> 22      FALSE
#> 23      FALSE
#> 24      FALSE
#> 25      FALSE
#> 26      FALSE
#> 27      FALSE
#> 28      FALSE
#> 29      FALSE
#> 30      FALSE
#> 31      FALSE
#> 32      FALSE
#> 33      FALSE
#> 34      FALSE
#> 35      FALSE
#> 36      FALSE
#> 37      FALSE
#> 38      FALSE
#> 39      FALSE
#> 40      FALSE
#> 41      FALSE
#> 42      FALSE
#> 43      FALSE
#> 44      FALSE
#> 45      FALSE
#> 46      FALSE
#> 47      FALSE
#> 48      FALSE
#> 49      FALSE
#> 50      FALSE
#> 51      FALSE
#> 52      FALSE
#> 53      FALSE
#> 54      FALSE
#> 55      FALSE
#> 56      FALSE
#> 57      FALSE
#> 58      FALSE
#> 59      FALSE
#> 60      FALSE
#> 61      FALSE
#> 62      FALSE
library(laeken)
kNN(sleep, numFun = weightedMean, weightDist=TRUE)
#>     BodyWgt BrainWgt      NonD     Dream     Sleep       Span      Gest Pred
#> 1  6654.000  5712.00  3.621115 1.0244651  3.300000  38.600000 645.00000    3
#> 2     1.000     6.60  6.300000 2.0000000  8.300000   4.500000  42.00000    3
#> 3     3.385    44.50 12.130785 2.7984870 12.500000  14.000000  60.00000    1
#> 4     0.920     5.70 10.011620 2.4135093 16.500000   4.337617  25.00000    5
#> 5  2547.000  4603.00  2.100000 1.8000000  3.900000  69.000000 624.00000    3
#> 6    10.550   179.50  9.100000 0.7000000  9.800000  27.000000 180.00000    4
#> 7     0.023     0.30 15.800000 3.9000000 19.700000  19.000000  35.00000    1
#> 8   160.000   169.00  5.200000 1.0000000  6.200000  30.400000 392.00000    4
#> 9     3.300    25.60 10.900000 3.6000000 14.500000  28.000000  63.00000    1
#> 10   52.160   440.00  8.300000 1.4000000  9.700000  50.000000 230.00000    1
#> 11    0.425     6.40 11.000000 1.5000000 12.500000   7.000000 112.00000    5
#> 12  465.000   423.00  3.200000 0.7000000  3.900000  30.000000 281.00000    5
#> 13    0.550     2.40  7.600000 2.7000000 10.300000  12.348960  47.75702    2
#> 14  187.100   419.00  3.370754 0.7184306  3.100000  40.000000 365.00000    5
#> 15    0.075     1.20  6.300000 2.1000000  8.400000   3.500000  42.00000    1
#> 16    3.000    25.00  8.600000 0.0000000  8.600000  50.000000  28.00000    2
#> 17    0.785     3.50  6.600000 4.1000000 10.700000   6.000000  42.00000    2
#> 18    0.200     5.00  9.500000 1.2000000 10.700000  10.400000 120.00000    2
#> 19    1.410    17.50  4.800000 1.3000000  6.100000  34.000000 173.78512    1
#> 20   60.000    81.00 12.000000 6.1000000 18.100000   7.000000  48.10889    1
#> 21  529.000   680.00  3.389039 0.3000000  3.496601  28.000000 400.00000    5
#> 22   27.660   115.00  3.300000 0.5000000  3.800000  20.000000 148.00000    5
#> 23    0.120     1.00 11.000000 3.4000000 14.400000   3.900000  16.00000    3
#> 24  207.000   406.00  7.930240 2.0051906 12.000000  39.300000 252.00000    1
#> 25   85.000   325.00  4.700000 1.5000000  6.200000  41.000000 310.00000    1
#> 26   36.330   119.50 12.140941 2.8012782 13.000000  16.200000  63.00000    1
#> 27    0.101     4.00 10.400000 3.4000000 13.800000   9.000000  28.00000    5
#> 28    1.040     5.50  7.400000 0.8000000  8.200000   7.600000  68.00000    5
#> 29  521.000   655.00  2.100000 0.8000000  2.900000  46.000000 336.00000    5
#> 30  100.000   157.00 10.628498 2.3640501 10.800000  22.400000 100.00000    1
#> 31   35.000    56.00 10.683888 0.8764794 10.005650  16.300000  33.00000    3
#> 32    0.005     0.14  7.700000 1.4000000  9.100000   2.600000  21.50000    5
#> 33    0.010     0.25 17.900000 2.0000000 19.900000  24.000000  50.00000    1
#> 34   62.000  1320.00  6.100000 1.9000000  8.000000 100.000000 267.00000    1
#> 35    0.122     3.00  8.200000 2.4000000 10.600000  10.833181  30.00000    2
#> 36    1.350     8.10  8.400000 2.8000000 11.200000   3.673929  45.00000    3
#> 37    0.023     0.40 11.900000 1.3000000 13.200000   3.200000  19.00000    4
#> 38    0.048     0.33 10.800000 2.0000000 12.800000   2.000000  30.00000    4
#> 39    1.700     6.30 13.800000 5.6000000 19.400000   5.000000  12.00000    2
#> 40    3.500    10.80 14.300000 3.1000000 17.400000   6.500000 120.00000    2
#> 41  250.000   490.00  4.234588 1.0000000  3.261678  23.600000 440.00000    5
#> 42    0.480    15.50 15.200000 1.8000000 17.000000  12.000000 140.00000    2
#> 43   10.000   115.00 10.000000 0.9000000 10.900000  20.200000 170.00000    4
#> 44    1.620    11.40 11.900000 1.8000000 13.700000  13.000000  17.00000    2
#> 45  192.000   180.00  6.500000 1.9000000  8.400000  27.000000 115.00000    4
#> 46    2.500    12.10  7.500000 0.9000000  8.400000  18.000000  31.00000    5
#> 47    4.288    39.20 10.951784 2.2373985 12.500000  13.700000  63.00000    2
#> 48    0.280     1.90 10.600000 2.6000000 13.200000   4.700000  21.00000    3
#> 49    4.235    50.40  7.400000 2.4000000  9.800000   9.800000  52.00000    1
#> 50    6.800   179.00  8.400000 1.2000000  9.600000  29.000000 164.00000    2
#> 51    0.750    12.30  5.700000 0.9000000  6.600000   7.000000 225.00000    2
#> 52    3.600    21.00  4.900000 0.5000000  5.400000   6.000000 225.00000    3
#> 53   14.830    98.20  3.859326 0.6952781  2.600000  17.000000 150.00000    5
#> 54   55.500   175.00  3.200000 0.6000000  3.800000  20.000000 151.00000    5
#> 55    1.400    12.50 10.928583 2.2379005 11.000000  12.700000  90.00000    2
#> 56    0.060     1.00  8.100000 2.2000000 10.300000   3.500000  38.62720    3
#> 57    0.900     2.60 11.000000 2.3000000 13.300000   4.500000  60.00000    2
#> 58    2.000    12.30  4.900000 0.5000000  5.400000   7.500000 200.00000    3
#> 59    0.104     2.50 13.200000 2.6000000 15.800000   2.300000  46.00000    3
#> 60    4.190    58.00  9.700000 0.6000000 10.300000  24.000000 210.00000    4
#> 61    3.500     3.90 12.800000 6.6000000 19.400000   3.000000  14.00000    2
#> 62    4.050    17.00 13.542726 4.5441878 18.060387  13.000000  38.00000    3
#>    Exp Danger BodyWgt_imp BrainWgt_imp NonD_imp Dream_imp Sleep_imp Span_imp
#> 1    5      3       FALSE        FALSE     TRUE      TRUE     FALSE    FALSE
#> 2    1      3       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 3    1      1       FALSE        FALSE     TRUE      TRUE     FALSE    FALSE
#> 4    2      3       FALSE        FALSE     TRUE      TRUE     FALSE     TRUE
#> 5    5      4       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 6    4      4       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 7    1      1       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 8    5      4       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 9    2      1       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 10   1      1       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 11   4      4       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 12   5      5       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 13   1      2       FALSE        FALSE    FALSE     FALSE     FALSE     TRUE
#> 14   5      5       FALSE        FALSE     TRUE      TRUE     FALSE    FALSE
#> 15   1      1       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 16   2      2       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 17   2      2       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 18   2      2       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 19   2      1       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 20   1      1       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 21   5      5       FALSE        FALSE     TRUE     FALSE      TRUE    FALSE
#> 22   5      5       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 23   1      2       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 24   4      1       FALSE        FALSE     TRUE      TRUE     FALSE    FALSE
#> 25   3      1       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 26   1      1       FALSE        FALSE     TRUE      TRUE     FALSE    FALSE
#> 27   1      3       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 28   3      4       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 29   5      5       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 30   1      1       FALSE        FALSE     TRUE      TRUE     FALSE    FALSE
#> 31   5      4       FALSE        FALSE     TRUE      TRUE      TRUE    FALSE
#> 32   2      4       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 33   1      1       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 34   1      1       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 35   1      1       FALSE        FALSE    FALSE     FALSE     FALSE     TRUE
#> 36   1      3       FALSE        FALSE    FALSE     FALSE     FALSE     TRUE
#> 37   1      3       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 38   1      3       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 39   1      1       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 40   1      1       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 41   5      5       FALSE        FALSE     TRUE     FALSE      TRUE    FALSE
#> 42   2      2       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 43   4      4       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 44   1      2       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 45   4      4       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 46   5      5       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 47   2      2       FALSE        FALSE     TRUE      TRUE     FALSE    FALSE
#> 48   1      3       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 49   1      1       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 50   3      2       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 51   2      2       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 52   2      3       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 53   5      5       FALSE        FALSE     TRUE      TRUE     FALSE    FALSE
#> 54   5      5       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 55   2      2       FALSE        FALSE     TRUE      TRUE     FALSE    FALSE
#> 56   1      2       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 57   1      2       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 58   1      3       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 59   2      2       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 60   3      4       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 61   1      1       FALSE        FALSE    FALSE     FALSE     FALSE    FALSE
#> 62   1      1       FALSE        FALSE     TRUE      TRUE      TRUE    FALSE
#>    Gest_imp Pred_imp Exp_imp Danger_imp
#> 1     FALSE    FALSE   FALSE      FALSE
#> 2     FALSE    FALSE   FALSE      FALSE
#> 3     FALSE    FALSE   FALSE      FALSE
#> 4     FALSE    FALSE   FALSE      FALSE
#> 5     FALSE    FALSE   FALSE      FALSE
#> 6     FALSE    FALSE   FALSE      FALSE
#> 7     FALSE    FALSE   FALSE      FALSE
#> 8     FALSE    FALSE   FALSE      FALSE
#> 9     FALSE    FALSE   FALSE      FALSE
#> 10    FALSE    FALSE   FALSE      FALSE
#> 11    FALSE    FALSE   FALSE      FALSE
#> 12    FALSE    FALSE   FALSE      FALSE
#> 13     TRUE    FALSE   FALSE      FALSE
#> 14    FALSE    FALSE   FALSE      FALSE
#> 15    FALSE    FALSE   FALSE      FALSE
#> 16    FALSE    FALSE   FALSE      FALSE
#> 17    FALSE    FALSE   FALSE      FALSE
#> 18    FALSE    FALSE   FALSE      FALSE
#> 19     TRUE    FALSE   FALSE      FALSE
#> 20     TRUE    FALSE   FALSE      FALSE
#> 21    FALSE    FALSE   FALSE      FALSE
#> 22    FALSE    FALSE   FALSE      FALSE
#> 23    FALSE    FALSE   FALSE      FALSE
#> 24    FALSE    FALSE   FALSE      FALSE
#> 25    FALSE    FALSE   FALSE      FALSE
#> 26    FALSE    FALSE   FALSE      FALSE
#> 27    FALSE    FALSE   FALSE      FALSE
#> 28    FALSE    FALSE   FALSE      FALSE
#> 29    FALSE    FALSE   FALSE      FALSE
#> 30    FALSE    FALSE   FALSE      FALSE
#> 31    FALSE    FALSE   FALSE      FALSE
#> 32    FALSE    FALSE   FALSE      FALSE
#> 33    FALSE    FALSE   FALSE      FALSE
#> 34    FALSE    FALSE   FALSE      FALSE
#> 35    FALSE    FALSE   FALSE      FALSE
#> 36    FALSE    FALSE   FALSE      FALSE
#> 37    FALSE    FALSE   FALSE      FALSE
#> 38    FALSE    FALSE   FALSE      FALSE
#> 39    FALSE    FALSE   FALSE      FALSE
#> 40    FALSE    FALSE   FALSE      FALSE
#> 41    FALSE    FALSE   FALSE      FALSE
#> 42    FALSE    FALSE   FALSE      FALSE
#> 43    FALSE    FALSE   FALSE      FALSE
#> 44    FALSE    FALSE   FALSE      FALSE
#> 45    FALSE    FALSE   FALSE      FALSE
#> 46    FALSE    FALSE   FALSE      FALSE
#> 47    FALSE    FALSE   FALSE      FALSE
#> 48    FALSE    FALSE   FALSE      FALSE
#> 49    FALSE    FALSE   FALSE      FALSE
#> 50    FALSE    FALSE   FALSE      FALSE
#> 51    FALSE    FALSE   FALSE      FALSE
#> 52    FALSE    FALSE   FALSE      FALSE
#> 53    FALSE    FALSE   FALSE      FALSE
#> 54    FALSE    FALSE   FALSE      FALSE
#> 55    FALSE    FALSE   FALSE      FALSE
#> 56     TRUE    FALSE   FALSE      FALSE
#> 57    FALSE    FALSE   FALSE      FALSE
#> 58    FALSE    FALSE   FALSE      FALSE
#> 59    FALSE    FALSE   FALSE      FALSE
#> 60    FALSE    FALSE   FALSE      FALSE
#> 61    FALSE    FALSE   FALSE      FALSE
#> 62    FALSE    FALSE   FALSE      FALSE