map_fields: Map field values from one column into new derived columns...

Description Usage Arguments Value Examples

View source: R/map_fields.R

Description

Map field values from one column into new derived columns (takes a data.frame).

Usage

1
map_fields(d, cname, m)

Arguments

d

name of table to re-map.

cname

name of column to re-map.

m

name of table of data describing the mapping (cname column is source, derived columns are destinations).

Value

re-mapped table

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
d <- data.frame(what = c("acc", "loss",
                         "val_acc", "val_loss"),
                score = c(0.8, 1.2,
                       0.7, 1.7),
                stringsAsFactors = FALSE)
m <- data.frame(what = c("acc", "loss",
                         "val_acc", "val_loss"),
                measure = c("accuracy", "log-loss",
                            "accuracy", "log-loss"),
                dataset = c("train", "train", "validation", "validation"),
                stringsAsFactors = FALSE)
map_fields(d, 'what', m)

cdata documentation built on June 12, 2021, 9:06 a.m.