Learn R Programming

yamlet (version 0.7.7)

as.integer.classified: Coerce Classified to Integer

Description

Coerces classified to integer. Result is like as.integer(as.numeric(x)) + offset but has a codelist giving original values. If you need a simple integer, consider coercing first to numeric.

Usage

# S3 method for classified
as.integer(x, offset = 0L, ...)

Arguments

x

classified, see classified

offset

an integer value to add to intermediate result

...

ignored

Value

integer

See Also

Other classified: [.classified(), [<-.classified(), [[.classified(), [[<-.classified(), c.classified(), classified.data.frame(), classified.default(), classified(), unclassified.classified(), unclassified.data.frame(), unclassified()

Examples

Run this code
# NOT RUN {
library(magrittr)
classified(c('knife','fork','spoon'))
classified(c('knife','fork','spoon')) %>% as.numeric
classified(c('knife','fork','spoon')) %>% as.integer
classified(c('knife','fork','spoon')) %>% as.integer(-1)

# }

Run the code above in your browser using DataLab