make_refcode: Make reference code from components

View source: R/make_refcode.R

make_refcodeR Documentation

Make reference code from components

Description

This function creates reference codes by pasting name, year, yname, sex and sub fields. The result is a string that identifies the reference.

Usage

make_refcode(name = "", year = "", yname = "", sex = "", sub = "")

Arguments

name

Character vector identifying the reference name field

year

Character vector identifying the reference year field

yname

Character vector identifying the reference yname field

sex

Character vector identifying the reference sex field

sub

Character vector identifying the reference sub field

Value

A character vector with n elements, where n equals the longest vector in the input arguments.

Note

The function silently converts any zero-length arguments to length 1. The procedure aborts with an error if the length of any input is unequal to either 1 or n.

Examples

data <- data.frame(hgt = c(56, 42, 53),
                   age = c(0.1, 0.2, 0.15),
                   sex = c("male", "female", "female"),
                   ga = c(40, 27, 39))
r <- make_refcode("who", "2006", "hgt", data$sex)
r
head(load_reference(r))
head(load_reference(r, "study"))
head(load_reference(r[2]))
head(load_reference(r[2], "study"))

growthcharts/centile documentation built on May 8, 2024, 9:25 a.m.