Learn R Programming

AlphaPart (version 0.9.8)

mapLevels: Mapping levels

Description

mapLevels produces a map with information on levels and/or internal integer codes. As such can be conveniently used to store level mapping when one needs to work with internal codes of a factor and later transfrorm back to factor or when working with several factors that should have the same levels and therefore the same internal coding.

Usage

mapLevels(x, codes=TRUE, sort=TRUE, drop=FALSE, combine=FALSE, ...)

mapLevels(x) <- value

# S3 method for default mapLevels(x, codes, sort, drop, combine, ...)

# S3 method for character mapLevels(x, codes, sort, drop, combine, ...)

# S3 method for factor mapLevels(x, codes, sort, drop, combine, ...)

# S3 method for list mapLevels(x, codes, sort, drop, combine, ...)

# S3 method for data.frame mapLevels(x, codes, sort, drop, combine, ...)

.unlistLevelsMap(x, ind = FALSE)

# S3 method for levelsMap print(x, ...)

# S3 method for listLevelsMap print(x, ...)

# S3 method for levelsMap [(x, i)

# S3 method for listLevelsMap [(x, i)

is.levelsMap(x)

is.listLevelsMap(x)

.isCharacterMap(x)

as.levelsMap(x, check = TRUE, ...)

as.listLevelsMap(x, check = TRUE)

.checkLevelsMap(x, method)

.checkListLevelsMap(x, method)

# S3 method for levelsMap c(..., sort = TRUE, recursive = FALSE)

# S3 method for listLevelsMap c(..., sort = TRUE, recursive = FALSE)

# S3 method for levelsMap sort(x, decreasing = FALSE, na.last = TRUE, ...)

# S3 method for levelsMap unique(x, incomparables = FALSE, ...)

mapLevels(x) <- value

# S3 method for default mapLevels(x) <- value

# S3 method for list mapLevels(x) <- value

# S3 method for data.frame mapLevels(x) <- value

Arguments

x

object whose levels will be mapped, look into details codes boolean, create integer levelsMap (with internal codes) or character levelsMap (with level names)

codes

boolean, create integer levelsMap (with internal codes) or character levelsMap (with level names)

sort

boolean, sort levels of character x, look into details

drop

boolean, drop unused levels

combine

boolean, combine levels, look into details

...

additional arguments for sort

value

levelsMap or listLevelsMap, output of mapLevels methods or constructed by user, look into details

Author

Gregor Gorjanc

See Also

AlphaPart