prettify: Function to prettify the output of another function using a...

Description Usage Arguments Value Examples

View source: R/Rfunctions.R

Description

Function to prettify the output of another function using a 'var.labels' attribute This is particularly useful in combination with read.dta et al.

Usage

1
  prettify(dat, expr)

Arguments

dat

A data.frame with attr 'var.labels' giving descriptions of variables

expr

An expression to evaluate with pretty var.labels

Value

The result of the expression, with variable names replaced with their labels

Examples

1
2
3
testDF <- data.frame( a=seq(10),b=runif(10),c=rnorm(10) )
attr(testDF,"var.labels") <- c("Identifier","Important Data","Lies, Damn Lies, Statistics")
prettify( testDF, quote(str(dat)) )

Example output

'data.frame':	10 obs. of  3 variables:
 $ Identifier                 : int  1 2 3 4 5 6 7 8 9 10
 $ Important Data             : num  0.771 0.246 0.539 0.685 0.564 ...
 $ Lies, Damn Lies, Statistics: num  0.325 0.819 -2.348 -1.012 -0.519 ...

taRifx documentation built on April 14, 2020, 6:27 p.m.

Related to prettify in taRifx...