decodeCharColumns: Decode character columns.

Description Usage Arguments Details Value Examples

View source: R/encodeCharColumns.R

Description

Decode a subset of character columns which were encoded using base64 encoding.

Usage

1
decodeCharColumns(df, columnNames)

Arguments

df

A dataframe

columnNames

The columns which are to be decoded. If NULL, 'encodedColumnNames' attribute is checked. It is advised not to leave it NULL.

Details

Texual data in dataframes with comman seperators like ',' create problems writing to disk and reading back. The function 'encodeCharCols' encodes the a subset of character columns using base64 encoding where the resulting dataframe might be written to disk with ',' separator. The function 'decodeCharCols' decodes the encoded character columns are restores back the actual character columns.

Value

A dataframe

Examples

1
2
3
4
5
6
7
8
iris2 <- iris
iris2$Species <- as.character(iris2$Species)
iris_enc <- encodeCharColumns(iris2)
iris_enc
unique(iris_enc$Species)
iris_dec <- decodeCharColumns(iris_enc, "Species")
iris_dec
all.equal(iris_dec, iris2)

talegari/sidekicks documentation built on Sept. 26, 2018, 4:18 p.m.