replace_nominal_attributes: Replace nominal attributes Replace the nominal attributes by...

Description Usage Arguments Value See Also Examples

View source: R/pre_process.R

Description

Replace nominal attributes Replace the nominal attributes by binary attributes.

Usage

1
replace_nominal_attributes(mdata, ordinal.attributes = list())

Arguments

mdata

The mldr dataset to remove.

ordinal.attributes

Not yet, but it will be used to specify which attributes need to be replaced.

Value

a new mldr object.

See Also

Other pre process: fill_sparse_mldata(), normalize_mldata(), remove_attributes(), remove_labels(), remove_skewness_labels(), remove_unique_attributes(), remove_unlabeled_instances()

Examples

1
2
3
4
new.toy <- toyml
new.column <- as.factor(sample(c("a","b","c"), 100, replace = TRUE))
new.toy$dataset$ratt10 <- new.column
head(replace_nominal_attributes(new.toy))

Example output

Loading required package: mldr
Loading required package: parallel
Loading required package: ROCR
Loading required package: gplots

Attaching package: 'gplots'

The following object is masked from 'package:stats':

    lowess

       att1      att2      att3      att4     att5      att6      att7
1 -0.150258  0.000461  0.237302  0.004333 0.086273  0.611953 -0.040632
2  0.219093  0.023877  0.038309 -0.041287 0.013978  0.277978  0.147673
3  0.137491  0.042125  0.011613  0.066545 0.388947 -0.312591 -0.163133
4 -0.318716 -0.054081  0.005198  0.085436 0.660657  0.011783  0.096005
5  0.004815  0.659007  0.023343 -0.135839 0.063470 -0.207688  0.091519
6  0.336280 -0.140629 -0.032099 -0.365930 0.004982  0.124665 -0.133950
      iatt8     iatt9 ratt10_a ratt10_b y1 y2 y3 y4 y5
1 -0.215861  0.447483        1        0  1  1  0  1  0
2 -0.592199 -0.164926        0        0  1  1  0  1  0
3 -0.426994 -0.564884        0        0  1  1  0  1  0
4 -0.526278  0.505936        1        0  1  1  0  0  1
5  0.170262  0.389038        0        0  1  1  0  0  0
6  0.652938  0.961077        0        1  1  1  0  0  0

utiml documentation built on May 31, 2021, 9:09 a.m.