Parse a mapping specification

map_names(x, mapping)

parse_mapping(mapping)

Arguments

x

a data.frame with un-mapped columns (in the form "n01", "n02", etc.).

mapping

an EcoTaxa mapping string (see examples).

Examples

d <- data.frame(id=c(1234, 1235), n01=c(12,34), n02=c(125,156)) mapping <- "n01=area\nn02=mean\nn03=stddev" map_names(d, mapping)
#> id area mean #> 1 1234 12 125 #> 2 1235 34 156
parse_mapping(mapping)
#> area mean stddev #> "n01" "n02" "n03"