encodeSO {clamix}R Documentation

Encode numerical vector using given encoding

Description

Function encodes numerical vector using given encoding. Encoding could be obtained by function makeEnc.

Usage

encodeSO(x, encoding, codeNA)

Arguments

x

number

encoding

function name to produce the encoding. See result of makeEnc.

codeNA

code (or number) for NA.

Value

Returns category into which the number x is encoded.

Author(s)

Vladimir Batagelj

See Also

makeEnc

Examples

set.seed(42)
testset <- runif(100)
makeEnc(testset,"Rand",10,file="temp.R") # make "encRand" encoding
source("temp.R")
unlink("temp.R") # tidy up
testcat <- sapply(testset,function(x) encodeSO(x,encRand,NA))
tabulate(testcat)



[Package clamix version 1.03 Index]