unmake_names {clinpubr}R Documentation

Unmake names

Description

Inverse function of make.names. You can use make.names to make colnames legal for subsequent processing and analysis in R. Then use this function to switch back for publication.

Usage

unmake_names(x, ori_names)

Arguments

x

A vector of names generated by base::make.names().

ori_names

A vector of original names.

Details

The function will try to match the names in x with the names in ori_names. If the names in x are not in ori_names, the function will return NA.

Value

A vector of original names.

Examples

ori_names <- c("xx (mg/dl)", "b*x", "Covid-19")
x <- c(make.names(ori_names), "aa")
unmake_names(x, ori_names)

[Package clinpubr version 1.0.1 Index]