Skip to content

Commit 036bd87

Browse files
committed
Updated vignettes and fixed bug when table_id was FALSE
1 parent 234541c commit 036bd87

File tree

5 files changed

+25
-23
lines changed

5 files changed

+25
-23
lines changed

R/htmlTable.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,8 @@ htmlTable.default <- function(x,
539539
table_id <- sprintf(" id='%s'", label)
540540
}else if(is.numeric(table_id)){
541541
table_id <- paste0(" id='table_", table_id, "'")
542+
}else if(table_id == FALSE){
543+
table_id <- ""
542544
}
543545

544546
# A column counter that is used for <td colspan="">

inst/doc/general.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ output <- matrix(1:4,
88
htmlTable(output)
99

1010
## ------------------------------------------------------------------------
11-
htmlTable(output,
11+
htmlTable(output, ctable=c("solid", "double"),
1212
caption="A table caption above")
1313

1414
## ------------------------------------------------------------------------

inst/doc/general.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Table caption
3636
The table caption is simply the table description and can be either located above or below:
3737

3838
```{r}
39-
htmlTable(output,
39+
htmlTable(output, ctable=c("solid", "double"),
4040
caption="A table caption above")
4141
```
4242

inst/doc/general.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<meta name="author" content="Max Gordon" />
1414

15-
<meta name="date" content="2016-07-24" />
15+
<meta name="date" content="2016-10-19" />
1616

1717
<title>The htmlTable package</title>
1818

@@ -70,7 +70,7 @@
7070

7171
<h1 class="title toc-ignore">The htmlTable package</h1>
7272
<h4 class="author"><em>Max Gordon</em></h4>
73-
<h4 class="date"><em>2016-07-24</em></h4>
73+
<h4 class="date"><em>2016-10-19</em></h4>
7474

7575

7676
<div id="TOC">
@@ -144,7 +144,7 @@ <h1>Basics</h1>
144144
<div id="table-caption" class="section level2">
145145
<h2>Table caption</h2>
146146
<p>The table caption is simply the table description and can be either located above or below:</p>
147-
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">htmlTable</span>(output,
147+
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">htmlTable</span>(output, <span class="dt">ctable=</span><span class="kw">c</span>(<span class="st">&quot;solid&quot;</span>, <span class="st">&quot;double&quot;</span>),
148148
<span class="dt">caption=</span><span class="st">&quot;A table caption above&quot;</span>)</code></pre></div>
149149
<table class="gmisc_table" style="border-collapse: collapse; margin-top: 1em; margin-bottom: 1em;">
150150
<thead>
@@ -177,13 +177,13 @@ <h2>Table caption</h2>
177177
</td>
178178
</tr>
179179
<tr>
180-
<td style="border-bottom: 2px solid grey; text-align: left;">
180+
<td style="border-bottom: 4px double grey; text-align: left;">
181181
Row 2
182182
</td>
183-
<td style="border-bottom: 2px solid grey; text-align: center;">
183+
<td style="border-bottom: 4px double grey; text-align: center;">
184184
2
185185
</td>
186-
<td style="border-bottom: 2px solid grey; text-align: center;">
186+
<td style="border-bottom: 4px double grey; text-align: center;">
187187
4
188188
</td>
189189
</tr>
@@ -2848,7 +2848,7 @@ <h2>Table footer</h2>
28482848
<p>The footer usually contains specifics regarding variables and is always located at the foot of the table:</p>
28492849
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">htmlTable</span>(mx[<span class="dv">1</span>:<span class="dv">2</span>,<span class="dv">1</span>:<span class="dv">2</span>],
28502850
<span class="dt">tfoot=</span><span class="st">&quot;A table footer&quot;</span>)</code></pre></div>
2851-
<table class="gmisc_table" style="border-collapse: collapse; margin-top: 1em; margin-bottom: 1em;" FALSE>
2851+
<table class="gmisc_table" style="border-collapse: collapse; margin-top: 1em; margin-bottom: 1em;">
28522852
<thead>
28532853
<tr>
28542854
<th style="border-bottom: 1px solid grey; border-top: 2px solid grey;">
@@ -2899,7 +2899,7 @@ <h2>Zebra coloring (or banded colors)</h2>
28992899
<p>Zebra coloring is also know as an alternating color pattern or row shading. It is most commonly applied to rows:</p>
29002900
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">htmlTable</span>(mx,
29012901
<span class="dt">col.rgroup =</span> <span class="kw">c</span>(<span class="st">&quot;none&quot;</span>, <span class="st">&quot;#F7F7F7&quot;</span>))</code></pre></div>
2902-
<table class="gmisc_table" style="border-collapse: collapse; margin-top: 1em; margin-bottom: 1em;" FALSE>
2902+
<table class="gmisc_table" style="border-collapse: collapse; margin-top: 1em; margin-bottom: 1em;">
29032903
<thead>
29042904
<tr>
29052905
<th style="border-bottom: 1px solid grey; border-top: 2px solid grey;">
@@ -3116,7 +3116,7 @@ <h2>Zebra coloring (or banded colors)</h2>
31163116
<span class="dt">col.rgroup =</span> <span class="kw">c</span>(<span class="st">&quot;none&quot;</span>, <span class="st">&quot;#F7F7F7&quot;</span>),
31173117
<span class="dt">rgroup =</span> <span class="kw">c</span>(<span class="kw">paste</span>(<span class="st">&quot;Group&quot;</span>, LETTERS[<span class="dv">1</span>:<span class="dv">2</span>]), <span class="st">&quot;&quot;</span>),
31183118
<span class="dt">n.rgroup =</span> <span class="kw">c</span>(<span class="dv">2</span>,<span class="dv">2</span>,<span class="kw">nrow</span>(mx) -<span class="st"> </span><span class="dv">4</span>))</code></pre></div>
3119-
<table class="gmisc_table" style="border-collapse: collapse; margin-top: 1em; margin-bottom: 1em;" FALSE>
3119+
<table class="gmisc_table" style="border-collapse: collapse; margin-top: 1em; margin-bottom: 1em;">
31203120
<thead>
31213121
<tr>
31223122
<th style="border-bottom: 1px solid grey; border-top: 2px solid grey;">
@@ -3341,7 +3341,7 @@ <h2>Zebra coloring (or banded colors)</h2>
33413341
<p>We can also color the columns:</p>
33423342
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">htmlTable</span>(mx,
33433343
<span class="dt">col.columns =</span> <span class="kw">c</span>(<span class="st">&quot;none&quot;</span>, <span class="st">&quot;#F7F7F7&quot;</span>))</code></pre></div>
3344-
<table class="gmisc_table" style="border-collapse: collapse; margin-top: 1em; margin-bottom: 1em;" FALSE>
3344+
<table class="gmisc_table" style="border-collapse: collapse; margin-top: 1em; margin-bottom: 1em;">
33453345
<thead>
33463346
<tr>
33473347
<th style="border-bottom: 1px solid grey; border-top: 2px solid grey;">
@@ -3557,7 +3557,7 @@ <h2>Zebra coloring (or banded colors)</h2>
35573557
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">htmlTable</span>(mx,
35583558
<span class="dt">col.rgroup =</span> <span class="kw">c</span>(<span class="st">&quot;none&quot;</span>, <span class="st">&quot;#F9FAF0&quot;</span>),
35593559
<span class="dt">col.columns =</span> <span class="kw">c</span>(<span class="st">&quot;none&quot;</span>, <span class="st">&quot;#F1F0FA&quot;</span>))</code></pre></div>
3560-
<table class="gmisc_table" style="border-collapse: collapse; margin-top: 1em; margin-bottom: 1em;" FALSE>
3560+
<table class="gmisc_table" style="border-collapse: collapse; margin-top: 1em; margin-bottom: 1em;">
35613561
<thead>
35623562
<tr>
35633563
<th style="border-bottom: 1px solid grey; border-top: 2px solid grey;">
@@ -3788,7 +3788,7 @@ <h2>Putting it all together</h2>
37883788
<span class="kw">rep</span>(<span class="st">&quot;#F5FBFF&quot;</span>, <span class="dv">4</span>)),
37893789
<span class="dt">col.rgroup =</span> <span class="kw">c</span>(<span class="st">&quot;none&quot;</span>, <span class="st">&quot;#F7F7F7&quot;</span>),
37903790
<span class="dt">css.cell =</span> <span class="st">&quot;padding-left: .5em; padding-right: .2em;&quot;</span>)</code></pre></div>
3791-
<table class="gmisc_table" style="border-collapse: collapse; margin-top: 1em; margin-bottom: 1em;" FALSE>
3791+
<table class="gmisc_table" style="border-collapse: collapse; margin-top: 1em; margin-bottom: 1em;">
37923792
<thead>
37933793
<tr>
37943794
<td colspan="9" style="text-align: left;">

inst/doc/tables.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<meta name="author" content="Max Gordon" />
1414

15-
<meta name="date" content="2016-07-24" />
15+
<meta name="date" content="2016-10-19" />
1616

1717
<title>Tables with htmlTable and some alternatives</title>
1818

@@ -70,7 +70,7 @@
7070

7171
<h1 class="title toc-ignore">Tables with htmlTable and some alternatives</h1>
7272
<h4 class="author"><em>Max Gordon</em></h4>
73-
<h4 class="date"><em>2016-07-24</em></h4>
73+
<h4 class="date"><em>2016-10-19</em></h4>
7474

7575

7676
<div id="TOC">
@@ -126,7 +126,7 @@ <h2>The <code>htmlTable</code>-package</h2>
126126
<span class="dt">n.cgroup =</span> <span class="kw">c</span>(<span class="dv">2</span>,<span class="dv">2</span>),
127127
<span class="dt">caption=</span><span class="st">&quot;Basic table with both column spanners (groups) and row groups&quot;</span>,
128128
<span class="dt">tfoot=</span><span class="st">&quot;&amp;dagger; A table footer commment&quot;</span>)</code></pre></div>
129-
<table class="gmisc_table" style="border-collapse: collapse; margin-top: 1em; margin-bottom: 1em;" FALSE>
129+
<table class="gmisc_table" style="border-collapse: collapse; margin-top: 1em; margin-bottom: 1em;">
130130
<thead>
131131
<tr>
132132
<td colspan="6" style="text-align: left;">
@@ -396,7 +396,7 @@ <h3>Example based upon Swedish statistics</h3>
396396
<span class="dt">n.rgroup =</span> <span class="kw">rep</span>(<span class="dv">5</span>, <span class="dv">3</span>),
397397
<span class="dt">tfoot =</span> <span class="kw">txtMergeLines</span>(<span class="st">&quot;&amp;Delta;&lt;sub&gt;int&lt;/sub&gt; correspnds to the change since start&quot;</span>,
398398
<span class="st">&quot;&amp;Delta;&lt;sub&gt;std&lt;/sub&gt; corresponds to the change compared to national average&quot;</span>))</code></pre></div>
399-
<table class="gmisc_table" style="border-collapse: collapse; margin-top: 1em; margin-bottom: 1em;" FALSE>
399+
<table class="gmisc_table" style="border-collapse: collapse; margin-top: 1em; margin-bottom: 1em;">
400400
<thead>
401401
<tr>
402402
<th style="border-top: 2px solid grey;">
@@ -1980,7 +1980,7 @@ <h3>Example based upon Swedish statistics</h3>
19801980
<span class="dt">n.rgroup =</span> <span class="kw">rep</span>(<span class="dv">5</span>, <span class="dv">3</span>),
19811981
<span class="dt">tfoot =</span> <span class="kw">txtMergeLines</span>(<span class="st">&quot;&amp;Delta;&lt;sub&gt;int&lt;/sub&gt; correspnds to the change since start&quot;</span>,
19821982
<span class="st">&quot;&amp;Delta;&lt;sub&gt;std&lt;/sub&gt; corresponds to the change compared to national average&quot;</span>))</code></pre></div>
1983-
<table class="gmisc_table" style="border-collapse: collapse; margin-top: 1em; margin-bottom: 1em;" FALSE>
1983+
<table class="gmisc_table" style="border-collapse: collapse; margin-top: 1em; margin-bottom: 1em;">
19841984
<thead>
19851985
<tr>
19861986
<th style="border-top: 2px solid grey;">
@@ -3566,7 +3566,7 @@ <h3>Example based upon Swedish statistics</h3>
35663566
<span class="dt">n.rgroup =</span> <span class="kw">rep</span>(<span class="dv">5</span>, <span class="dv">3</span>),
35673567
<span class="dt">tfoot =</span> <span class="kw">txtMergeLines</span>(<span class="st">&quot;&amp;Delta;&lt;sub&gt;int&lt;/sub&gt; correspnds to the change since start&quot;</span>,
35683568
<span class="st">&quot;&amp;Delta;&lt;sub&gt;std&lt;/sub&gt; corresponds to the change compared to national average&quot;</span>))</code></pre></div>
3569-
<table class="gmisc_table" style="border-collapse: collapse; margin-top: 1em; margin-bottom: 1em;" FALSE>
3569+
<table class="gmisc_table" style="border-collapse: collapse; margin-top: 1em; margin-bottom: 1em;">
35703570
<thead>
35713571
<tr>
35723572
<th style="border-top: 2px solid grey;">
@@ -5157,7 +5157,7 @@ <h3>Example based upon Swedish statistics</h3>
51575157
<span class="dt">tfoot =</span> <span class="kw">txtMergeLines</span>(<span class="st">&quot;&amp;Delta;&lt;sub&gt;int&lt;/sub&gt; correspnds to the change since start&quot;</span>,
51585158
<span class="st">&quot;&amp;Delta;&lt;sub&gt;std&lt;/sub&gt; corresponds to the change compared to national average&quot;</span>),
51595159
<span class="dt">cspan.rgroup =</span> <span class="dv">1</span>)</code></pre></div>
5160-
<table class="gmisc_table" style="border-collapse: collapse; margin-top: 1em; margin-bottom: 1em;" FALSE>
5160+
<table class="gmisc_table" style="border-collapse: collapse; margin-top: 1em; margin-bottom: 1em;">
51615161
<thead>
51625162
<tr>
51635163
<th style="border-top: 2px solid grey;">
@@ -6965,7 +6965,7 @@ <h3>Example based upon Swedish statistics</h3>
69656965
<span class="dt">tfoot =</span> <span class="kw">txtMergeLines</span>(<span class="st">&quot;&amp;Delta;&lt;sub&gt;int&lt;/sub&gt; correspnds to the change since start&quot;</span>,
69666966
<span class="st">&quot;&amp;Delta;&lt;sub&gt;std&lt;/sub&gt; corresponds to the change compared to national average&quot;</span>),
69676967
<span class="dt">cspan.rgroup =</span> <span class="dv">1</span>)</code></pre></div>
6968-
<table class="gmisc_table" style="border-collapse: collapse; margin-top: 1em; margin-bottom: 1em;" FALSE>
6968+
<table class="gmisc_table" style="border-collapse: collapse; margin-top: 1em; margin-bottom: 1em;">
69696969
<thead>
69706970
<tr>
69716971
<td colspan="30" style="text-align: left;">
@@ -9983,7 +9983,7 @@ <h3>The <code>xtable</code>-package</h3>
99839983
<span class="dt">align =</span> <span class="kw">c</span>(<span class="st">&quot;l&quot;</span>, <span class="st">&quot;c&quot;</span>, <span class="st">&quot;r&quot;</span>)),
99849984
<span class="dt">type=</span><span class="st">&quot;html&quot;</span>)</code></pre></div>
99859985
<!-- html table generated in R 3.3.1 by xtable 1.8-2 package -->
9986-
<!-- Sun Jul 24 11:41:14 2016 -->
9986+
<!-- Wed Oct 19 10:15:13 2016 -->
99879987
<table border="1">
99889988
<caption align="bottom">
99899989
A test table

0 commit comments

Comments
 (0)