Heading: 'Heading' pseudo-function

Description Usage Arguments Details Pseudo-functions Examples

View source: R/pseudo.R

Description

The Heading pseudo-function normally overrides the automatic heading on the following items in a table. Setting override=FALSE is used in automatically generated expressions.

Usage

1
Heading(name = NULL, override = TRUE, character.only = FALSE, nearData = TRUE)

Arguments

name

A legal R variable name, or a character constant.

override

Whether this heading should override one that is already present.

character.only

If TRUE, the name argument will be interpreted as an expression evaluating to a character value.

nearData

See Details below.

Details

This replaces the automatic heading or row label on the following item with the name or string as specified. If no argument is given, the heading or label is suppressed.

An alternative form of Heading(name) is (name=...), where ... is an expression to be displayed in the table.

If override = FALSE, the label is only supplied if there is no other label. This is used in the code for Factor.

The nearData argument is rarely used. It affects the situation where "+" is used to join tables with different numbers of labels. If nearData = TRUE (the default), the shorter list of labels are pushed close to the data, i.e. to the right side for row labels, the bottom for column labels. If FALSE, they are pushed to the opposite side.

Pseudo-functions

This is a “pseudo-function”: it takes the form of a function call, but is never actually called: it is handled specially by tabular.

Examples

1
2
3
4
5
6
7
tabular( (Sepal.Length+Sepal.Width) ~ 
         (Heading(Mean)*mean + (S.D.=sd)), data=iris )

heading <- "Variable Heading"
tabular( (Sepal.Length+Sepal.Width) ~ 
         (Heading(heading, character.only = TRUE)*mean + (S.D.=sd)), 
         data=iris )

Example output

Loading required package: Hmisc
Loading required package: lattice
Loading required package: survival
Loading required package: Formula
Loading required package: ggplot2

Attaching package: 'Hmisc'

The following objects are masked from 'package:base':

    format.pval, round.POSIXt, trunc.POSIXt, units

                          
              Mean  S.D.  
 Sepal.Length 5.843 0.8281
 Sepal.Width  3.057 0.4359
                                     
              Variable Heading S.D.  
 Sepal.Length 5.843            0.8281
 Sepal.Width  3.057            0.4359

tables documentation built on Nov. 17, 2017, 7:50 a.m.