R/extract_names.R

Defines functions extract_names

Documented in extract_names

#' Extraction of names of the variables
#'
#' The function extracts the names of the variables from the data set used in the analysis and
#' places them in a vector.
#'
#'
#' @param df Data frame with data for the analysis.
#'
#' @return A vector with names of the variables.
#'
#' @export
#'
#' @examples
#' \donttest{
#'  df <- badp::economic_growth
#'
#'  reg_names <- extract_names(df)
#'
#' }
#' @keywords internal
extract_names <- function(df){
  reg_names <- colnames(df)
  reg_names <- reg_names[-(1:2)]
  reg_names[1] <- paste0(reg_names[1], "_lag")

  return(reg_names)
}

Try the badp package in your browser

Any scripts or data that you put into this service are public.

badp documentation built on Aug. 20, 2026, 9:08 a.m.