encodeSO: Encode numerical vector using given encoding

Description Usage Arguments Value Author(s) See Also Examples

View source: R/clamix12_05.R

Description

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

Usage

1
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

1
2
3
4
5
6
7
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)

clamix documentation built on May 2, 2019, 4:51 p.m.