Thanks to visit codestin.com
Credit goes to github.com

Skip to content

createDummyFeatures gives wrong and unconsistant names used with two factor levels #2814

@Sade154

Description

@Sade154

Description

createDummyFeatures gives wrong and unconsistant names used with two factor levels.

Reproducible example

d <- structure(list(
  a = structure(c(2L, 1L, 1L, 1L, 3L, 2L), .Label = c("1", "2", "3"), class = "factor"),
  b = structure(c(2L, 1L, 1L, 1L, 1L, 2L), .Label = c("1", "2"), class = "factor"),
  target = structure(c(1L, 1L, 1L, 2L, 2L, 2L), .Label = c("zero", "one"), class = "factor")),
  row.names = c(NA, -6L),
  class = "data.frame")

# the variable a becomes a.2 and a.3 when dummified but the variable b becomes X2 (instead of an expected b.2)

mlr::createDummyFeatures(d, target = "target", method = "reference")

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions