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

View source: R/map_fields.R

map_fieldsR Documentation

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

Description

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

Usage

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


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 Aug. 20, 2023, 1:06 a.m.