Skip to content

Commit

Permalink
Re-export pilltabs print functions
Browse files Browse the repository at this point in the history
  • Loading branch information
juba committed Dec 4, 2015
1 parent a2c7329 commit 5152b7b
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 14 deletions.
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Generated by roxygen2: do not edit by hand

S3method(print,pilltabs)
export(create.doc)
export(html_clean)
export(html_docco)
export(knit_print.pilltabs)
export(pilltabs)
import(rmarkdown)
importFrom(htmltools,htmlDependency)
Expand Down
4 changes: 3 additions & 1 deletion R/pilltabs.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pilltabs <- function(tab, count = TRUE, rows = TRUE, cols = TRUE, chisq = TRUE,
res
}


#' @export
print.pilltabs <- function(x) {
if (!is.null(x[["count"]])) {
cat("\n--- COUNT ---\n\n")
Expand All @@ -66,7 +66,9 @@ print.pilltabs <- function(x) {
}
}


#' @importFrom knitr opts_knit
#' @export
knit_print.pilltabs <- function(res, options) {
result <- ""

Expand Down
33 changes: 27 additions & 6 deletions resources/examples/html_clean/html_clean_sample.html
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,22 @@ <h2>Table</h2>
</tbody>
</table>
<p>Here we display a crosstab displayed in several different ways with a “pills” interface. To do this, just pass your <code>table()</code> result to the <code>pilltabs()</code> function.</p>
<p>$count</p>
<ul class="nav nav-pills nav-pilltabs">
<li>
<a href="#dyntab-count91040898720" data-toggle="pill">Count</a>
</li>
<li>
<a href="#dyntab-rows91040898720" data-toggle="pill">Rows %</a>
</li>
<li>
<a href="#dyntab-columns91040898720" data-toggle="pill">Columns %</a>
</li>
<li>
<a href="#dyntab-residuals91040898720" data-toggle="pill">Residuals</a>
</li>
</ul>
<div class="tab-content">
<div id="dyntab-count91040898720" class="tab-pane dyntab">
<table>
<thead>
<tr class="header">
Expand Down Expand Up @@ -183,7 +198,8 @@ <h2>Table</h2>
</tr>
</tbody>
</table>
<p>$rows</p>
</div>
<div id="dyntab-rows91040898720" class="tab-pane dyntab">
<table>
<thead>
<tr class="header">
Expand Down Expand Up @@ -230,7 +246,8 @@ <h2>Table</h2>
</tr>
</tbody>
</table>
<p>$cols</p>
</div>
<div id="dyntab-columns91040898720" class="tab-pane dyntab">
<table>
<thead>
<tr class="header">
Expand Down Expand Up @@ -279,7 +296,8 @@ <h2>Table</h2>
</tr>
</tbody>
</table>
<p>$resid</p>
</div>
<div id="dyntab-residuals91040898720" class="tab-pane dyntab-residuals">
<table>
<thead>
<tr class="header">
Expand Down Expand Up @@ -310,8 +328,11 @@ <h2>Table</h2>
</tr>
</tbody>
</table>
<p>$chisq [1] “X-squared = 111.6339, df = 4, p = &lt; 2.2e-16”</p>
<p>attr(,“class”) [1] “pilltabs”</p>
</div>
</div>
<p class="chisq-results">
X-squared = 111.6339, df = 4, p = &lt; 2.2e-16
</p>
</div>
</div>
<div id="figures" class="section level1">
Expand Down
35 changes: 28 additions & 7 deletions resources/examples/html_docco/html_docco_sample.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@


<div id="header">
<h1 class="title"><code>html_docco</code> template example</h1>
<h1 class="title">html_docco template example</h1>
</div>


Expand Down Expand Up @@ -149,7 +149,22 @@ <h2>Table</h2>
</tbody>
</table>
<p>Here we display a crosstab displayed in several different ways with a “pills” interface. To do this, just pass your <code>table()</code> result to the <code>pilltabs()</code> function.</p>
<p>$count</p>
<ul class="nav nav-pills nav-pilltabs">
<li>
<a href="#dyntab-count75441035209" data-toggle="pill">Count</a>
</li>
<li>
<a href="#dyntab-rows75441035209" data-toggle="pill">Rows %</a>
</li>
<li>
<a href="#dyntab-columns75441035209" data-toggle="pill">Columns %</a>
</li>
<li>
<a href="#dyntab-residuals75441035209" data-toggle="pill">Residuals</a>
</li>
</ul>
<div class="tab-content">
<div id="dyntab-count75441035209" class="tab-pane dyntab">
<table>
<thead>
<tr class="header">
Expand Down Expand Up @@ -180,7 +195,8 @@ <h2>Table</h2>
</tr>
</tbody>
</table>
<p>$rows</p>
</div>
<div id="dyntab-rows75441035209" class="tab-pane dyntab">
<table>
<thead>
<tr class="header">
Expand Down Expand Up @@ -227,7 +243,8 @@ <h2>Table</h2>
</tr>
</tbody>
</table>
<p>$cols</p>
</div>
<div id="dyntab-columns75441035209" class="tab-pane dyntab">
<table>
<thead>
<tr class="header">
Expand Down Expand Up @@ -276,7 +293,8 @@ <h2>Table</h2>
</tr>
</tbody>
</table>
<p>$resid</p>
</div>
<div id="dyntab-residuals75441035209" class="tab-pane dyntab-residuals">
<table>
<thead>
<tr class="header">
Expand Down Expand Up @@ -307,8 +325,11 @@ <h2>Table</h2>
</tr>
</tbody>
</table>
<p>$chisq [1] “X-squared = 111.6339, df = 4, p = &lt; 2.2e-16”</p>
<p>attr(,“class”) [1] “pilltabs”</p>
</div>
</div>
<p class="chisq-results">
X-squared = 111.6339, df = 4, p = &lt; 2.2e-16
</p>
</div>
</div>
<div id="figures" class="section level1">
Expand Down

0 comments on commit 5152b7b

Please sign in to comment.