make_xname: Creates the model specifications for xname

View source: R/make_xname.R

make_xnameR Documentation

Creates the model specifications for xname

Description

Creates the model specifications for xname

Usage

make_xname(yname, xnames, user_model, current_age, hat = NULL)

Arguments

yname

String indicating the dependent variable

xnames

Character vector of available names to choose from. It is assumed all variables named in xnames have complete data. Any brokenstick variable should have names like paste(yname, d, sep = "_"), where d is a vector contuining decimal ages.

user_model

Model number (1-4), indicating type of model the user wants. See details.

current_age

Current age (in decimal years)

hat

A list with brokenstick prediction for the target that contains the names of the brokenstick proedictions. The entry is NULL if these estimates cannot be made. In that case, this function does not include the previous yname scores into the matching.

Value

A character vector with the xname specification

Examples

xnames <- c(
  "sex", "ga", "bw", "hgt_0", "hgt_1", "hgt_3",
  "wgt_0", "wgt_1", "wgt_2", "junk"
)

# note that it does not return hgt2
chartplotter:::make_xname(
  yname = "hgt", xnames = xnames, user_model = 2,
  current_age = 2
)

growthcharts/chartplotter documentation built on May 12, 2024, 8:43 a.m.