Encode and decode character and numeric values.

encode(x, ...)

decode(x, ...)

# S3 method for default
encode(x, ...)

# S3 method for d_label
encode(x, ...)

# S3 method for default
decode(x, ...)

# S3 method for d_label
decode(x, ...)

# S3 method for d_label
rep(x, ...)

# S3 method for d_label
[(x, i, ..., drop = TRUE)

# S3 method for d_label
[[(x, i, ..., drop = TRUE)

Arguments

x

[d_label|atomic]

...

Other arguments.

i

i

drop

drop

Value

d_label; atomic

Details

To minimise memory usage, most components of pid, epid and pane are integer objects with labels. encode() and decode() translates these codes and labels as required.

Examples

cds <- encode(rep(LETTERS[1:5], 3))
cds
#>  [1] 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
#> attr(,"class")
#> [1] "d_label"
#> attr(,"value")
#> [1] 1 2 3 4 5
#> attr(,"label")
#> [1] "A" "B" "C" "D" "E"
#> attr(,"state")
#> [1] "encoded"

nms <- decode(cds)
nms
#>  [1] "A" "B" "C" "D" "E" "A" "B" "C" "D" "E" "A" "B" "C" "D" "E"
#> attr(,"class")
#> [1] "d_label"
#> attr(,"value")
#> [1] 1 2 3 4 5
#> attr(,"label")
#> [1] "A" "B" "C" "D" "E"
#> attr(,"state")
#> [1] "decoded"