Learn R Programming

edpclient (version 0.5.1)

display_name: Display Names

Description

Get or set display names of columns on a data frame

Usage

display_name(col)
display_name(col) <- value
display_names(data)
display_names(data) <- value

Arguments

col

a column in a data frame

data

a data frame

value

a character vector

Value

display_name returns a single-element character-vector. display_names returns a character vector with as many elements as the data frame has columns. If a column has no display name set, the corresponding element will be NA.

Details

In EDP, columns in a population can have "display names," which are human-readable names, often longer than the regular names. display_name and display_name<- get and set these on a single column. display_names and display_names<- get and set them on all columns of a data frame at once. The setters are used when preparing a data frame to build a population from. The getters can be applied to results from select and simulate.

Examples

Run this code
# NOT RUN {
  d <- data.frame(inc = c(25, NA, 17), age = c(21, 70, 30))
  display_name(d$inc) <- "income (thousands of USD)"
  dn <- display_names(d)  # returns c(inc = "income (thousands of USD)", age = NA)
  
# }

Run the code above in your browser using DataLab