~ubuntu-branches/ubuntu/wily/r-cran-gridextra/wily

« back to all changes in this revision

Viewing changes to man/tableGrob.Rd

  • Committer: Package Import Robot
  • Author(s): Dirk Eddelbuettel
  • Date: 2015-02-17 20:33:07 UTC
  • Revision ID: package-import@ubuntu.com-20150217203307-jhqvs3dxkl5gyhqt
Tags: upstream-0.9-1
ImportĀ upstreamĀ versionĀ 0.9-1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
\name{tableGrob}
 
2
\alias{arrangeTableGrobs}
 
3
\alias{drawDetails.table}
 
4
\alias{grid.table}
 
5
\alias{heightDetails.table}
 
6
\alias{makeTableGrobs}
 
7
\alias{tableGrob}
 
8
\alias{widthDetails.table}
 
9
\title{tableGrob}
 
10
\usage{
 
11
  tableGrob(d, rows = rownames(d), cols = colnames(d),
 
12
    parse = FALSE, show.rownames = TRUE,
 
13
    show.colnames = TRUE, row.just = "center",
 
14
    col.just = "center", core.just = "center",
 
15
    separator = "white", show.box = FALSE,
 
16
    show.vlines = FALSE, show.hlines = FALSE,
 
17
    show.namesep = FALSE, show.csep = FALSE,
 
18
    show.rsep = FALSE, equal.width = FALSE,
 
19
    equal.height = FALSE, padding.h = unit(4, "mm"),
 
20
    padding.v = unit(4, "mm"), gp = NULL,
 
21
    gpar.coretext = gpar(col = "black", cex = 1),
 
22
    gpar.coltext = gpar(col = "black", cex = 1, fontface = "bold"),
 
23
    gpar.rowtext = gpar(col = "black", cex = 0.8, fontface = "italic"),
 
24
    h.odd.alpha = 1, h.even.alpha = 1, v.odd.alpha = 1,
 
25
    v.even.alpha = 1,
 
26
    gpar.corefill = gpar(fill = "grey95", col = "white"),
 
27
    gpar.rowfill = gpar(fill = "grey90", col = "white"),
 
28
    gpar.colfill = gpar(fill = "grey90", col = "white"),
 
29
    theme = NULL, ...)
 
30
}
 
31
\arguments{
 
32
  \item{d}{data.frame}
 
33
 
 
34
  \item{rows}{vector of row names}
 
35
 
 
36
  \item{cols}{vector of col names}
 
37
 
 
38
  \item{parse}{logical, parse labels as expressions}
 
39
 
 
40
  \item{row.just}{justification of labels}
 
41
 
 
42
  \item{col.just}{justification of labels}
 
43
 
 
44
  \item{core.just}{justification of labels}
 
45
 
 
46
  \item{separator}{colour of the border lines}
 
47
 
 
48
  \item{show.box}{logical box surrounding the table}
 
49
 
 
50
  \item{show.vlines}{logical vertical lines}
 
51
 
 
52
  \item{show.hlines}{logical horizontal lines}
 
53
 
 
54
  \item{show.namesep}{logical draw lines to separate
 
55
  header(s)}
 
56
 
 
57
  \item{show.csep}{logical extend vert. separator to
 
58
  colnames}
 
59
 
 
60
  \item{show.rsep}{logical extend vert. separator to
 
61
  rownames}
 
62
 
 
63
  \item{equal.width}{logical}
 
64
 
 
65
  \item{equal.height}{logical}
 
66
 
 
67
  \item{padding.h}{unit of horizontal margin, per cell}
 
68
 
 
69
  \item{padding.v}{unit of vertical margin, per cell}
 
70
 
 
71
  \item{gpar.coretext}{gpar() for inner text}
 
72
 
 
73
  \item{gpar.corefill}{gpar() for inner fill}
 
74
 
 
75
  \item{gpar.coltext}{gpar() for colnames text}
 
76
 
 
77
  \item{h.odd.alpha}{numeric transparency factor for odd
 
78
  horizontal cells}
 
79
 
 
80
  \item{h.even.alpha}{numeric transparency factor for even
 
81
  horizontal cells}
 
82
 
 
83
  \item{v.odd.alpha}{numeric transparency factor for odd
 
84
  vertical cells}
 
85
 
 
86
  \item{v.even.alpha}{numeric transparency factor for even
 
87
  vertical cells}
 
88
 
 
89
  \item{gpar.colfill}{gpar() for colnames fill}
 
90
 
 
91
  \item{gpar.rowtext}{gpar() for rownames text}
 
92
 
 
93
  \item{gpar.rowfill}{gpar() for rownames fill}
 
94
 
 
95
  \item{show.rownames}{logical}
 
96
 
 
97
  \item{show.colnames}{logical}
 
98
 
 
99
  \item{gp}{gpar}
 
100
 
 
101
  \item{theme}{theme (list of aesthetic elements)}
 
102
 
 
103
  \item{...}{passed to grob}
 
104
}
 
105
\value{
 
106
  a grob of class table
 
107
}
 
108
\description{
 
109
  create a list of text and fill grobs and calculates the
 
110
  sizes for a table display
 
111
}
 
112
\examples{
 
113
grid.table(head(iris), h.even.alpha=1, h.odd.alpha=1,  v.even.alpha=0.5, v.odd.alpha=1)
 
114
grid.newpage()
 
115
grid.draw(tableGrob(head(iris, 10), name="test"))
 
116
e = expression(alpha,"testing very large width", hat(beta), integral(f(x)*dx, a, b), "abc")
 
117
grid.edit("test", cols=e, show.rownames=FALSE, rows=NULL,
 
118
           gpar.corefill = gpar(fill="white", col=NA),
 
119
           grep=TRUE, global=TRUE)
 
120
 grid.newpage()
 
121
 grid.draw(tableGrob(head(iris, 10),
 
122
                      show.csep=TRUE, show.rsep=TRUE, show.box=TRUE, separator="grey", name="test"))
 
123
 grid.edit("test",gp=gpar(fontsize=8, lwd=2),  equal.width=TRUE, grep=TRUE, global=TRUE)
 
124
# visualize themes
 
125
lg <- lapply(c("theme.blank", "theme.default", "theme.white",  "theme.vertical",  "theme.list", "theme.black"),
 
126
             function(x) tableGrob(head(iris[, 1:3]), theme=get(x)()))
 
127
grid.newpage()
 
128
do.call(grid.arrange, lg)
 
129
\dontrun{
 
130
## timing: a bit slow due to repeated on-the-fly calculations
 
131
pdf("test2.pdf", height=50)
 
132
print(system.time( grid.table(iris)) ) # about 12s here
 
133
dev.off()
 
134
}
 
135
}
 
136
\seealso{
 
137
  Other grob userlevel: \code{\link{arcTextGrob}},
 
138
  \code{\link{barbedGrob}}, \code{\link{borderGrob}},
 
139
  \code{\link{colorstripGrob}}, \code{\link{ebimageGrob}},
 
140
  \code{\link{ellipseGrob}}, \code{\link{interleaven}},
 
141
  \code{\link{ngonGrob}}, \code{\link{patternGrob}},
 
142
  \code{\link{pixmapGrob}}, \code{\link{rpatternGrob}},
 
143
  \code{\link{stextGrob}}, \code{\link{virtualGrob}}
 
144
}
 
145