write.univ: Write Univariate Table to a File

Description Usage Arguments Examples

View source: R/write.univ.R

Description

Write the output of univ to a file

Usage

1
2
3
4
5
write.univ(x, round = 1, Factor = TRUE, Group = FALSE, N = TRUE,
  Missing = FALSE, Mean = TRUE, SD = TRUE, LCL = FALSE, UCL = FALSE,
  Min = TRUE, P25 = TRUE, Median = TRUE, P75 = TRUE, Max = TRUE,
  CV = FALSE, Pval = FALSE, pvalFormat = "default", pvalArgs = list(),
  cat = getOption("lazyWeave_cat"), ...)

Arguments

x

An object of type univ.

round

Number of significant digits to be printed.

Factor

Determines if the Factor (variable) description is printed.

Group

Determines if the Group is printed

N

Determines if the number of non missing values is printed

Missing

Determines if the number of missing values is printed

Mean

Determines if the mean is printed

SD

Determines if the standard deviation is printed

LCL

Determines if the lower confidence limit is printed

UCL

Determines if the upper confidence limit is printed

Min

Determines if the minimum value is printed

P25

Determines if the 25th percentile is printed

Median

Determines if the median value is printed

P75

Determines if the 75th percentile is printed

Max

Determines if the maximum value is printed

CV

Determines if the coefficient of variation is printed

Pval

Determines if the p-value is printed

pvalFormat

Character string passed to pvalString and determines the pvalue style to be printed.

pvalArgs

A list of additional arguments to be passed to pvalString

cat

Logical. Determines if the output is returned as a character string or returned via the cat function (printed to console). The default value is set by options()$lazyWeave_cat. This argument allows for selective override of the default.

...

additional arguments to be passed to lazy.matrix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#output will be written to the working directory
getwd()

#write.univ function must be written to either a LaTeX
#or HTML file.  HTML format is through the lazyHTML package.
options(lazyReportFormat="html")

#Delivery dataset from CCFmisc library
data(Delivery)

#label the variables that will be used
Delivery$maternal.age <- 
  labelVector::set_label(Delivery$maternal.age, "Maternal Age")
Delivery$ga.weeks <- 
  labelVector::set_label(Delivery$ga.weeks, "Gestation weeks")
Delivery$wt.gram <- 
  labelVector::set_label(Delivery$wt.gram, "Weight (g)")

#summaries of the continuous variables
#maternal.age, ga.weeks and wt.gram in the 
#Delivery dataset.
deliv.uni <- univ(Delivery,
                  vars=c("maternal.age", "ga.weeks", "wt.gram")
)

#summaries of continuous variables
#by level of delivery.type
delivBy.uni <- univ(Delivery,
                    vars=c("maternal.age", "ga.weeks", "wt.gram"),
                    byVar="delivery.type"
)

#to write univ based table to an HTML file enclose the
#write.univ() in the html_write function as below.
#see documentation for other options.

#To print byVariable group names in the table, 
#set the Group=T flag in the write.univ() function.

## Not run: 
lazy.write(
    lazy.file.start(),
    write.univ(deliv.uni),
    write.univ(delivBy.uni, Group=TRUE),
    lazy.file.end(),
    OutFile="ExampleFile.html"
  )
  
  unlink("ExampleFile.html")

## End(Not run)

nutterb/lazyWeave documentation built on May 24, 2019, 10:52 a.m.