Learn R Programming

lavaan (version 0.7-2)

lav_label_code: Provides a formatted label for use in tikz, svg or Rplot

Description

Creates the code used to show the label in tikz, svg or R. The label is plotted in an xy-plot if show = TRUE.

Usage

lav_label_code(label = "", value = "", show =FALSE,
               idx_font_size = 20L, dy = 7L,
               italic = TRUE, auto_subscript = TRUE)

Value

a list with members svg, tikz and r, giving the result.

Arguments

label

A character string in one of the formats

  • name

  • name_index

  • name=value

  • name_index=value

If value is specified in parameter label and parameter value is empty, the value in label will be used.

value

A character string specifying a value or empty.

show

A logical indicating that the result should be plotted in an Rplot.

idx_font_size

An integer specifying font size to use for the subscript in svg.

dy

An integer specifying the distance to move the baseline of the subscript in svg.

italic

A logical indicating whether the label's font should be italic. Only used for tikz output and in the displayed Rplot when the result is not an expression.

auto_subscript

Logical, if TRUE and label starts with one or more alphabetic chars followed by one or more digits, an underscore will be inserted between these parts.

Details

If both label and value are empty, the resulting codes are also empty and nothing will be shown.

If label is empty and value is not, processing is done as if label was specified and value was empty.

If label contains the string "1van", the label value is set to "1". This allows distinct names for regression intercepts while still labeling them as "1".

If name in label is a Greek character or varepsilon, the function attempts to generate code that shows the Greek symbol. If label contains an index part, the function attempts to generate code that displays this value as a subscript. In the svg code, the values idx_font_size and dy are used for the subscript. If a value is present, the function attempts to show this value after the label, with an equal sign between the two.

Examples

Run this code
lav_label_code("x3")
lav_label_code("beta10", 0.65, show = TRUE)
lav_label_code("A_i,j=0.45", show = TRUE)
lav_label_code("Gamma")
lav_label_code(value="1.2345")

Run the code above in your browser using DataLab