From c80dba6ab736df4f7678c86425146095763f71a6 Mon Sep 17 00:00:00 2001 From: waddella Date: Sat, 9 Jun 2018 20:33:44 +0200 Subject: [PATCH] update manual --- DESCRIPTION | 2 +- NEWS.md | 1 + README.Rmd | 9 +- README.md | 8 +- _pkgdown.yml | 2 + docs/ISSUE_TEMPLATE.html | 10 +- docs/LICENSE-text.html | 10 +- docs/articles/index.html | 20 +- docs/articles/rtables.html | 17 +- docs/articles/rtabulate.html | 22 +- docs/authors.html | 12 +- docs/dev/ISSUE_TEMPLATE.html | 151 ++++++ docs/dev/LICENSE-text.html | 382 ++++++++++++++ docs/dev/articles/index.html | 137 +++++ docs/dev/articles/rtables.html | 298 +++++++++++ docs/dev/articles/rtabulate.html | 270 ++++++++++ docs/dev/authors.html | 146 ++++++ docs/dev/docsearch.css | 148 ++++++ docs/dev/docsearch.js | 85 ++++ docs/dev/index.html | 209 ++++++++ docs/dev/link.svg | 12 + docs/dev/news/index.html | 183 +++++++ docs/dev/pkgdown.css | 232 +++++++++ docs/dev/pkgdown.js | 110 ++++ docs/dev/pkgdown.yml | 7 + docs/dev/reference/Viewer.html | 178 +++++++ docs/dev/reference/as.rtable.html | 171 +++++++ docs/dev/reference/as.rtable.table.html | 194 +++++++ docs/dev/reference/as_html.default.html | 172 +++++++ docs/dev/reference/as_html.html | 216 ++++++++ docs/dev/reference/compare_rtables.html | 269 ++++++++++ docs/dev/reference/dim.rheader.html | 174 +++++++ docs/dev/reference/dim.rtable.html | 174 +++++++ docs/dev/reference/format_rcell.html | 183 +++++++ docs/dev/reference/header-set.html | 179 +++++++ docs/dev/reference/header.html | 186 +++++++ docs/dev/reference/indented_row.names.html | 177 +++++++ docs/dev/reference/index.html | 387 ++++++++++++++ docs/dev/reference/is.no_by.html | 173 +++++++ .../reference/list_rcell_format_labels.html | 180 +++++++ docs/dev/reference/names.rtable.html | 174 +++++++ docs/dev/reference/no_by.html | 171 +++++++ docs/dev/reference/rbind.rtable.html | 212 ++++++++ docs/dev/reference/rcell.html | 188 +++++++ docs/dev/reference/rheader.html | 179 +++++++ docs/dev/reference/row.names-set-.rtable.html | 183 +++++++ docs/dev/reference/row.names.rheader.html | 174 +++++++ docs/dev/reference/row.names.rtable.html | 174 +++++++ docs/dev/reference/rrow.html | 196 ++++++++ docs/dev/reference/rrowl.html | 198 ++++++++ docs/dev/reference/rtable.html | 339 +++++++++++++ docs/dev/reference/rtablel.html | 188 +++++++ docs/dev/reference/rtabulate.data.frame.html | 300 +++++++++++ docs/dev/reference/rtabulate.factor.html | 267 ++++++++++ docs/dev/reference/rtabulate.html | 192 +++++++ docs/dev/reference/rtabulate.logical.html | 244 +++++++++ docs/dev/reference/rtabulate.numeric.html | 252 ++++++++++ docs/{ => dev}/reference/sprintf_format.html | 10 +- docs/dev/reference/sub-.rheader.html | 180 +++++++ docs/dev/reference/sub-.rtable.html | 189 +++++++ docs/dev/reference/toString.rtable.html | 180 +++++++ docs/docsearch.css | 145 ------ docs/index.html | 10 +- docs/jquery.sticky-kit.min.js | 4 +- docs/news/index.html | 24 +- docs/pkgdown.css | 8 - docs/pkgdown.js | 73 --- docs/pkgdown.yml | 2 +- docs/reference/Viewer.html | 15 +- docs/reference/as.rtable.html | 15 +- docs/reference/as.rtable.table.html | 15 +- docs/reference/as_html.default.html | 15 +- docs/reference/as_html.html | 15 +- docs/reference/compare_rtables.html | 15 +- docs/reference/dim.rheader.html | 15 +- docs/reference/dim.rtable.html | 15 +- docs/reference/format_rcell.html | 17 +- docs/reference/header-set.html | 15 +- docs/reference/header.html | 15 +- docs/reference/indented_row.names.html | 15 +- docs/reference/index.html | 476 +++++++++--------- docs/reference/is.no_by.html | 15 +- docs/reference/list_rcell_format_labels.html | 17 +- docs/reference/names.rtable.html | 15 +- docs/reference/no_by.html | 15 +- docs/reference/rbind.rtable.html | 15 +- docs/reference/rcell.html | 15 +- docs/reference/rheader.html | 15 +- docs/reference/row.names-set-.rtable.html | 15 +- docs/reference/row.names.rheader.html | 15 +- docs/reference/row.names.rtable.html | 15 +- docs/reference/rrow.html | 15 +- docs/reference/rrowl.html | 15 +- docs/reference/rtable.html | 17 +- docs/reference/rtablel.html | 15 +- docs/reference/rtabulate.data.frame.html | 56 +-- docs/reference/rtabulate.factor.html | 40 +- docs/reference/rtabulate.html | 15 +- docs/reference/rtabulate.logical.html | 19 +- docs/reference/rtabulate.numeric.html | 19 +- docs/reference/sub-.rheader.html | 15 +- docs/reference/sub-.rtable.html | 15 +- docs/reference/toString.rtable.html | 15 +- man/rtabulate.data.frame.Rd | 6 +- 104 files changed, 10007 insertions(+), 1017 deletions(-) create mode 100644 docs/dev/ISSUE_TEMPLATE.html create mode 100644 docs/dev/LICENSE-text.html create mode 100644 docs/dev/articles/index.html create mode 100644 docs/dev/articles/rtables.html create mode 100644 docs/dev/articles/rtabulate.html create mode 100644 docs/dev/authors.html create mode 100644 docs/dev/docsearch.css create mode 100644 docs/dev/docsearch.js create mode 100644 docs/dev/index.html create mode 100644 docs/dev/link.svg create mode 100644 docs/dev/news/index.html create mode 100644 docs/dev/pkgdown.css create mode 100644 docs/dev/pkgdown.js create mode 100644 docs/dev/pkgdown.yml create mode 100644 docs/dev/reference/Viewer.html create mode 100644 docs/dev/reference/as.rtable.html create mode 100644 docs/dev/reference/as.rtable.table.html create mode 100644 docs/dev/reference/as_html.default.html create mode 100644 docs/dev/reference/as_html.html create mode 100644 docs/dev/reference/compare_rtables.html create mode 100644 docs/dev/reference/dim.rheader.html create mode 100644 docs/dev/reference/dim.rtable.html create mode 100644 docs/dev/reference/format_rcell.html create mode 100644 docs/dev/reference/header-set.html create mode 100644 docs/dev/reference/header.html create mode 100644 docs/dev/reference/indented_row.names.html create mode 100644 docs/dev/reference/index.html create mode 100644 docs/dev/reference/is.no_by.html create mode 100644 docs/dev/reference/list_rcell_format_labels.html create mode 100644 docs/dev/reference/names.rtable.html create mode 100644 docs/dev/reference/no_by.html create mode 100644 docs/dev/reference/rbind.rtable.html create mode 100644 docs/dev/reference/rcell.html create mode 100644 docs/dev/reference/rheader.html create mode 100644 docs/dev/reference/row.names-set-.rtable.html create mode 100644 docs/dev/reference/row.names.rheader.html create mode 100644 docs/dev/reference/row.names.rtable.html create mode 100644 docs/dev/reference/rrow.html create mode 100644 docs/dev/reference/rrowl.html create mode 100644 docs/dev/reference/rtable.html create mode 100644 docs/dev/reference/rtablel.html create mode 100644 docs/dev/reference/rtabulate.data.frame.html create mode 100644 docs/dev/reference/rtabulate.factor.html create mode 100644 docs/dev/reference/rtabulate.html create mode 100644 docs/dev/reference/rtabulate.logical.html create mode 100644 docs/dev/reference/rtabulate.numeric.html rename docs/{ => dev}/reference/sprintf_format.html (87%) create mode 100644 docs/dev/reference/sub-.rheader.html create mode 100644 docs/dev/reference/sub-.rtable.html create mode 100644 docs/dev/reference/toString.rtable.html delete mode 100644 docs/docsearch.css diff --git a/DESCRIPTION b/DESCRIPTION index 3920f0164..bf975c4f1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: rtables Title: Reporting Tables -Version: 0.1.1 +Version: 0.1.0.1 Authors@R: c( person("Adrian", "Waddell", email = "adrian.waddell@roche.com", role = c("aut", "cre")) ) diff --git a/NEWS.md b/NEWS.md index 92ae37e46..f34649988 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,7 @@ * added `sprintf_format` for formatting rcells (thanks to Doug Kelkhoff for the suggestion) * added `"(N=xx)"` and `">999.9"` format labels +* `rtabulate` has now an argument `col_total` and shows by default the numbers of elements associated with a column ## rtable 0.1.0 diff --git a/README.Rmd b/README.Rmd index 41b213057..ef4b6e1d3 100644 --- a/README.Rmd +++ b/README.Rmd @@ -51,12 +51,19 @@ repository and to send us pull requests with the suggested improvements. ## Installation -To install the `rtables` package run the following command in `R`: +To install the stable release of `rtables` package run the following command in `R`: + +```{r, eval = FALSE} +devtools::install_github("roche/rtables", ref="v0.1.0") +``` + +To install the test version of `rtables` run ```{r, eval = FALSE} devtools::install_github("roche/rtables") ``` + ## Usage ```{r} diff --git a/README.md b/README.md index 865ae57ee..55f791597 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,13 @@ We are looking for collaborators to help define and shape the `rtables` package. Installation ------------ -To install the `rtables` package run the following command in `R`: +To install the stable release of `rtables` package run the following command in `R`: + +``` r +devtools::install_github("roche/rtables", ref="v0.1.0") +``` + +To install the test version of `rtables` run ``` r devtools::install_github("roche/rtables") diff --git a/_pkgdown.yml b/_pkgdown.yml index f73380b0b..d50e040c2 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -7,6 +7,8 @@ navbar: - icon: fa-github fa-lg href: https://github.com/roche/rtables +development: + mode: devel reference: - title: Core Table Create Functions diff --git a/docs/ISSUE_TEMPLATE.html b/docs/ISSUE_TEMPLATE.html index 4957d8788..51742b506 100644 --- a/docs/ISSUE_TEMPLATE.html +++ b/docs/ISSUE_TEMPLATE.html @@ -25,9 +25,6 @@ - - - @@ -55,7 +52,7 @@ rtables - 0.1.1 + 0.1.0 @@ -98,7 +95,6 @@ - @@ -106,7 +102,7 @@ -
+
- - diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 1441f28d0..254016255 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -25,9 +25,6 @@ - - - @@ -55,7 +52,7 @@ rtables - 0.1.1 + 0.1.0
@@ -98,7 +95,6 @@ -
@@ -106,7 +102,7 @@ -
+
- - diff --git a/docs/articles/index.html b/docs/articles/index.html index 06f5b2775..7e31007ee 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -25,9 +25,6 @@ - - - @@ -43,7 +40,7 @@ -
+
@@ -106,12 +102,12 @@ -
-
- + +
+
@@ -127,8 +123,6 @@

Articles

- - diff --git a/docs/articles/rtables.html b/docs/articles/rtables.html index baf3717c4..91aa63584 100644 --- a/docs/articles/rtables.html +++ b/docs/articles/rtables.html @@ -18,7 +18,7 @@ -
+
-
+
+

Overview

@@ -203,7 +203,7 @@

## $`1d`
 ##  [1] "xx"      "xx."     "xx.x"    "xx.xx"   "xx.xxx"  "xx.xxxx" "xx%"    
-##  [8] "xx.x%"   "xx.xx%"  "xx.xxx%" "(N=xx)"  ">999.9" 
+##  [8] "xx.x%"   "xx.xx%"  "xx.xxx%"
 ## 
 ## $`2d`
 ##  [1] "xx / xx"            "xx. / xx."          "xx.x / xx.x"       
@@ -259,6 +259,7 @@ 

## 4 1 1 1 2 1 1 1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 ## 6 0 0 0 0 0 0 0 0 1 0 3 0 2 0 1 0 0 0 0 0 0 0 ## 8 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 3 1 1 1 2 1 1

+

@@ -291,7 +292,5 @@

- - diff --git a/docs/articles/rtabulate.html b/docs/articles/rtabulate.html index 7220404d2..f062c4b36 100644 --- a/docs/articles/rtabulate.html +++ b/docs/articles/rtabulate.html @@ -18,7 +18,7 @@ -
+
-
+
+

Introduction

@@ -105,13 +105,11 @@

and to get the same numbers with rtabulate we can run

rtabulate(x = Sepal.Length, col_by = Species, FUN = mean)
##               setosa          versicolor        virginica 
-##               (N=50)            (N=50)            (N=50)  
 ## ----------------------------------------------------------
 ## mean          5.006             5.936             6.588

Because rtables also provide formatting options we can pass that info to rtabulate

rtabulate(x = Sepal.Length, col_by = Species, FUN = mean, format = "xx.xx")
##               setosa          versicolor        virginica 
-##               (N=50)            (N=50)            (N=50)  
 ## ----------------------------------------------------------
 ## mean           5.01              5.94              6.59

This vignette will provide an overview of rtabulate and show how different types of tables can be derived with it.

@@ -132,7 +130,6 @@

If x should not be split then the no_by function can be used to specify a column name (as the returned object is still an rtable with one column):

rtabulate(Sepal.Length, no_by("All Data"), sum)
##            All Data
-##            (N=150) 
 ## -------------------
 ## sum         876.5
@@ -144,7 +141,6 @@

rtabulate.numeric returns an rtable with one row and columns according to the levels of col_by.

rtabulate(x = Sepal.Length, col_by = Species, FUN = median)
##                 setosa          versicolor        virginica 
-##                 (N=50)            (N=50)            (N=50)  
 ## ------------------------------------------------------------
 ## median            5                5.9               6.5

@@ -156,7 +152,6 @@

rtabulate(x = is_SL_below_avg, col_by = Species, row.name = "count (percentage)")

##                             setosa          versicolor        virginica 
-##                             (N=50)            (N=50)            (N=50)  
 ## ------------------------------------------------------------------------
 ## count (percentage)        50 (100%)          24 (48%)          6 (12%)

By default FUN=function(x) sum(x) * c(1, 1/length(x)).

@@ -167,7 +162,6 @@

rtabulate.factor returns an rtable with one row per factor level of x.

rtabulate(x = esoph$agegp, col_by = esoph$alcgp)
##              0-39g/day          40-79           80-119            120+   
-##               (N=23)           (N=23)           (N=21)           (N=21)  
 ## -------------------------------------------------------------------------
 ## 25-34            4                4                3                4    
 ## 35-44            4                4                4                3    
@@ -192,7 +186,6 @@ 

rtabulate(x = CO2, row_by_var = "Type", col_by_var = "Treatment",
           FUN = function(xi) sum(xi$uptake))
##                    nonchilled         chilled  
-##                      (N=42)            (N=42)  
 ## -----------------------------------------------
 ## Quebec                742              666.8   
 ## Mississippi           545              332.1
@@ -210,7 +203,6 @@

row.name = "length of cell and row data" )

##                                      setosa          versicolor        virginica 
-##                                      (N=50)            (N=50)            (N=50)  
 ## ---------------------------------------------------------------------------------
 ## length of cell and row data         50 / 150          50 / 150          50 / 150

Next, for rtabulate.factor and rtabulate.data.frame there is an row_col_data_args which when set to TRUE then the FUN function receives three arguments, the data that is associated with a table cell, row, column, respectively.

@@ -225,7 +217,6 @@

format = NULL )

##              3                4                5    
-##           (N=15)           (N=12)            (N=5)  
 ## ----------------------------------------------------
 ## 1        3, 7, 15         4, 7, 12          0, 7, 5 
 ## 2        4, 10, 15        4, 10, 12        2, 10, 5 
@@ -235,6 +226,7 @@ 

## 8 0, 1, 15 0, 1, 12 1, 1, 5

Note that format=NULL is equivalent to paste(x, collapse = ", ") on the cell data structure.

+
@@ -263,7 +255,5 @@

- - diff --git a/docs/authors.html b/docs/authors.html index 2ebf88882..32d9515a4 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -25,9 +25,6 @@ - - - @@ -55,7 +52,7 @@ rtables - 0.1.1 + 0.1.0
@@ -98,7 +95,6 @@ -
@@ -106,8 +102,8 @@ -
-
+
+
@@ -136,8 +132,6 @@

Authors

- - diff --git a/docs/dev/ISSUE_TEMPLATE.html b/docs/dev/ISSUE_TEMPLATE.html new file mode 100644 index 000000000..f2005a029 --- /dev/null +++ b/docs/dev/ISSUE_TEMPLATE.html @@ -0,0 +1,151 @@ + + + + + + + + +Reporting an Issue with rtables • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + +
+ +

Please briefly describe your problem and, when relevant, the output you expect. Please also provide the output of utils::sessionInfo() or devtools::session_info() at the end of your post.

+

If at all possible, please include a minimal, reproducible example. The rtables team will be much more likely to resolve your issue if they are able to reproduce it themselves locally.

+

Please delete this preamble after you have read it.

+
+

your brief description of the problem

+
library(rtables)
+
+# your reproducible example here
+
+ +
+ +
+ + +
+ + +
+

Site built with pkgdown.

+
+ +
+
+ + + + + + diff --git a/docs/dev/LICENSE-text.html b/docs/dev/LICENSE-text.html new file mode 100644 index 000000000..5a134b966 --- /dev/null +++ b/docs/dev/LICENSE-text.html @@ -0,0 +1,382 @@ + + + + + + + + +License • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + +
The rtables package as a whole is distributed under Apache Liscence 
+Vesrion 2 (see below).
+
+The rtables package also includes the following open source software
+components:
+
+- Bootstrap, https://github.com/twbs/bootstrap
+
+
+
+boostrap liscence:
+---------------------------------------------------------------------------
+The MIT License (MIT)
+
+Copyright (c) 2011-2017 Twitter, Inc.
+Copyright (c) 2011-2017 The Bootstrap Authors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+
+
+
+rtables liscence:
+---------------------------------------------------------------------------
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ +
+ +
+ + +
+ + +
+

Site built with pkgdown.

+
+ +
+
+ + + + + + diff --git a/docs/dev/articles/index.html b/docs/dev/articles/index.html new file mode 100644 index 000000000..69682b057 --- /dev/null +++ b/docs/dev/articles/index.html @@ -0,0 +1,137 @@ + + + + + + + + +Articles • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + +
+
+ +
+ + +
+

Site built with pkgdown.

+
+ +
+
+ + + + + + diff --git a/docs/dev/articles/rtables.html b/docs/dev/articles/rtables.html new file mode 100644 index 000000000..ab1542043 --- /dev/null +++ b/docs/dev/articles/rtables.html @@ -0,0 +1,298 @@ + + + + + + + +Introduction to rtables • rtables + + + + + + + + + + +
+
+ + + +
+
+ + + + +
+

+Overview

+

rtable is useful to create tables where multiple values are stored in a cell with a particular format. An rtable object has access to the individual raw values and prints the data with formatting rules such as rounding and pasting. rtables also allow for merging cells within a row.

+

The main functions currently associated with rtables are

+
    +
  • +rtable: collection of rrow objects, column header and default format
  • +
  • +rrow: collection of rcell objects and default format
  • +
  • +rcell: collection of data objects and cell format
  • +
  • +as_html and toString: output an rtable as ascii or html
  • +
+
+
+

+Simple Example

+
library(rtables)
+
tbl <- rtable(
+  header = c("Treatement\nN=100", "Comparison\nN=300"),
+  format = "xx (xx.xx%)",
+  rrow("A", c(104, .2), c(100, .4)),
+  rrow("B", c(23, .4), c(43, .5)),
+  rrow(),
+  rrow("this is a very long section header"),
+  rrow("estimate", rcell(55.23, "xx.xx", colspan = 2)),
+  rrow("95% CI", indent = 1, rcell(c(44.8, 67.4), format = "(xx.x, xx.x)", colspan = 2))
+)
+
+tbl  
+
##                                           Treatement        Comparison
+##                                             N=100             N=300   
+## ----------------------------------------------------------------------
+## A                                         104 (20%)         100 (40%) 
+## B                                          23 (40%)          43 (50%) 
+## 
+## this is a very long section header
+## estimate                                             55.23            
+##   95% CI                                          (44.8, 67.4)
+

Before we go into explaining the individual components used to create this table we continue with the html conversion of the rtable object:

+
as_html(tbl, width = "80%")
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Treatement +
+N=100 +
+Comparison +
+N=300 +
A104 (20%)100 (40%)
B23 (40%)43 (50%)
this is a very long section header
estimate55.23
95% CI(44.8, 67.4)
+

Next, the [ operator lets you access the cell content.

+
tbl[1, 1]
+
## 104 (20%)
+

and to format that cell run format_rcell(tbl[1,1])=104 (20%).

+

Note that tbl[6, 1] and tbl[6, 2] display both the same rcell because of the colspan.

+
+
+

+Viewer

+

The Viewer functions takes an rtable object and displays it with bootstrap styling in RStudio’s Viewer pane.

+
Viewer(tbl)
+

It is also possible to show two tables side by side

+
Viewer(tbl, tbl)
+
+
+

+Formats

+

Cell formats are inherited from rtable to rrow to rcell if there is not a more specific format argument (i.e. format arguments of rcell are more specific than those of rrow which are more specific than those of rtable.

+

Two types of formats are supported:

+
    +
  • format label, e.g. xx.xx (xx.xx%)

  • +
  • functions that take the element and output type as an argument and return a formatted string or html object note, we will eventually deprecate this

  • +
+

Formats labels are currently limited to the following predefined set:

+ +
## $`1d`
+##  [1] "xx"      "xx."     "xx.x"    "xx.xx"   "xx.xxx"  "xx.xxxx" "xx%"    
+##  [8] "xx.x%"   "xx.xx%"  "xx.xxx%" "(N=xx)"  ">999.9" 
+## 
+## $`2d`
+##  [1] "xx / xx"            "xx. / xx."          "xx.x / xx.x"       
+##  [4] "xx.xx / xx.xx"      "xx (xx%)"           "xx (xx.%)"         
+##  [7] "xx (xx.x%)"         "xx (xx.xx%)"        "xx. (xx.%)"        
+## [10] "xx.x (xx.x%)"       "xx.xx (xx.xx%)"     "(xx, xx)"          
+## [13] "(xx., xx.)"         "(xx.x, xx.x)"       "(xx.xx, xx.xx)"    
+## [16] "(xx.xxx, xx.xxx)"   "(xx.xxxx, xx.xxxx)" "xx - xx"           
+## [19] "xx.x - xx.x"        "xx.xx - xx.xx"      "xx.x (xx.x)"       
+## [22] "xx.xx (xx.xx)"      "xx.x, xx.x"         "xx.x to xx.x"      
+## 
+## attr(,"info")
+## [1] "xx does not modify the element, and xx. rounds a number to 0 digits"
+

Here is an example of using functions for formatting cells:

+
my_format <- function(x, output) {
+   paste(x, collapse = "/")
+}
+tbl3 <- rtable(
+  c("A", "B"),
+  format = my_format,
+  rrow("row1", c(1,2,3,4), letters[1:10])
+)
+tbl3
+
##                      A                          B         
+## ----------------------------------------------------------
+## row1              1/2/3/4              a/b/c/d/e/f/g/h/i/j
+
+
+

+Comparing two rtables

+

Because we have the original data for each cell accessible for the rtable data structure it is possible to programmatically compare two tables:

+
t1 <- rtable(header = c("A", "B"), format = "xx", rrow("row 1", 1, 2))
+t2 <- rtable(header = c("A", "B", "C"), format = "xx", rrow("row 1", 1, 2, 3))
+
+compare_rtables(object = t1, expected = t2) 
+
##   1 2 3
+## 1 . . +
+## attr(,"info")
+## [1] column names are not the same
+
+
+

+Converting table objects

+

You can also convert table objects to rtables:

+
as.rtable(table(iris$Species))
+
##            setosa          versicolor        virginica 
+## -------------------------------------------------------
+## 1            50                50                50
+

or

+
print(as.rtable(with(mtcars, table(cyl, hp))), gap = 1)
+
##   52  62  65  66  91  93  95  97  105 109 110 113 123 150 175 180 205 215 230 245 264 335
+## -----------------------------------------------------------------------------------------
+## 4  1   1   1   2   1   1   1   1   0   1   0   1   0   0   0   0   0   0   0   0   0   0 
+## 6  0   0   0   0   0   0   0   0   1   0   3   0   2   0   1   0   0   0   0   0   0   0 
+## 8  0   0   0   0   0   0   0   0   0   0   0   0   0   2   2   3   1   1   1   2   1   1
+
+
+ + + +
+ + +
+ +
+

Site built with pkgdown.

+
+ +
+
+ + + + + diff --git a/docs/dev/articles/rtabulate.html b/docs/dev/articles/rtabulate.html new file mode 100644 index 000000000..a4fdfa0c4 --- /dev/null +++ b/docs/dev/articles/rtabulate.html @@ -0,0 +1,270 @@ + + + + + + + +rtabulate • rtables + + + + + + + + + + +
+
+ + + +
+
+ + + + +
+

+Introduction

+

rtabulate provides a number of methods to compute rtable tables. The idea behind rtabulate is to have a similar function to tapply which returns rtables instead of lists. For example, for the iris data we might be interested in the average Sepal.Length for each Species which can be answered with tapply as follows:

+
attach(iris)
+tapply(X = Sepal.Length, INDEX = Species, FUN = mean)
+
##     setosa versicolor  virginica 
+##      5.006      5.936      6.588
+

and to get the same numbers with rtabulate we can run

+
rtabulate(x = Sepal.Length, col_by = Species, FUN = mean)
+
##               setosa          versicolor        virginica 
+##               (N=50)            (N=50)            (N=50)  
+## ----------------------------------------------------------
+## mean          5.006             5.936             6.588
+

Because rtables also provide formatting options we can pass that info to rtabulate

+
rtabulate(x = Sepal.Length, col_by = Species, FUN = mean, format = "xx.xx")
+
##               setosa          versicolor        virginica 
+##               (N=50)            (N=50)            (N=50)  
+## ----------------------------------------------------------
+## mean           5.01              5.94              6.59
+

This vignette will provide an overview of rtabulate and show how different types of tables can be derived with it.

+
+
+

+Tabulation Methods

+

The tabulation methods follow the split apply combine pattern. That is, for a vector x, a factor col_by, and a function FUN the steps are:

+
    +
  1. split x by col_by +
  2. +
+
x_s <- split(x, col_by)
+
    +
  1. apply the function FUN to each element, e.g. FUN(x_s[[1]]), FUN(x_s[[2]]), etc…, which either should return an rcell or a data structure that gets wrapped into an rcell

  2. +
  3. combine the rcells to an rrow and create an rtable with a header according to the levels of col_by

  4. +
+

If x should not be split then the no_by function can be used to specify a column name (as the returned object is still an rtable with one column):

+
rtabulate(Sepal.Length, no_by("All Data"), sum)
+
##            All Data
+##            (N=150) 
+## -------------------
+## sum         876.5
+
+

+Cell Data Based Tabulation

+
+

+Tabulating Numerical Data

+

rtabulate.numeric returns an rtable with one row and columns according to the levels of col_by.

+
rtabulate(x = Sepal.Length, col_by = Species, FUN = median)
+
##                 setosa          versicolor        virginica 
+##                 (N=50)            (N=50)            (N=50)  
+## ------------------------------------------------------------
+## median            5                5.9               6.5
+
+
+

+Tabulating Boolean Data

+

Like rtabulate.numeric, rtabulate.logical returns an rtable with one row and columns according to the levels of col_by.

+
is_SL_below_avg <- Sepal.Length < mean(Sepal.Length)
+
+rtabulate(x = is_SL_below_avg, col_by = Species, row.name = "count (percentage)")
+
##                             setosa          versicolor        virginica 
+##                             (N=50)            (N=50)            (N=50)  
+## ------------------------------------------------------------------------
+## count (percentage)        50 (100%)          24 (48%)          6 (12%)
+

By default FUN=function(x) sum(x) * c(1, 1/length(x)).

+
+
+

+Tabulating Factors

+

rtabulate.factor returns an rtable with one row per factor level of x.

+
rtabulate(x = esoph$agegp, col_by = esoph$alcgp)
+
##              0-39g/day          40-79           80-119            120+   
+##               (N=23)           (N=23)           (N=21)           (N=21)  
+## -------------------------------------------------------------------------
+## 25-34            4                4                3                4    
+## 35-44            4                4                4                3    
+## 45-54            4                4                4                4    
+## 55-64            4                4                4                4    
+## 65-74            4                3                4                4    
+## 75+              3                4                2                2
+
+
+

+Tabulation based on Data Frames

+

rtabulate.data.frame has a data.frame as x argument and the col_by_var and row_by_var need to specify which factor variables with x should be used to split the data for the table rows and columns. By default the argument to FUN is then a subset of x that is associated with a particular table cell. Let’s look at the CO2 dataset:

+
head(CO2)
+
##   Plant   Type  Treatment conc uptake
+## 1   Qn1 Quebec nonchilled   95   16.0
+## 2   Qn1 Quebec nonchilled  175   30.4
+## 3   Qn1 Quebec nonchilled  250   34.8
+## 4   Qn1 Quebec nonchilled  350   37.2
+## 5   Qn1 Quebec nonchilled  500   35.3
+## 6   Qn1 Quebec nonchilled  675   39.2
+

Say we want to calculate the total uptake for each Type and Treatment

+
rtabulate(x = CO2, row_by_var = "Type", col_by_var = "Treatment",
+          FUN = function(xi) sum(xi$uptake))
+
##                    nonchilled         chilled  
+##                      (N=42)            (N=42)  
+## -----------------------------------------------
+## Quebec                742              666.8   
+## Mississippi           545              332.1
+
+
+
+

+Cell Data, Row Data, Column Data based Tabulation

+

rtabulate.numeric and rtabulate.logical have the argument row_data_arg which is by default set to FALSE. If set to TRUE then FUN receives a second argument with a copy of the x argument (as the row-associated data is the whole data for a numeric and logical vector).

+
rtabulate(
+  Sepal.Length, Species,
+  FUN = function(x_cell, x_row) c(length(x_cell), length(x_row)),
+  row_data_arg = TRUE,
+  format = "xx / xx", 
+  row.name = "length of cell and row data"
+)
+
##                                      setosa          versicolor        virginica 
+##                                      (N=50)            (N=50)            (N=50)  
+## ---------------------------------------------------------------------------------
+## length of cell and row data         50 / 150          50 / 150          50 / 150
+

Next, for rtabulate.factor and rtabulate.data.frame there is an row_col_data_args which when set to TRUE then the FUN function receives three arguments, the data that is associated with a table cell, row, column, respectively.

+
mtcars2 <- mtcars
+mtcars2$gear <- factor(mtcars2$gear)
+mtcars2$carb <- factor(mtcars2$carb)
+
+rtabulate(
+  x = mtcars2, row_by_var = "carb", col_by_var = "gear",
+  FUN = function(x_cell, x_row, x_col) c(nrow(x_cell), nrow(x_row), nrow(x_col)),
+  row_col_data_args = TRUE,
+  format = NULL
+)
+
##              3                4                5    
+##           (N=15)           (N=12)            (N=5)  
+## ----------------------------------------------------
+## 1        3, 7, 15         4, 7, 12          0, 7, 5 
+## 2        4, 10, 15        4, 10, 12        2, 10, 5 
+## 3        3, 3, 15         0, 3, 12          0, 3, 5 
+## 4        5, 10, 15        4, 10, 12        1, 10, 5 
+## 6        0, 1, 15         0, 1, 12          1, 1, 5 
+## 8        0, 1, 15         0, 1, 12          1, 1, 5
+

Note that format=NULL is equivalent to paste(x, collapse = ", ") on the cell data structure.

+
+
+
+ + + +
+ + +
+ +
+

Site built with pkgdown.

+
+ +
+
+ + + + + diff --git a/docs/dev/authors.html b/docs/dev/authors.html new file mode 100644 index 000000000..d27726b9b --- /dev/null +++ b/docs/dev/authors.html @@ -0,0 +1,146 @@ + + + + + + + + +Authors • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + +
    +
  • +

    Adrian Waddell. Author, maintainer. +

    +
  • +
+ +
+ +
+ + +
+ + +
+

Site built with pkgdown.

+
+ +
+
+ + + + + + diff --git a/docs/dev/docsearch.css b/docs/dev/docsearch.css new file mode 100644 index 000000000..e5f1fe1df --- /dev/null +++ b/docs/dev/docsearch.css @@ -0,0 +1,148 @@ +/* Docsearch -------------------------------------------------------------- */ +/* + Source: https://github.com/algolia/docsearch/ + License: MIT +*/ + +.algolia-autocomplete { + display: block; + -webkit-box-flex: 1; + -ms-flex: 1; + flex: 1 +} + +.algolia-autocomplete .ds-dropdown-menu { + width: 100%; + min-width: none; + max-width: none; + padding: .75rem 0; + background-color: #fff; + background-clip: padding-box; + border: 1px solid rgba(0, 0, 0, .1); + box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .175); +} + +@media (min-width:768px) { + .algolia-autocomplete .ds-dropdown-menu { + width: 175% + } +} + +.algolia-autocomplete .ds-dropdown-menu::before { + display: none +} + +.algolia-autocomplete .ds-dropdown-menu [class^=ds-dataset-] { + padding: 0; + background-color: rgb(255,255,255); + border: 0; + max-height: 80vh; +} + +.algolia-autocomplete .ds-dropdown-menu .ds-suggestions { + margin-top: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion { + padding: 0; + overflow: visible +} + +.algolia-autocomplete .algolia-docsearch-suggestion--category-header { + padding: .125rem 1rem; + margin-top: 0; + font-size: 1.3em; + font-weight: 500; + color: #00008B; + border-bottom: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--wrapper { + float: none; + padding-top: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column { + float: none; + width: auto; + padding: 0; + text-align: left +} + +.algolia-autocomplete .algolia-docsearch-suggestion--content { + float: none; + width: auto; + padding: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--content::before { + display: none +} + +.algolia-autocomplete .ds-suggestion:not(:first-child) .algolia-docsearch-suggestion--category-header { + padding-top: .75rem; + margin-top: .75rem; + border-top: 1px solid rgba(0, 0, 0, .1) +} + +.algolia-autocomplete .ds-suggestion .algolia-docsearch-suggestion--subcategory-column { + display: block; + padding: .1rem 1rem; + margin-bottom: 0.1; + font-size: 1.0em; + font-weight: 400 + /* display: none */ +} + +.algolia-autocomplete .algolia-docsearch-suggestion--title { + display: block; + padding: .25rem 1rem; + margin-bottom: 0; + font-size: 0.9em; + font-weight: 400 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--text { + padding: 0 1rem .5rem; + margin-top: -.25rem; + font-size: 0.8em; + font-weight: 400; + line-height: 1.25 +} + +.algolia-autocomplete .algolia-docsearch-footer { + width: 110px; + height: 20px; + z-index: 3; + margin-top: 10.66667px; + float: right; + font-size: 0; + line-height: 0; +} + +.algolia-autocomplete .algolia-docsearch-footer--logo { + background-image: url("data:image/svg+xml;utf8,"); + background-repeat: no-repeat; + background-position: 50%; + background-size: 100%; + overflow: hidden; + text-indent: -9000px; + width: 100%; + height: 100%; + display: block; + transform: translate(-8px); +} + +.algolia-autocomplete .algolia-docsearch-suggestion--highlight { + color: #FF8C00; + background: rgba(232, 189, 54, 0.1) +} + + +.algolia-autocomplete .algolia-docsearch-suggestion--text .algolia-docsearch-suggestion--highlight { + box-shadow: inset 0 -2px 0 0 rgba(105, 105, 105, .5) +} + +.algolia-autocomplete .ds-suggestion.ds-cursor .algolia-docsearch-suggestion--content { + background-color: rgba(192, 192, 192, .15) +} diff --git a/docs/dev/docsearch.js b/docs/dev/docsearch.js new file mode 100644 index 000000000..b35504cd3 --- /dev/null +++ b/docs/dev/docsearch.js @@ -0,0 +1,85 @@ +$(function() { + + // register a handler to move the focus to the search bar + // upon pressing shift + "/" (i.e. "?") + $(document).on('keydown', function(e) { + if (e.shiftKey && e.keyCode == 191) { + e.preventDefault(); + $("#search-input").focus(); + } + }); + + $(document).ready(function() { + // do keyword highlighting + /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ + var mark = function() { + + var referrer = document.URL ; + var paramKey = "q" ; + + if (referrer.indexOf("?") !== -1) { + var qs = referrer.substr(referrer.indexOf('?') + 1); + var qs_noanchor = qs.split('#')[0]; + var qsa = qs_noanchor.split('&'); + var keyword = ""; + + for (var i = 0; i < qsa.length; i++) { + var currentParam = qsa[i].split('='); + + if (currentParam.length !== 2) { + continue; + } + + if (currentParam[0] == paramKey) { + keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); + } + } + + if (keyword !== "") { + $(".contents").unmark({ + done: function() { + $(".contents").mark(keyword); + } + }); + } + } + }; + + mark(); + }); +}); + +/* Search term highlighting ------------------------------*/ + +function matchedWords(hit) { + var words = []; + + var hierarchy = hit._highlightResult.hierarchy; + // loop to fetch from lvl0, lvl1, etc. + for (var idx in hierarchy) { + words = words.concat(hierarchy[idx].matchedWords); + } + + var content = hit._highlightResult.content; + if (content) { + words = words.concat(content.matchedWords); + } + + // return unique words + var words_uniq = [...new Set(words)]; + return words_uniq; +} + +function updateHitURL(hit) { + + var words = matchedWords(hit); + var url = ""; + + if (hit.anchor) { + url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; + } else { + url = hit.url + '?q=' + escape(words.join(" ")); + } + + return url; +} diff --git a/docs/dev/index.html b/docs/dev/index.html new file mode 100644 index 000000000..6bac0b0b4 --- /dev/null +++ b/docs/dev/index.html @@ -0,0 +1,209 @@ + + + + + + + +Reporting Tables • rtables + + + + + + + + + + +
+
+ + + +
+
+ + + + + +
+ + +
+

+Reporting tables with R

+

The rtables R package is a prototype to create and display complex tables with R. The cells in an rtable may contain any high-dimensional data structure which can then be displayed with cell-specific formatting instructions. Currently, rtables can be outputted in ascii and html.

+

Some of our requirements and reasons to create this new table package are:

+
    +
  • multiple values displayed within a cell
  • +
  • values need to be programmatically accessible for cross-checking
  • +
  • flexible formatting (cell spans, rounding, alignment, etc.)
  • +
  • composition of an rtable object from other rtable objects
  • +
  • multiple output formats (html, ascii, latex, pdf)
  • +
  • flexible pagination
  • +
+

Note that the current state of rtables does not fulfill all of those requirements. We are looking for collaborators, see the next section.

+
+
+

+Collaboration and Planned API Changes

+

The current state of the rtables functionality is a first rough prototype. We will be changing the API significantly in the coming months without maintaining backward compatibility. We will release the rtable package on CRAN once we have a stable version.

+

We are looking for collaborators to help define and shape the rtables package. Please contact me if you would like to align your contributions to the current development plans or feel free to fork the repository and to send us pull requests with the suggested improvements.

+
+
+

+Installation

+

To install the stable release of rtables package run the following command in R:

+
devtools::install_github("roche/rtables", ref="v0.1.0")
+

To install the test version of rtables run

+
devtools::install_github("roche/rtables")
+
+
+

+Usage

+
library(rtables)
+tbl <- rtable(
+  header = c("Treatement\nN=100", "Comparison\nN=300"),
+  format = "xx (xx.xx%)",
+  rrow("A", c(104, .2), c(100, .4)),
+  rrow("B", c(23, .4), c(43, .5)),
+  rrow(),
+  rrow("this is a very long section header"),
+  rrow("estimate", rcell(55.23, "xx.xx", colspan = 2)),
+  rrow("95% CI", indent = 1, rcell(c(44.8, 67.4), format = "(xx.x, xx.x)", colspan = 2))
+)
+tbl
+#>                                           Treatement        Comparison
+#>                                             N=100             N=300   
+#> ----------------------------------------------------------------------
+#> A                                         104 (20%)         100 (40%) 
+#> B                                          23 (40%)          43 (50%) 
+#> 
+#> this is a very long section header
+#> estimate                                             55.23            
+#>   95% CI                                          (44.8, 67.4)
+
+
+

+Presentations

+ +
+
+
+ + + +
+ + +
+ +
+

Site built with pkgdown.

+
+ +
+
+ + + + + diff --git a/docs/dev/link.svg b/docs/dev/link.svg new file mode 100644 index 000000000..88ad82769 --- /dev/null +++ b/docs/dev/link.svg @@ -0,0 +1,12 @@ + + + + + + diff --git a/docs/dev/news/index.html b/docs/dev/news/index.html new file mode 100644 index 000000000..85a009b5a --- /dev/null +++ b/docs/dev/news/index.html @@ -0,0 +1,183 @@ + + + + + + + + +Changelog • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + +
+

+rtable 0.1.1

+
    +
  • added sprintf_format for formatting rcells (thanks to Doug Kelkhoff for the suggestion)
  • +
  • added "(N=xx)" and ">999.9" format labels
  • +
  • +rtabulate has now an argument col_total and shows by default the numbers of elements associated with a column
  • +
+
+
+

+rtable 0.1.0

+

Version 0.1.0 is a major re-design with lots of internal refactoring and the following API changes:

+
    +
  • Redesign: rtable has now header argument instead of col.names. A header can be created with rheader and is a collection of rrows. If header is set to c("A", "B") then rtable will create the rheader with a single rrow and by setting row.name to NULL.

  • +
  • header and header<- function added

  • +
  • renamed get_rcell_formats to list_rcell_format_labels

  • +
  • If rcell format is NULL then the cell content will be converted to a string with paste(as.character(x), collapse = ', ')

  • +
  • accessor [i,] works now to subset a table.

  • +
  • rbind method for rtables

  • +
  • row.names<-.rtable method

  • +
  • rtabulate added for creating tables

  • +
  • indented_row.names function added

  • +
+
+
+

+rtable 0.0.1

+
    +
  • Initial public release
  • +
+
+
+ + + +
+ +
+ + +
+

Site built with pkgdown.

+
+ +
+
+ + + + + + diff --git a/docs/dev/pkgdown.css b/docs/dev/pkgdown.css new file mode 100644 index 000000000..6ca2f37ab --- /dev/null +++ b/docs/dev/pkgdown.css @@ -0,0 +1,232 @@ +/* Sticky footer */ + +/** + * Basic idea: https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/ + * Details: https://github.com/philipwalton/solved-by-flexbox/blob/master/assets/css/components/site.css + * + * .Site -> body > .container + * .Site-content -> body > .container .row + * .footer -> footer + * + * Key idea seems to be to ensure that .container and __all its parents__ + * have height set to 100% + * + */ + +html, body { + height: 100%; +} + +body > .container { + display: flex; + height: 100%; + flex-direction: column; + + padding-top: 60px; +} + +body > .container .row { + flex: 1 0 auto; +} + +footer { + margin-top: 45px; + padding: 35px 0 36px; + border-top: 1px solid #e5e5e5; + color: #666; + display: flex; + flex-shrink: 0; +} +footer p { + margin-bottom: 0; +} +footer div { + flex: 1; +} +footer .pkgdown { + text-align: right; +} +footer p { + margin-bottom: 0; +} + +img.icon { + float: right; +} + +img { + max-width: 100%; +} + +/* Typographic tweaking ---------------------------------*/ + +.contents h1.page-header { + margin-top: calc(-60px + 1em); +} + +/* Section anchors ---------------------------------*/ + +a.anchor { + margin-left: -30px; + display:inline-block; + width: 30px; + height: 30px; + visibility: hidden; + + background-image: url(./link.svg); + background-repeat: no-repeat; + background-size: 20px 20px; + background-position: center center; +} + +.hasAnchor:hover a.anchor { + visibility: visible; +} + +@media (max-width: 767px) { + .hasAnchor:hover a.anchor { + visibility: hidden; + } +} + + +/* Fixes for fixed navbar --------------------------*/ + +.contents h1, .contents h2, .contents h3, .contents h4 { + padding-top: 60px; + margin-top: -40px; +} + +/* Static header placement on mobile devices */ +@media (max-width: 767px) { + .navbar-fixed-top { + position: absolute; + } + .navbar { + padding: 0; + } +} + + +/* Sidebar --------------------------*/ + +#sidebar { + margin-top: 30px; +} +#sidebar h2 { + font-size: 1.5em; + margin-top: 1em; +} + +#sidebar h2:first-child { + margin-top: 0; +} + +#sidebar .list-unstyled li { + margin-bottom: 0.5em; +} + +.orcid { + height: 16px; + vertical-align: middle; +} + +/* Reference index & topics ----------------------------------------------- */ + +.ref-index th {font-weight: normal;} + +.ref-index td {vertical-align: top;} +.ref-index .alias {width: 40%;} +.ref-index .title {width: 60%;} + +.ref-index .alias {width: 40%;} +.ref-index .title {width: 60%;} + +.ref-arguments th {text-align: right; padding-right: 10px;} +.ref-arguments th, .ref-arguments td {vertical-align: top;} +.ref-arguments .name {width: 20%;} +.ref-arguments .desc {width: 80%;} + +/* Nice scrolling for wide elements --------------------------------------- */ + +table { + display: block; + overflow: auto; +} + +/* Syntax highlighting ---------------------------------------------------- */ + +pre { + word-wrap: normal; + word-break: normal; + border: 1px solid #eee; +} + +pre, code { + background-color: #f8f8f8; + color: #333; +} + +pre code { + overflow: auto; + word-wrap: normal; + white-space: pre; +} + +pre .img { + margin: 5px 0; +} + +pre .img img { + background-color: #fff; + display: block; + height: auto; +} + +code a, pre a { + color: #375f84; +} + +a.sourceLine:hover { + text-decoration: none; +} + +.fl {color: #1514b5;} +.fu {color: #000000;} /* function */ +.ch,.st {color: #036a07;} /* string */ +.kw {color: #264D66;} /* keyword */ +.co {color: #888888;} /* comment */ + +.message { color: black; font-weight: bolder;} +.error { color: orange; font-weight: bolder;} +.warning { color: #6A0366; font-weight: bolder;} + +/* Clipboard --------------------------*/ + +.hasCopyButton { + position: relative; +} + +.btn-copy-ex { + position: absolute; + right: 0; + top: 0; + visibility: hidden; +} + +.hasCopyButton:hover button.btn-copy-ex { + visibility: visible; +} + +/* mark.js ----------------------------*/ + +mark { + background-color: rgba(255, 255, 51, 0.5); + border-bottom: 2px solid rgba(255, 153, 51, 0.3); + padding: 1px; +} + +/* vertical spacing after htmlwidgets */ +.html-widget { + margin-bottom: 10px; +} diff --git a/docs/dev/pkgdown.js b/docs/dev/pkgdown.js new file mode 100644 index 000000000..de9bd7247 --- /dev/null +++ b/docs/dev/pkgdown.js @@ -0,0 +1,110 @@ +/* http://gregfranko.com/blog/jquery-best-practices/ */ +(function($) { + $(function() { + + $("#sidebar") + .stick_in_parent({offset_top: 40}) + .on('sticky_kit:bottom', function(e) { + $(this).parent().css('position', 'static'); + }) + .on('sticky_kit:unbottom', function(e) { + $(this).parent().css('position', 'relative'); + }); + + $('body').scrollspy({ + target: '#sidebar', + offset: 60 + }); + + $('[data-toggle="tooltip"]').tooltip(); + + var cur_path = paths(location.pathname); + var links = $("#navbar ul li a"); + var max_length = -1; + var pos = -1; + for (var i = 0; i < links.length; i++) { + if (links[i].getAttribute("href") === "#") + continue; + var path = paths(links[i].pathname); + + var length = prefix_length(cur_path, path); + if (length > max_length) { + max_length = length; + pos = i; + } + } + + // Add class to parent
  • , and enclosing
  • if in dropdown + if (pos >= 0) { + var menu_anchor = $(links[pos]); + menu_anchor.parent().addClass("active"); + menu_anchor.closest("li.dropdown").addClass("active"); + } + }); + + function paths(pathname) { + var pieces = pathname.split("/"); + pieces.shift(); // always starts with / + + var end = pieces[pieces.length - 1]; + if (end === "index.html" || end === "") + pieces.pop(); + return(pieces); + } + + function prefix_length(needle, haystack) { + if (needle.length > haystack.length) + return(0); + + // Special case for length-0 haystack, since for loop won't run + if (haystack.length === 0) { + return(needle.length === 0 ? 1 : 0); + } + + for (var i = 0; i < haystack.length; i++) { + if (needle[i] != haystack[i]) + return(i); + } + + return(haystack.length); + } + + /* Clipboard --------------------------*/ + + function changeTooltipMessage(element, msg) { + var tooltipOriginalTitle=element.getAttribute('data-original-title'); + element.setAttribute('data-original-title', msg); + $(element).tooltip('show'); + element.setAttribute('data-original-title', tooltipOriginalTitle); + } + + if(Clipboard.isSupported()) { + $(document).ready(function() { + var copyButton = ""; + + $(".examples, div.sourceCode").addClass("hasCopyButton"); + + // Insert copy buttons: + $(copyButton).prependTo(".hasCopyButton"); + + // Initialize tooltips: + $('.btn-copy-ex').tooltip({container: 'body'}); + + // Initialize clipboard: + var clipboardBtnCopies = new Clipboard('[data-clipboard-copy]', { + text: function(trigger) { + return trigger.parentNode.textContent; + } + }); + + clipboardBtnCopies.on('success', function(e) { + changeTooltipMessage(e.trigger, 'Copied!'); + e.clearSelection(); + }); + + clipboardBtnCopies.on('error', function() { + changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); + }); + }); + } +})(window.jQuery || window.$) diff --git a/docs/dev/pkgdown.yml b/docs/dev/pkgdown.yml new file mode 100644 index 000000000..5b1127157 --- /dev/null +++ b/docs/dev/pkgdown.yml @@ -0,0 +1,7 @@ +pandoc: 1.19.2.1 +pkgdown: 1.1.0.9000 +pkgdown_sha: bcf6299e76d4a398aadfc476b3ac22d253a91d35 +articles: + rtables: rtables.html + rtabulate: rtabulate.html + diff --git a/docs/dev/reference/Viewer.html b/docs/dev/reference/Viewer.html new file mode 100644 index 000000000..a1184c8d4 --- /dev/null +++ b/docs/dev/reference/Viewer.html @@ -0,0 +1,178 @@ + + + + + + + + +Dispaly an <code><a href='rtable.html'>rtable</a></code> object in the Viewer pane in RStudio or in a +browser — Viewer • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    The table will be displayed using the bootstrap styling for tables.

    + +
    + +
    Viewer(x, y = NULL, row.names.bold = FALSE)
    + +

    Arguments

    + + + + + + + + + + + + + + +
    x

    an rtable object

    y

    optional second rtable object

    row.names.bold

    row.names.bold boolean, make rownames bold

    + + +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/as.rtable.html b/docs/dev/reference/as.rtable.html new file mode 100644 index 000000000..a582c1cf9 --- /dev/null +++ b/docs/dev/reference/as.rtable.html @@ -0,0 +1,171 @@ + + + + + + + + +Convert an object to an <code><a href='rtable.html'>rtable</a></code> object — as.rtable • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Generic for converting objects to an rtable object

    + +
    + +
    as.rtable(x, format = "xx")
    + +

    Arguments

    + + + + + + + + + + +
    x

    an rtable object

    format

    format of the cells

    + + +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/as.rtable.table.html b/docs/dev/reference/as.rtable.table.html new file mode 100644 index 000000000..51126ca3b --- /dev/null +++ b/docs/dev/reference/as.rtable.table.html @@ -0,0 +1,194 @@ + + + + + + + + +Convert a table object to an <code><a href='rtable.html'>rtable</a></code> — as.rtable.table • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Convert a table object to an rtable

    + +
    + +
    # S3 method for table
    +as.rtable(x, format = "xx")
    + +

    Arguments

    + + + + + + + + + + +
    x

    an rtable object

    format

    format of the cells

    + + +

    Examples

    +
    +tbl <- as.rtable(table(iris$Species)) +tbl
    #> setosa versicolor virginica +#> ------------------------------------------------------- +#> 1 50 50 50
    +
    # NOT RUN { +Viewer(tbl) +# }
    + +tbl <- as.rtable(table(sample(letters[1:4], 200, TRUE), sample(LETTERS[1:4], 200, TRUE))) +tbl
    #> A B C D +#> ----------------------------------------- +#> a 12 8 15 13 +#> b 13 6 12 17 +#> c 14 10 10 17 +#> d 16 7 14 16
    # NOT RUN { +Viewer(tbl, row.names.bold = TRUE) +# }
    +
    +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/as_html.default.html b/docs/dev/reference/as_html.default.html new file mode 100644 index 000000000..bbe7bed9e --- /dev/null +++ b/docs/dev/reference/as_html.default.html @@ -0,0 +1,172 @@ + + + + + + + + +Generic for as_html — as_html.default • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Generic method for as_html

    + +
    + +
    # S3 method for default
    +as_html(x, ...)
    + +

    Arguments

    + + + + + + + + + + +
    x

    object

    ...

    additional arguments currently not used

    + + +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/as_html.html b/docs/dev/reference/as_html.html new file mode 100644 index 000000000..98d6f955c --- /dev/null +++ b/docs/dev/reference/as_html.html @@ -0,0 +1,216 @@ + + + + + + + + +Convert an <code><a href='rtable.html'>rtable</a></code> object to an <code>shiny.tag</code> html +representation of the <code><a href='rtable.html'>rtable</a></code> — as_html • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    The returned html object can be immediately used in shiny and rmarkdown

    + +
    + +
    as_html(x, ...)
    + +

    Arguments

    + + + + + + + + + + +
    x

    an rtable object

    ...

    arguments passed as attributes to the table html objet

    + +

    Value

    + +

    an object of class shiny.tag

    + + +

    Examples

    +
    +tbl <- rtable( + header = LETTERS[1:3], + format = "xx", + rrow("r1", 1,2,3), + rrow("r2", 4,3,2, indent = 1), + rrow("r3", indent = 2) +) + +as_html(tbl)
    #> <table class="table table-condensed table-hover"> +#> <tr> +#> <th class="rowname text-left"></th> +#> <th class="text-center">A</th> +#> <th class="text-center">B</th> +#> <th class="text-center">C</th> +#> </tr> +#> <tr> +#> <td class="rowname text-left">r1</td> +#> <td class="text-center">1</td> +#> <td class="text-center">2</td> +#> <td class="text-center">3</td> +#> </tr> +#> <tr> +#> <td class="rowname text-left" style="padding-left: 3ch">r2</td> +#> <td class="text-center">4</td> +#> <td class="text-center">3</td> +#> <td class="text-center">2</td> +#> </tr> +#> <tr> +#> <td class="rowname text-left" colspan="4" style="padding-left: 6ch">r3</td> +#> </tr> +#> </table>
    +
    +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/compare_rtables.html b/docs/dev/reference/compare_rtables.html new file mode 100644 index 000000000..52db7a4bf --- /dev/null +++ b/docs/dev/reference/compare_rtables.html @@ -0,0 +1,269 @@ + + + + + + + + +Corpare two rtables — compare_rtables • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Prints a matrix where . means cell matches, X means cell does +cells do not match, + cell (row) is missing, and - cell (row) +should not be there.

    + +
    + +
    compare_rtables(object, expected, tol = 0.1, comp.attr = TRUE)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + +
    object

    rtable to test

    expected

    rtable expected

    tol

    numerical tolorance

    comp.attr

    boolean compare attributes

    + + +

    Examples

    +
    +t1 <- rtable(header = c("A", "B"), format = "xx", rrow("row 1", 1, 2)) +t2 <- rtable(header = c("A", "B", "C"), format = "xx", rrow("row 1", 1, 2, 3)) + +compare_rtables(object = t1, expected = t2)
    #> 1 2 3 +#> 1 . . + +#> attr(,"info") +#> [1] column names are not the same
    +
    # NOT RUN { +Viewer(t1, t2) +# }
    +expected <- rtable( + header = c("ARM A\nN=100", "ARM B\nN=200"), + format = "xx", + rrow("row 1", 10, 15), + rrow(), + rrow("section title"), + rrow("row colspan", rcell(c(.345543, .4432423), colspan = 2, format = "(xx.xx, xx.xx)")) +)
    # NOT RUN { +Viewer(expected) +# }
    +object <- rtable( + header = c("ARM A\nN=100", "ARM B\nN=200"), + format = "xx", + rrow("row 1", 10, 15), + rrow("section title"), + rrow("row colspan", rcell(c(.345543, .4432423), colspan = 2, format = "(xx.xx, xx.xx)")) +) + +compare_rtables(object, expected)
    #> 1 2 +#> 1 . . +#> 2 . . +#> 3 X X +#> 4 + +
    +compare_rtables(object, expected, comp.attr = FALSE)
    #> 1 2 +#> 1 . . +#> 2 . . +#> 3 X X +#> 4 + + +#> attr(,"info") +#> [1] cell attributes have not been compared
    +object <- rtable( + header = c("ARM A\nN=100", "ARM B\nN=200"), + format = "xx", + rrow("row 1", 10, 15), + rrow(), + rrow("section title") +) + +compare_rtables(object, expected)
    #> 1 2 +#> 1 . . +#> 2 . . +#> 3 . . +#> 4 + +
    +object <- rtable( + header = c("ARM A\nN=100", "ARM B\nN=200"), + format = "xx", + rrow("row 1", 14, 15.03), + rrow(), + rrow("section title"), + rrow("row colspan", rcell(c(.345543, .4432423), colspan = 2, format = "(xx.xx, xx.xx)")) +) + +compare_rtables(object, expected)
    #> 1 2 +#> 1 X . +#> 2 . . +#> 3 . . +#> 4 . .
    +object <- rtable( + header = c("ARM A\nN=100", "ARM B\nN=200"), + format = "xx", + rrow("row 1", 10, 15), + rrow(), + rrow("section title"), + rrow("row colspan", rcell(c(.345543, .4432423), colspan = 2, format = "(xx.x, xx.x)")) +) + +compare_rtables(object, expected)
    #> 1 2 +#> 1 . . +#> 2 . . +#> 3 . . +#> 4 X X
    +
    +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/dim.rheader.html b/docs/dev/reference/dim.rheader.html new file mode 100644 index 000000000..5e1a7b490 --- /dev/null +++ b/docs/dev/reference/dim.rheader.html @@ -0,0 +1,174 @@ + + + + + + + + +Dimension of rtable object — dim.rheader • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Retrieve or set the dimension of an rtable object

    + +
    + +
    # S3 method for rheader
    +dim(x)
    + +

    Arguments

    + + + + + + +
    x

    an rtable object

    + +

    Value

    + +

    vector of length two with number of rows and number of columns.

    + + +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/dim.rtable.html b/docs/dev/reference/dim.rtable.html new file mode 100644 index 000000000..7f0823d66 --- /dev/null +++ b/docs/dev/reference/dim.rtable.html @@ -0,0 +1,174 @@ + + + + + + + + +Dimension of rtable object — dim.rtable • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Retrieve or set the dimension of an rtable object

    + +
    + +
    # S3 method for rtable
    +dim(x)
    + +

    Arguments

    + + + + + + +
    x

    an rtable object

    + +

    Value

    + +

    vector of length two with number of rows and number of columns.

    + + +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/format_rcell.html b/docs/dev/reference/format_rcell.html new file mode 100644 index 000000000..dc8b0d342 --- /dev/null +++ b/docs/dev/reference/format_rcell.html @@ -0,0 +1,183 @@ + + + + + + + + +Convert the contets of an <code><a href='rcell.html'>rcell</a></code> to a string using the +<code>format</code> information — format_rcell • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Convert the contets of an rcell to a string using the +format information

    + +
    + +
    format_rcell(x, format, output = c("ascii", "html"))
    + +

    Arguments

    + + + + + + + + + + + + + + +
    x

    an object of class rcell

    format

    a valid format string or a format function for +rcells. To get a list of all valid format strings use +list_rcell_format_labels. If format is NULL then the elements +of a cell get pasted separated by a comma.

    output

    output type

    + + +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/header-set.html b/docs/dev/reference/header-set.html new file mode 100644 index 000000000..12eb09b1c --- /dev/null +++ b/docs/dev/reference/header-set.html @@ -0,0 +1,179 @@ + + + + + + + + +Change Header of Rtable — header<- • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Change Header of Rtable

    + +
    + +
    header(x) <- value
    + +

    Arguments

    + + + + + + + + + + +
    x

    an rtable object

    value

    an rheader object

    + + +

    Examples

    +
    x <- rtable(header = letters[1:3], rrow("row 1", 1,2,3)) +header(x) <- rheader(rrow("a", "a", "b", "d")) +x
    #> a a b d +#> -------------------------------- +#> row 1 1 2 3
    +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/header.html b/docs/dev/reference/header.html new file mode 100644 index 000000000..de505990f --- /dev/null +++ b/docs/dev/reference/header.html @@ -0,0 +1,186 @@ + + + + + + + + +Get Header ot Rtable — header • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Get Header ot Rtable

    + +
    + +
    header(x)
    + +

    Arguments

    + + + + + + +
    x

    an rtable object

    + +

    Value

    + +

    an rheader object

    + + +

    Examples

    +
    x <- rtable(header = letters[1:3], rrow("row 1", 1,2,3)) +header(x)
    #> [[1]] +#> a b c +#> +#> attr(,"nrow") +#> [1] 1 +#> attr(,"ncol") +#> [1] 3 +#> attr(,"class") +#> [1] "rheader"
    +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/indented_row.names.html b/docs/dev/reference/indented_row.names.html new file mode 100644 index 000000000..9254e0266 --- /dev/null +++ b/docs/dev/reference/indented_row.names.html @@ -0,0 +1,177 @@ + + + + + + + + +Row names of an <code><a href='rtable.html'>rtable</a></code> object with spaces — indented_row.names • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Retrieve the row names of an rtable object

    + +
    + +
    indented_row.names(x, spaces = 2)
    + +

    Arguments

    + + + + + + + + + + +
    x

    an rtable object

    spaces

    numeric number of spaces per indent level

    + +

    Value

    + +

    a vector with the row names

    + + +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/index.html b/docs/dev/reference/index.html new file mode 100644 index 000000000..763a524d4 --- /dev/null +++ b/docs/dev/reference/index.html @@ -0,0 +1,387 @@ + + + + + + + + +Function reference • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    Core Table Create Functions

    +

    These are the main functions needed to build an rtable.

    +
    +

    rtable()

    +

    Create a Reporting Table

    +

    rrow()

    +

    Reporting Table Row

    +

    rcell()

    +

    Reporting Table Cell

    +

    rheader()

    +

    Create a rheader object

    +

    rtablel()

    +

    Create an rtable from rrows stored in a list

    +

    rrowl()

    +

    Create an rrow with cell-data stored within lists

    + +

    +
    +

    format_rcell()

    +

    Convert the contets of an rcell to a string using the +format information

    +

    list_rcell_format_labels()

    +

    List with valid rcell formats labels grouped by 1d and 2d

    +

    Accessor Functions

    +

    Access and Modify Functions

    +
    +

    names(<rtable>)

    +

    Get column names of an rtable object

    +

    `row.names<-`(<rtable>)

    +

    change row names of rtable

    +

    row.names(<rheader>)

    +

    Row names of an rheader object

    +

    row.names(<rtable>)

    +

    Row names of an rtable object

    +

    `[`(<rtable>)

    +

    Access rcells in an rtable

    +

    dim(<rtable>)

    +

    Dimension of rtable object

    +

    rbind(<rtable>)

    +

    stack rtable objects

    +

    Tabulation Functions

    +

    rtabulate is a framework to derive rtables

    +
    +

    rtabulate()

    +

    Tabulation Methods

    +

    rtabulate(<data.frame>)

    +

    Split data.frame and apply functions

    +

    rtabulate(<factor>)

    +

    Tabulate Factors

    +

    rtabulate(<logical>)

    +

    tabulate a logical vector

    +

    rtabulate(<numeric>)

    +

    tabulate a numeric vector

    +

    no_by()

    +

    Do not split data into columns or row in rtabulate

    +

    is.no_by()

    +

    Check if object inherits from the no_by Class

    +

    Output Functions

    +

    These functions create ascii or html representations of the table

    +
    +

    toString(<rtable>)

    +

    Convert an rtable to ascii

    +

    as_html()

    +

    Convert an rtable object to an shiny.tag html +representation of the rtable

    +

    Coercion Functions

    +

    +
    +

    as.rtable()

    +

    Convert an object to an rtable object

    +

    as.rtable(<table>)

    +

    Convert a table object to an rtable

    +

    Utility Functions

    +

    +
    +

    Viewer()

    +

    Dispaly an rtable object in the Viewer pane in RStudio or in a +browser

    +

    compare_rtables()

    +

    Corpare two rtables

    +
    + + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/is.no_by.html b/docs/dev/reference/is.no_by.html new file mode 100644 index 000000000..8c18e8187 --- /dev/null +++ b/docs/dev/reference/is.no_by.html @@ -0,0 +1,173 @@ + + + + + + + + +Check if object inherits from the <code>no_by</code> Class — is.no_by • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Functions to test inheritance on no_by

    + +
    + +
    is.no_by(x)
    + +

    Arguments

    + + + + + + +
    x

    an object

    + +

    Value

    + +

    TRUE or FALSE

    + + +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/list_rcell_format_labels.html b/docs/dev/reference/list_rcell_format_labels.html new file mode 100644 index 000000000..72b0e73c9 --- /dev/null +++ b/docs/dev/reference/list_rcell_format_labels.html @@ -0,0 +1,180 @@ + + + + + + + + +List with valid <code><a href='rcell.html'>rcell</a></code> formats labels grouped by 1d and 2d — list_rcell_format_labels • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Currently valid format lables can not be added dynamically. Format functions +must be used for special cases

    + +
    + +
    list_rcell_format_labels()
    + + +

    Examples

    +
    +list_rcell_format_labels()
    #> $`1d` +#> [1] "xx" "xx." "xx.x" "xx.xx" "xx.xxx" "xx.xxxx" "xx%" +#> [8] "xx.x%" "xx.xx%" "xx.xxx%" "(N=xx)" ">999.9" +#> +#> $`2d` +#> [1] "xx / xx" "xx. / xx." "xx.x / xx.x" +#> [4] "xx.xx / xx.xx" "xx (xx%)" "xx (xx.%)" +#> [7] "xx (xx.x%)" "xx (xx.xx%)" "xx. (xx.%)" +#> [10] "xx.x (xx.x%)" "xx.xx (xx.xx%)" "(xx, xx)" +#> [13] "(xx., xx.)" "(xx.x, xx.x)" "(xx.xx, xx.xx)" +#> [16] "(xx.xxx, xx.xxx)" "(xx.xxxx, xx.xxxx)" "xx - xx" +#> [19] "xx.x - xx.x" "xx.xx - xx.xx" "xx.x (xx.x)" +#> [22] "xx.xx (xx.xx)" "xx.x, xx.x" "xx.x to xx.x" +#> +#> attr(,"info") +#> [1] "xx does not modify the element, and xx. rounds a number to 0 digits"
    +
    +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/names.rtable.html b/docs/dev/reference/names.rtable.html new file mode 100644 index 000000000..b846926c8 --- /dev/null +++ b/docs/dev/reference/names.rtable.html @@ -0,0 +1,174 @@ + + + + + + + + +Get column names of an <code><a href='rtable.html'>rtable</a></code> object — names.rtable • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Retrieve the column names of an rtable object

    + +
    + +
    # S3 method for rtable
    +names(x)
    + +

    Arguments

    + + + + + + +
    x

    an rtable object

    + +

    Value

    + +

    a vector with the column names

    + + +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/no_by.html b/docs/dev/reference/no_by.html new file mode 100644 index 000000000..ef61722f6 --- /dev/null +++ b/docs/dev/reference/no_by.html @@ -0,0 +1,171 @@ + + + + + + + + +Do not split data into columns or row in <code>rtabulate</code> — no_by • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    rtabulate has the arguments col_by and row_by +which can either take a vector or if no splitting is needed the return value +of no_by.

    + +
    + +
    no_by(name)
    + +

    Arguments

    + + + + + + +
    name

    row name or column name

    + + +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/rbind.rtable.html b/docs/dev/reference/rbind.rtable.html new file mode 100644 index 000000000..412bc602b --- /dev/null +++ b/docs/dev/reference/rbind.rtable.html @@ -0,0 +1,212 @@ + + + + + + + + +stack rtable objects — rbind.rtable • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    stack rtable objects

    + +
    + +
    # S3 method for rtable
    +rbind(...)
    + +

    Arguments

    + + + + + + +
    ...

    rtable objects

    + +

    Value

    + +

    an rtable object

    + + +

    Examples

    +
    +mtbl <- rtable( + header = rheader( + rrow(row.name = NULL, rcell("Sepal.Length", colspan = 2), rcell("Petal.Length", colspan=2)), + rrow(NULL, "mean", "median", "mean", "median") + ), + rrow( + row.name = "All Species", + mean(iris$Sepal.Length), median(iris$Sepal.Length), + mean(iris$Petal.Length), median(iris$Petal.Length), + format = "xx.xx" + ) +) + +mtbl2 <- with(subset(iris, Species == 'setosa'), rtable( + header = rheader( + rrow(row.name = NULL, rcell("Sepal.Length", colspan = 2), rcell("Petal.Length", colspan=2)), + rrow(NULL, "mean", "median", "mean", "median") + ), + rrow( + row.name = "Setosa", + mean(Sepal.Length), median(Sepal.Length), + mean(Petal.Length), median(Petal.Length), + format = "xx.xx" + ) +)) + +tbl <- rbind(mtbl, mtbl2) + +tbl
    #> Sepal.Length Petal.Length +#> mean median mean median +#> ------------------------------------------------------------------- +#> All Species 5.84 5.8 3.76 4.35 +#> Setosa 5.01 5 1.46 1.5
    +
    +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/rcell.html b/docs/dev/reference/rcell.html new file mode 100644 index 000000000..c6567e0f4 --- /dev/null +++ b/docs/dev/reference/rcell.html @@ -0,0 +1,188 @@ + + + + + + + + +Reporting Table Cell — rcell • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    rcells compose an rtable. An rcell +contains the encapsulated data object, a format and column span attributes.

    + +
    + +
    rcell(x, format = NULL, colspan = 1)
    + +

    Arguments

    + + + + + + + + + + + + + + +
    x

    data object for the rcell object. Note that if the data +object has attributes then it needs to be encasultated in a list as +rcell adds/modifies the attributes.

    format

    a valid format string or a format function for +rcells. To get a list of all valid format strings use +list_rcell_format_labels. If format is NULL then the elements +of a cell get pasted separated by a comma.

    colspan

    positive integer, number of columns that the cell should span.

    + +

    Value

    + +

    an object of class rcell

    + + +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/rheader.html b/docs/dev/reference/rheader.html new file mode 100644 index 000000000..a5c7ce602 --- /dev/null +++ b/docs/dev/reference/rheader.html @@ -0,0 +1,179 @@ + + + + + + + + +Create a rheader object — rheader • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Create a rheader object

    + +
    + +
    rheader(..., format = "xx")
    + +

    Arguments

    + + + + + + + + + + +
    ...

    elements that are either to be mapped to rrows

    format

    default format

    + + +

    Examples

    +
    h1 <- rheader(c("A", "B", "C")) +h2 <- rheader( + rrow(NULL, rcell("group 1", colspan = 2), rcell("group 2", colspan = 2)), + rrow(NULL, "A", "B", "A", "B") +)
    +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/row.names-set-.rtable.html b/docs/dev/reference/row.names-set-.rtable.html new file mode 100644 index 000000000..8c7b93f07 --- /dev/null +++ b/docs/dev/reference/row.names-set-.rtable.html @@ -0,0 +1,183 @@ + + + + + + + + +change row names of rtable — row.names<-.rtable • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    change row names of rtable

    + +
    + +
    # S3 method for rtable
    +row.names(x) <- value
    + +

    Arguments

    + + + + + + + + + + +
    x

    an rtable object

    value

    character vector with row names

    + + +

    Examples

    +
    +tbl <- rtable(header = c("A", "B"), rrow("row 1", 1, 2)) +tbl
    #> A B +#> ----------------------- +#> row 1 1 2
    row.names(tbl) <- "Changed Row Name" +tbl
    #> A B +#> ---------------------------------- +#> Changed Row Name 1 2
    +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/row.names.rheader.html b/docs/dev/reference/row.names.rheader.html new file mode 100644 index 000000000..c0a2601df --- /dev/null +++ b/docs/dev/reference/row.names.rheader.html @@ -0,0 +1,174 @@ + + + + + + + + +Row names of an <code><a href='rheader.html'>rheader</a></code> object — row.names.rheader • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Retrieve the row names of an rheader object

    + +
    + +
    # S3 method for rheader
    +row.names(x)
    + +

    Arguments

    + + + + + + +
    x

    an rtable object

    + +

    Value

    + +

    a vector with the row names

    + + +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/row.names.rtable.html b/docs/dev/reference/row.names.rtable.html new file mode 100644 index 000000000..e17183cc0 --- /dev/null +++ b/docs/dev/reference/row.names.rtable.html @@ -0,0 +1,174 @@ + + + + + + + + +Row names of an <code><a href='rtable.html'>rtable</a></code> object — row.names.rtable • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Retrieve the row names of an rtable object

    + +
    + +
    # S3 method for rtable
    +row.names(x)
    + +

    Arguments

    + + + + + + +
    x

    an rtable object

    + +

    Value

    + +

    a vector with the row names

    + + +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/rrow.html b/docs/dev/reference/rrow.html new file mode 100644 index 000000000..e9ef4fcc4 --- /dev/null +++ b/docs/dev/reference/rrow.html @@ -0,0 +1,196 @@ + + + + + + + + +Reporting Table Row — rrow • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Defines a row for an rtable

    + +
    + +
    rrow(row.name, ..., format = NULL, indent = 0)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + +
    row.name

    string with row name

    ...

    data objects which are wrapped into rcell if they +aren't rcells already

    format

    a valid format string or a format function for +rcells. To get a list of all valid format strings use +list_rcell_format_labels. If format is NULL then the elements +of a cell get pasted separated by a comma.

    indent

    non-negative integer where 0 means that the row should not be +indented

    + +

    Details

    + +

    Note the rrow() will return an empty row.

    + + +

    Examples

    +
    +rrow("ABC", c(1,2), c(3,2), format = "xx (xx.%)")
    #> ABC 1 (200%) 3 (200%)
    +
    +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/rrowl.html b/docs/dev/reference/rrowl.html new file mode 100644 index 000000000..050695024 --- /dev/null +++ b/docs/dev/reference/rrowl.html @@ -0,0 +1,198 @@ + + + + + + + + +Create an rrow with cell-data stored within lists — rrowl • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    The apply function family returns lists whose elements can be used as cell +data with the lrow function.

    + +
    + +
    rrowl(row.name, ..., format = NULL, indent = 0)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + +
    row.name

    string with row name

    ...

    lists that get concatenated and then flattened by one level of +depth. If one elemenet is not a list then it gets placed into a list.

    format

    a valid format string or a format function for +rcells. To get a list of all valid format strings use +list_rcell_format_labels. If format is NULL then the elements +of a cell get pasted separated by a comma.

    indent

    non-negative integer where 0 means that the row should not be +indented

    + + +

    Examples

    +
    +rrowl("a", c(1,2,3), format = "xx")
    #> a 1 2 3
    rrowl("a", c(1,2,3), c(4,5,6), format = "xx")
    #> a 1 2 3 4 5 6
    + +rrowl("N", tapply(iris$Species, iris$Species, length))
    #> N 50 50 50
    rrowl("N", tapply(iris$Species, iris$Species, length), format = "xx")
    #> N 50 50 50
    +x <- tapply(iris$Sepal.Length, iris$Species, mean, simplify = FALSE) + +rrow(row.name = "row 1", x)
    #> row 1 5.006, 5.936, 6.588
    rrow("ABC", 2, 3)
    #> ABC 2 3
    +rrowl(row.name = "row 1", c(1, 2), c(3,4))
    #> row 1 1 2 3 4
    rrow(row.name = "row 2", c(1, 2), c(3,4))
    #> row 2 1, 2 3, 4
    +
    +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/rtable.html b/docs/dev/reference/rtable.html new file mode 100644 index 000000000..29fbd457a --- /dev/null +++ b/docs/dev/reference/rtable.html @@ -0,0 +1,339 @@ + + + + + + + + +Create a Reporting Table — rtable • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Reporting tables allow multiple values per cell, cell formatting and merging +cells. Currently an rtable can be converted to html and ascii.

    + +
    + +
    rtable(header, ..., format = NULL)
    + +

    Arguments

    + + + + + + + + + + + + + + +
    header

    either a vector with column names or an object returned by +rheader if special formating and multi-line headers are +needed

    ...

    each element is an rrow object

    format

    a valid format string or a format function for +rcells. To get a list of all valid format strings use +list_rcell_format_labels. If format is NULL then the elements +of a cell get pasted separated by a comma.

    + +

    Value

    + +

    an rtable object

    + +

    Details

    + +

    Rtable objects can be currently exported to text with +toString and to html with as_html. In +future we would plan to add the as_latex and as_gridGrob +outputting function.

    +

    Note that the formats propagate to the rrow and +rcell if these do not specify their own format.

    + +

    See also

    + + + + +

    Examples

    +
    +# Table with multirow header +mtbl <- rtable( + header = rheader( + rrow(row.name = NULL, rcell("Sepal.Length", colspan = 2), rcell("Petal.Length", colspan=2)), + rrow(NULL, "mean", "median", "mean", "median") + ), + rrow( + row.name = "All Species", + mean(iris$Sepal.Length), median(iris$Sepal.Length), + mean(iris$Petal.Length), median(iris$Petal.Length), + format = "xx.xx" + ) +) + +mtbl
    #> Sepal.Length Petal.Length +#> mean median mean median +#> ------------------------------------------------------------------- +#> All Species 5.84 5.8 3.76 4.35
    +names(mtbl) # always first row of header
    #> [1] "Sepal.Length" "Sepal.Length" "Petal.Length" "Petal.Length"
    +# Single row header + +tbl <- rtable( + header = c("Treatement\nN=100", "Comparison\nN=300"), + format = "xx (xx.xx%)", + rrow("A", c(104, .2), c(100, .4)), + rrow("B", c(23, .4), c(43, .5)), + rrow(), + rrow("this is a very long section header"), + rrow("estimate", rcell(55.23, "xx.xx", colspan = 2)), + rrow("95% CI", indent = 1, rcell(c(44.8, 67.4), format = "(xx.x, xx.x)", colspan = 2)) +) + +tbl
    #> Treatement Comparison +#> N=100 N=300 +#> ---------------------------------------------------------------------- +#> A 104 (20%) 100 (40%) +#> B 23 (40%) 43 (50%) +#> +#> this is a very long section header +#> estimate 55.23 +#> 95% CI (44.8, 67.4)
    +row.names(tbl)
    #> [1] "A" "B" +#> [3] "" "this is a very long section header" +#> [5] "estimate" "95% CI"
    names(tbl)
    #> [1] "Treatement\nN=100" "Comparison\nN=300"
    + +# Subsetting +tbl[1,2]
    #> 100 (40%)
    tbl[3,2]
    #> NULL
    tbl[5,1]
    #> 55.23
    tbl[5,2]
    #> 55.23
    tbl[1:3]
    #> Treatement Comparison +#> N=100 N=300 +#> ------------------------------------- +#> A 104 (20%) 100 (40%) +#> B 23 (40%) 43 (50%) +#>
    + +# Data Structure methods +dim(tbl)
    #> [1] 6 2
    nrow(tbl)
    #> [1] 6
    ncol(tbl)
    #> [1] 2
    names(tbl)
    #> [1] "Treatement\nN=100" "Comparison\nN=300"
    + +# Output: html +as_html(tbl)
    #> <table class="table table-condensed table-hover"> +#> <tr> +#> <th class="rowname text-left"></th> +#> <th class="text-center"> +#> Treatement +#> <br/> +#> N=100 +#> </th> +#> <th class="text-center"> +#> Comparison +#> <br/> +#> N=300 +#> </th> +#> </tr> +#> <tr> +#> <td class="rowname text-left">A</td> +#> <td class="text-center">104 (20%)</td> +#> <td class="text-center">100 (40%)</td> +#> </tr> +#> <tr> +#> <td class="rowname text-left">B</td> +#> <td class="text-center">23 (40%)</td> +#> <td class="text-center">43 (50%)</td> +#> </tr> +#> <tr> +#> <td class="rowname text-left" colspan="3"></td> +#> </tr> +#> <tr> +#> <td class="rowname text-left" colspan="3">this is a very long section header</td> +#> </tr> +#> <tr> +#> <td class="rowname text-left">estimate</td> +#> <td colspan="2" class="text-center">55.23</td> +#> </tr> +#> <tr> +#> <td class="rowname text-left" style="padding-left: 3ch">95% CI</td> +#> <td colspan="2" class="text-center">(44.8, 67.4)</td> +#> </tr> +#> </table>
    +
    # NOT RUN { +Viewer(tbl) +# }
    +# Colspans + +tbl2 <- rtable( + c("A", "B", "C", "D", "E"), + format = "xx", + rrow("r1", 1, 2, 3, 4, 5), + rrow("r2", rcell("sp2", colspan = 2), "sp1", rcell("sp2-2", colspan = 2)) +) + +tbl2
    #> A B C D E +#> --------------------------------------------------------- +#> r1 1 2 3 4 5 +#> r2 sp2 sp1 sp2-2
    + +# Custom format with functions (might be deprecated soon) +my_format <- function(x, output) { + paste(x, collapse = "/") +} +tbl3 <- rtable( + c("A", "B"), + format = my_format, + rrow("row1", c(1,2,3,4), letters[1:10]) +) +tbl3
    #> A B +#> ---------------------------------------------------------- +#> row1 1/2/3/4 a/b/c/d/e/f/g/h/i/j
    +
    +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/rtablel.html b/docs/dev/reference/rtablel.html new file mode 100644 index 000000000..724b17fc0 --- /dev/null +++ b/docs/dev/reference/rtablel.html @@ -0,0 +1,188 @@ + + + + + + + + +Create an rtable from rrows stored in a list — rtablel • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    This function is useful to create rtable objects with lists of +rrows that are returned by the apply function family.

    + +
    + +
    rtablel(header, ..., format = NULL)
    + +

    Arguments

    + + + + + + + + + + + + + + +
    header

    either a vector with column names or an object returned by +rheader if special formating and multi-line headers are +needed

    ...

    lists with rrow objects

    format

    a valid format string or a format function for +rcells. To get a list of all valid format strings use +list_rcell_format_labels. If format is NULL then the elements +of a cell get pasted separated by a comma.

    + +

    Value

    + +

    rtable object

    + + +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/rtabulate.data.frame.html b/docs/dev/reference/rtabulate.data.frame.html new file mode 100644 index 000000000..d1be5eed3 --- /dev/null +++ b/docs/dev/reference/rtabulate.data.frame.html @@ -0,0 +1,300 @@ + + + + + + + + +Split data.frame and apply functions — rtabulate.data.frame • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Split data.frame and apply functions

    + +
    + +
    # S3 method for data.frame
    +rtabulate(x, row_by_var = no_by("row_1"),
    +  col_by_var = no_by("col_1"), FUN = nrow, ..., row_col_data_args = FALSE,
    +  format = "xx", indent = 0, col_total = "(N=xx)")
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    x

    a vecor

    row_by_var

    name of factor variable in x

    col_by_var

    name of factor variable in x

    FUN

    a function that processes the cell data, if row_data_arg is +set to TRUE the a second argument with the row data is passed to +FUN

    ...

    arguments passed to FUN

    row_col_data_args

    boolean, if TRUE then FUN is called +with the first three arguments being the cell, row, and column data, +respectively

    format

    if FUN does not return a formatted rcell +then the format is applied

    indent

    non-negative integer where 0 means that the row should not be +indented

    col_total

    a format string for displaying the number of elements in the +column header. If NULL then no header row for the column is +displayed.

    + +

    Value

    + +

    an rtable project

    + + +

    Examples

    +
    df <- expand.grid(aaa = factor(c("A", "B")), bbb = factor(c("X", "Y", "Z"))) +df <- rbind(df, df) +df$val <- 1:nrow(df) + +rtabulate( + x = df, + row_by_var = "aaa", + col_by_var = "bbb", + FUN = function(x) { + sum(x$val) + } +)
    #> X Y Z +#> (N=4) (N=4) (N=4) +#> ---------------------------------------- +#> A 8 12 16 +#> B 10 14 18
    +rtabulate( + x = iris, + row_by_var = no_by("sum"), + col_by_var = "Species", + FUN = function(x) sum(x$Sepal.Length) +)
    #> setosa versicolor virginica +#> (N=50) (N=50) (N=50) +#> --------------------------------------------------------- +#> sum 250.3 296.8 329.4
    +rtabulate( + x = iris, + row_by_var = "Species", + col_by_var = no_by("sum"), + FUN = function(x) sum(x$Sepal.Length) +)
    #> sum +#> (N=150) +#> ------------------------- +#> setosa 250.3 +#> versicolor 296.8 +#> virginica 329.4
    +tbl <- rtabulate( + x = iris, + FUN = function(cell_data) c(sum(cell_data$Sepal.Length), sd(cell_data$Sepal.Length)), + format = "xx.xx (xx.xx%)" +) + +tbl
    #> col_1 +#> (N=150) +#> --------------------------- +#> row_1 876.5 (82.81%)
    +row.names(tbl)
    #> row_1 +#> "row_1"
    row.names(tbl) <- "Sum of Sepal Length" + +tbl
    #> col_1 +#> (N=150) +#> ----------------------------------------- +#> Sum of Sepal Length 876.5 (82.81%)
    +iris2 <- iris +iris2$fsl5 <- factor(iris$Sepal.Length > 5, levels = c(TRUE, FALSE), + labels = c("S.L > 5", "S.L <= 5")) + +tbl <- rtabulate( + x = iris2, + row_by_var = "fsl5", + col_by_var = "Species", + FUN = function(x_cell, x_row, x_col) { + if (nrow(x_cell) < 10) { + rcell("-") + } else { + fit <- lm(Sepal.Length ~ Petal.Width, data = x_cell) + m_col <- mean(x_col$Sepal.Length) + m_row <- mean(x_row$Sepal.Length) + + rcell(list(fit, m_col, m_row), format = function(x, output) { + paste("df:", x[[1]]$df.residual,", and", round(x[[2]],1), ", and", round(x[[3]],2)) + }) + } + } , + row_col_data_args = TRUE +) +tbl
    #> setosa versicolor virginica +#> (N=50) (N=50) (N=50) +#> ----------------------------------------------------------------------------------------------------------------- +#> S.L > 5 df: 20 , and 5 , and 6.13 df: 45 , and 5.9 , and 6.13 df: 47 , and 6.6 , and 6.13 +#> S.L <= 5 df: 26 , and 5 , and 4.79 - -
    +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/rtabulate.factor.html b/docs/dev/reference/rtabulate.factor.html new file mode 100644 index 000000000..3d894be9d --- /dev/null +++ b/docs/dev/reference/rtabulate.factor.html @@ -0,0 +1,267 @@ + + + + + + + + +Tabulate Factors — rtabulate.factor • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Tabulate Factors

    + +
    + +
    # S3 method for factor
    +rtabulate(x, col_by = no_by("col_1"), FUN = length, ...,
    +  row_col_data_args = FALSE, useNA = c("no", "ifany", "always"),
    +  format = "xx", indent = 0, col_total = "(N=xx)")
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    x

    a vecor

    col_by

    a factor of length nrow(x) that defines +which levels in col_by define a column. If data should not be split +into columns use the no_by function.

    FUN

    a function that processes the cell data, if row_data_arg is +set to TRUE the a second argument with the row data is passed to +FUN

    ...

    arguments passed to FUN

    row_col_data_args

    boolean, if TRUE then FUN is called +with the first three arguments being the cell, row, and column data, +respectively

    useNA

    boolean, if TRUE then NA values in x get +turned into a factor level "NA", if FALSE then the NA +values in x get dropped.

    format

    if FUN does not return a formatted rcell +then the format is applied

    indent

    non-negative integer where 0 means that the row should not be +indented

    col_total

    a format string for displaying the number of elements in the +column header. If NULL then no header row for the column is +displayed.

    + +

    Value

    + +

    an rtable project

    + + +

    Examples

    +
    +rtabulate(x = iris$Species)
    #> col_1 +#> (N=150) +#> ------------------------- +#> setosa 50 +#> versicolor 50 +#> virginica 50
    +rtabulate(x = iris$Species, no_by("sum"))
    #> sum +#> (N=150) +#> ------------------------- +#> setosa 50 +#> versicolor 50 +#> virginica 50
    +sl5 <- factor(iris$Sepal.Length > 5, levels = c(TRUE, FALSE), + labels = c("S.L > 5", "S.L <= 5")) + +rtabulate(iris$Species, col_by=sl5)
    #> S.L > 5 S.L <= 5 +#> (N=118) (N=32) +#> ------------------------------------------ +#> setosa 22 28 +#> versicolor 47 3 +#> virginica 49 1
    +rtabulate(iris$Species, col_by=sl5, + FUN = function(cell_data, row_data, col_data) { + if (length(cell_data) > 10) { + length(cell_data) * c(1, 1/length(col_data)) + } else { + rcell("-", format = "xx") + } + }, + row_col_data_args = TRUE, + format = "xx (xx.xx%)" +)
    #> S.L > 5 S.L <= 5 +#> (N=118) (N=32) +#> ------------------------------------------------ +#> setosa 22 (18.64%) 28 (87.5%) +#> versicolor 47 (39.83%) - +#> virginica 49 (41.53%) -
    +rtabulate(sl5, iris$Species)
    #> setosa versicolor virginica +#> (N=50) (N=50) (N=50) +#> -------------------------------------------------------------- +#> S.L > 5 22 47 49 +#> S.L <= 5 28 3 1
    +
    +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/rtabulate.html b/docs/dev/reference/rtabulate.html new file mode 100644 index 000000000..c5bd105a2 --- /dev/null +++ b/docs/dev/reference/rtabulate.html @@ -0,0 +1,192 @@ + + + + + + + + +Tabulation Methods — rtabulate • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    rtablulate provides a number of methods to derive +rtables. Conceptually the rtabulate has it's origin in +tapply.

    + +
    + +
    rtabulate(x, ...)
    + +

    Arguments

    + + + + + + + + + + +
    x

    either a vector or data.frame

    ...

    arguments passed to methods

    + +

    Value

    + +

    an rtable project

    + +

    Details

    + +

    The data is split into cell-data and a function can be specified that return +a data structre (or rcell).

    + + +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/rtabulate.logical.html b/docs/dev/reference/rtabulate.logical.html new file mode 100644 index 000000000..d0e5534e8 --- /dev/null +++ b/docs/dev/reference/rtabulate.logical.html @@ -0,0 +1,244 @@ + + + + + + + + +tabulate a logical vector — rtabulate.logical • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    tabulate a logical vector

    + +
    + +
    # S3 method for logical
    +rtabulate(x, col_by = no_by("col_1"), FUN = function(x)
    +  sum(x) * c(1, 1/length(x)), ..., row_data_arg = FALSE,
    +  format = "xx.xx (xx.xx%)", row.name = "", indent = 0,
    +  col_total = "(N=xx)")
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    x

    a vecor

    col_by

    a factor of length nrow(x) that defines +which levels in col_by define a column. If data should not be split +into columns use the no_by function.

    FUN

    a function that processes the cell data, if row_data_arg is +set to TRUE the a second argument with the row data is passed to +FUN

    ...

    arguments passed to FUN

    row_data_arg

    call FUN with the row data as the second argument

    format

    if FUN does not return a formatted rcell +then the format is applied

    row.name

    if NULL then the FUN argument is deparsed and +used as row.name of the rrow

    indent

    non-negative integer where 0 means that the row should not be +indented

    col_total

    a format string for displaying the number of elements in the +column header. If NULL then no header row for the column is +displayed.

    + +

    Value

    + +

    an rtable project

    + + +

    Examples

    +
    rtabulate(iris$Species == "setosa")
    #> col_1 +#> (N=150) +#> ------------------- +#> 50 (33.33%)
    +rtabulate(iris$Species == "setosa", no_by("Species"), row.name = "n (n/N)")
    #> Species +#> (N=150) +#> -------------------------- +#> n (n/N) 50 (33.33%)
    +# default: percentages equal \code{TRUE} +with(iris, rtabulate(Sepal.Length < 5, Species, row.name = "Sepal.Length < 5"))
    #> setosa versicolor virginica +#> (N=50) (N=50) (N=50) +#> ---------------------------------------------------------------------- +#> Sepal.Length < 5 20 (40%) 1 (2%) 1 (2%)
    +# precentages with proportion of cell number of \code{TRUE}s to overvall +# number of \code{TRUE}s +with(iris, rtabulate(Sepal.Length < 5, Species, row.name = "Sepal.Length < 5", + FUN = function(cell_data, row_data) sum(cell_data) * c(1, 1/sum(row_data)), + row_data_arg = TRUE +))
    #> setosa versicolor virginica +#> (N=50) (N=50) (N=50) +#> ------------------------------------------------------------------------- +#> Sepal.Length < 5 20 (90.91%) 1 (4.55%) 1 (4.55%)
    +
    +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/reference/rtabulate.numeric.html b/docs/dev/reference/rtabulate.numeric.html new file mode 100644 index 000000000..0c44ccc8e --- /dev/null +++ b/docs/dev/reference/rtabulate.numeric.html @@ -0,0 +1,252 @@ + + + + + + + + +tabulate a numeric vector — rtabulate.numeric • rtables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    by default the fivenum function is applied to the +vectors associated to the cells

    + +
    + +
    # S3 method for numeric
    +rtabulate(x, col_by = no_by("col_1"), FUN = mean, ...,
    +  row_data_arg = FALSE, format = NULL, row.name = NULL, indent = 0,
    +  col_total = "(N=xx)")
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    x

    a vecor

    col_by

    a factor of length nrow(x) that defines +which levels in col_by define a column. If data should not be split +into columns use the no_by function.

    FUN

    a function that processes the cell data, if row_data_arg is +set to TRUE the a second argument with the row data is passed to +FUN

    ...

    arguments passed to FUN

    row_data_arg

    call FUN with the row data as the second argument

    format

    if FUN does not return a formatted rcell +then the format is applied

    row.name

    if NULL then the FUN argument is deparsed and +used as row.name of the rrow

    indent

    non-negative integer where 0 means that the row should not be +indented

    col_total

    a format string for displaying the number of elements in the +column header. If NULL then no header row for the column is +displayed.

    + +

    Value

    + +

    an rtable project

    + + +

    Examples

    +
    +rtabulate(iris$Sepal.Length)
    #> col_1 +#> (N=150) +#> ---------------------------- +#> mean 5.84333333333333
    +rtabulate(iris$Sepal.Length, col_by = no_by("Sepal.Length"))
    #> Sepal.Length +#> (N=150) +#> ---------------------------- +#> mean 5.84333333333333
    +with(iris, rtabulate(x = Sepal.Length, col_by = Species, row.name = "fivenum"))
    #> setosa versicolor virginica +#> (N=50) (N=50) (N=50) +#> ------------------------------------------------------------- +#> fivenum 5.006 5.936 6.588
    +SL <- iris$Sepal.Length +Sp <- iris$Species +rbind( + rtabulate(SL, Sp, length, row.name = "n"), + rtabulate(SL, Sp, function(x)c(mean(x), sd(x)), format = "xx.xx (xx.xx)", row.name = "Mean (SD)"), + rtabulate(SL, Sp, median, row.name = "Median"), + rtabulate(SL, Sp, range, format = "xx.xx - xx.xx", row.name = "Min - Max") +)
    #> setosa versicolor virginica +#> (N=50) (N=50) (N=50) +#> ------------------------------------------------------------------ +#> n 50 50 50 +#> Mean (SD) 5.01 (0.35) 5.94 (0.52) 6.59 (0.64) +#> Median 5 5.9 6.5 +#> Min - Max 4.3 - 5.8 4.9 - 7 4.9 - 7.9
    + + +
    +
    + +
    + +
    + + +
    +

    Site built with pkgdown.

    +
    + +
    +
    + + + + + + diff --git a/docs/reference/sprintf_format.html b/docs/dev/reference/sprintf_format.html similarity index 87% rename from docs/reference/sprintf_format.html rename to docs/dev/reference/sprintf_format.html index 63e243001..889f58cb2 100644 --- a/docs/reference/sprintf_format.html +++ b/docs/dev/reference/sprintf_format.html @@ -21,9 +21,11 @@ + + + - @@ -33,6 +35,7 @@ + @@ -58,7 +61,7 @@ rtables - 0.1.1 + 0.1.0.1
  • @@ -143,6 +146,9 @@

    Examp
    rcell(100, format = sprintf_format("(N=%i)"))
    #> (N=100)
    rcell(c(4,9999999999), format = sprintf_format("(%.2f, >999.9)"))
    #> (4.00, >999.9)
    +rtable(LETTERS[1:2], rrow("", 1 ,2), format = sprintf_format("%.2f"))
    #> A B +#> ------------------------ +#> 1.00 2.00

    @@ -106,21 +102,15 @@ -
    -
    +
    + +
    -
    -

    -rtable 0.1.1

    -
      -
    • added sprintf_format for formatting rcells (thanks to Doug Kelkhoff for the suggestion)
    • -
    • added "(N=xx)" and ">999.9" format labels
    • -
    -
    +

    rtable 0.1.0

    @@ -144,13 +134,13 @@

  • Initial public release
  • +
    @@ -103,7 +100,6 @@ -
    @@ -111,20 +107,17 @@ -
    +
    -

    The table will be displayed using the bootstrap styling for tables.

    -
    Viewer(x, y = NULL, row.names.bold = FALSE)
    @@ -168,8 +161,6 @@

    Contents

    - - diff --git a/docs/reference/as.rtable.html b/docs/reference/as.rtable.html index 703d547a0..b1ca2b5c5 100644 --- a/docs/reference/as.rtable.html +++ b/docs/reference/as.rtable.html @@ -25,9 +25,6 @@ - - - @@ -58,7 +55,7 @@ rtables - 0.1.1 + 0.1.0
    @@ -101,7 +98,6 @@ -
    @@ -109,19 +105,16 @@ -
    +
    -

    Generic for converting objects to an rtable object

    -
    as.rtable(x, format = "xx")
    @@ -161,8 +154,6 @@

    Contents

    - - diff --git a/docs/reference/as.rtable.table.html b/docs/reference/as.rtable.table.html index 8f23340a1..864a7cdec 100644 --- a/docs/reference/as.rtable.table.html +++ b/docs/reference/as.rtable.table.html @@ -25,9 +25,6 @@ - - - @@ -58,7 +55,7 @@ rtables - 0.1.1 + 0.1.0
    @@ -101,7 +98,6 @@ -
    @@ -109,19 +105,16 @@ -
    +
    -

    Convert a table object to an rtable

    -
    # S3 method for table
     as.rtable(x, format = "xx")
    @@ -184,8 +177,6 @@

    Contents

    - - diff --git a/docs/reference/as_html.default.html b/docs/reference/as_html.default.html index 6b2109631..4c469a4da 100644 --- a/docs/reference/as_html.default.html +++ b/docs/reference/as_html.default.html @@ -25,9 +25,6 @@ - - - @@ -58,7 +55,7 @@ rtables - 0.1.1 + 0.1.0
    @@ -101,7 +98,6 @@ -
    @@ -109,19 +105,16 @@ -
    +
    -

    Generic method for as_html

    -
    # S3 method for default
     as_html(x, ...)
    @@ -162,8 +155,6 @@

    Contents

    - - diff --git a/docs/reference/as_html.html b/docs/reference/as_html.html index 03b329585..4e6ee0f89 100644 --- a/docs/reference/as_html.html +++ b/docs/reference/as_html.html @@ -26,9 +26,6 @@ - - - @@ -60,7 +57,7 @@ rtables - 0.1.1 + 0.1.0
    @@ -103,7 +100,6 @@ -
    @@ -111,20 +107,17 @@ -
    +
    -

    The returned html object can be immediately used in shiny and rmarkdown

    -
    as_html(x, ...)
    @@ -206,8 +199,6 @@

    Contents

    - - diff --git a/docs/reference/compare_rtables.html b/docs/reference/compare_rtables.html index 41472521c..5213be1f3 100644 --- a/docs/reference/compare_rtables.html +++ b/docs/reference/compare_rtables.html @@ -25,9 +25,6 @@ - - - rtables - 0.1.1 + 0.1.0
    @@ -103,7 +100,6 @@ -
    @@ -111,21 +107,18 @@ -
    +
    -

    Prints a matrix where . means cell matches, X means cell does cells do not match, + cell (row) is missing, and - cell (row) should not be there.

    -
    compare_rtables(object, expected, tol = 0.1, comp.attr = TRUE)
    @@ -259,8 +252,6 @@

    Contents

    - - diff --git a/docs/reference/dim.rheader.html b/docs/reference/dim.rheader.html index 6593cbbe7..55bf407b2 100644 --- a/docs/reference/dim.rheader.html +++ b/docs/reference/dim.rheader.html @@ -25,9 +25,6 @@ - - - @@ -58,7 +55,7 @@ rtables - 0.1.1 + 0.1.0
    @@ -101,7 +98,6 @@ -
    @@ -109,19 +105,16 @@ -
    +
    -

    Retrieve or set the dimension of an rtable object

    -
    # S3 method for rheader
     dim(x)
    @@ -164,8 +157,6 @@

    Contents

    - - diff --git a/docs/reference/dim.rtable.html b/docs/reference/dim.rtable.html index 822ad28e9..2c655d943 100644 --- a/docs/reference/dim.rtable.html +++ b/docs/reference/dim.rtable.html @@ -25,9 +25,6 @@ - - - @@ -58,7 +55,7 @@ rtables - 0.1.1 + 0.1.0
    @@ -101,7 +98,6 @@ -
    @@ -109,19 +105,16 @@ -
    +
    -

    Retrieve or set the dimension of an rtable object

    -
    # S3 method for rtable
     dim(x)
    @@ -164,8 +157,6 @@

    Contents

    - - diff --git a/docs/reference/format_rcell.html b/docs/reference/format_rcell.html index 80b7996f6..19db2146e 100644 --- a/docs/reference/format_rcell.html +++ b/docs/reference/format_rcell.html @@ -26,9 +26,6 @@ - - - @@ -61,7 +58,7 @@ rtables - 0.1.1 + 0.1.0
    @@ -104,7 +101,6 @@ -
    @@ -112,23 +108,20 @@ -
    +
    -

    Convert the contets of an rcell to a string using the format information

    -
    -
    format_rcell(x, format, output = c("ascii", "html"))
    +
    format_rcell(x, format, output = c("html", "ascii"))

    Arguments

    @@ -173,8 +166,6 @@

    Contents

    - - diff --git a/docs/reference/header-set.html b/docs/reference/header-set.html index 13371fe30..c30f7a991 100644 --- a/docs/reference/header-set.html +++ b/docs/reference/header-set.html @@ -25,9 +25,6 @@ - - - @@ -58,7 +55,7 @@ rtables - 0.1.1 + 0.1.0 @@ -101,7 +98,6 @@ - @@ -109,19 +105,16 @@ -
    +
    -

    Change Header of Rtable

    -
    header(x) <- value
    @@ -169,8 +162,6 @@

    Contents

    - - diff --git a/docs/reference/header.html b/docs/reference/header.html index 87172f45b..97cfb94ad 100644 --- a/docs/reference/header.html +++ b/docs/reference/header.html @@ -25,9 +25,6 @@ - - - @@ -58,7 +55,7 @@ rtables - 0.1.1 + 0.1.0
    @@ -101,7 +98,6 @@ -
    @@ -109,19 +105,16 @@ -
    +
    -

    Get Header ot Rtable

    -
    header(x)
    @@ -176,8 +169,6 @@

    Contents

    - - diff --git a/docs/reference/indented_row.names.html b/docs/reference/indented_row.names.html index aab54295e..abb6a2037 100644 --- a/docs/reference/indented_row.names.html +++ b/docs/reference/indented_row.names.html @@ -25,9 +25,6 @@ - - - @@ -58,7 +55,7 @@ rtables - 0.1.1 + 0.1.0
    @@ -101,7 +98,6 @@ -
    @@ -109,19 +105,16 @@ -
    +
    -

    Retrieve the row names of an rtable object

    -
    indented_row.names(x, spaces = 2)
    @@ -167,8 +160,6 @@

    Contents

    - - diff --git a/docs/reference/index.html b/docs/reference/index.html index 030b4edc8..503f478b0 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -25,9 +25,6 @@ - - - @@ -55,7 +52,7 @@ rtables - 0.1.1 + 0.1.0
    @@ -98,7 +95,6 @@ -
    @@ -106,248 +102,250 @@ -
    -
    +
    +
    -
    +
    +
    - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - -
    -

    Core Table Create Functions

    -

    These are the main functions needed to build an rtable.

    -
    -

    rtable()

    -

    Create a Reporting Table

    -

    rrow()

    -

    Reporting Table Row

    -

    rcell()

    -

    Reporting Table Cell

    -

    rheader()

    -

    Create a rheader object

    -

    rtablel()

    -

    Create an rtable from rrows stored in a list

    -

    rrowl()

    -

    Create an rrow with cell-data stored within lists

    - -

    -
    -

    format_rcell()

    -

    Convert the contets of an rcell to a string using the +

    +

    Core Table Create Functions

    +

    These are the main functions needed to build an rtable.

    +
    +

    rtable()

    +

    Create a Reporting Table

    +

    rrow()

    +

    Reporting Table Row

    +

    rcell()

    +

    Reporting Table Cell

    +

    rheader()

    +

    Create a rheader object

    +

    rtablel()

    +

    Create an rtable from rrows stored in a list

    +

    rrowl()

    +

    Create an rrow with cell-data stored within lists

    + +

    +
    +

    format_rcell()

    +

    Convert the contets of an rcell to a string using the format information

    -

    list_rcell_format_labels()

    -

    List with valid rcell formats labels grouped by 1d and 2d

    -

    Accessor Functions

    -

    Access and Modify Functions

    -
    -

    names(<rtable>)

    -

    Get column names of an rtable object

    -

    `row.names<-`(<rtable>)

    -

    change row names of rtable

    -

    row.names(<rheader>)

    -

    Row names of an rheader object

    -

    row.names(<rtable>)

    -

    Row names of an rtable object

    -

    `[`(<rtable>)

    -

    Access rcells in an rtable

    -

    dim(<rtable>)

    -

    Dimension of rtable object

    -

    rbind(<rtable>)

    -

    stack rtable objects

    -

    Tabulation Functions

    -

    rtabulate is a framework to derive rtables

    -
    -

    rtabulate()

    -

    Tabulation Methods

    -

    rtabulate(<data.frame>)

    -

    Split data.frame and apply functions

    -

    rtabulate(<factor>)

    -

    Tabulate Factors

    -

    rtabulate(<logical>)

    -

    tabulate a logical vector

    -

    rtabulate(<numeric>)

    -

    tabulate a numeric vector

    -

    no_by()

    -

    Do not split data into columns or row in rtabulate

    -

    is.no_by()

    -

    Check if object inherits from the no_by Class

    -

    Output Functions

    -

    These functions create ascii or html representations of the table

    -
    -

    toString(<rtable>)

    -

    Convert an rtable to ascii

    -

    as_html()

    -

    Convert an rtable object to an shiny.tag html +

    +

    list_rcell_format_labels()

    +

    List with valid rcell formats labels grouped by 1d and 2d

    +

    Accessor Functions

    +

    Access and Modify Functions

    +
    +

    names(<rtable>)

    +

    Get column names of an rtable object

    +

    `row.names<-`(<rtable>)

    +

    change row names of rtable

    +

    row.names(<rheader>)

    +

    Row names of an rheader object

    +

    row.names(<rtable>)

    +

    Row names of an rtable object

    +

    `[`(<rtable>)

    +

    Access rcells in an rtable

    +

    dim(<rtable>)

    +

    Dimension of rtable object

    +

    rbind(<rtable>)

    +

    stack rtable objects

    +

    Tabulation Functions

    +

    rtabulate is a framework to derive rtables

    +
    +

    rtabulate()

    +

    Tabulation Methods

    +

    rtabulate(<data.frame>)

    +

    Split data.frame and apply functions

    +

    rtabulate(<factor>)

    +

    Tabulate Factors

    +

    rtabulate(<logical>)

    +

    tabulate a logical vector

    +

    rtabulate(<numeric>)

    +

    tabulate a numeric vector

    +

    no_by()

    +

    Do not split data into columns or row in rtabulate

    +

    is.no_by()

    +

    Check if object inherits from the no_by Class

    +

    Output Functions

    +

    These functions create ascii or html representations of the table

    +
    +

    toString(<rtable>)

    +

    Convert an rtable to ascii

    +

    as_html()

    +

    Convert an rtable object to an shiny.tag html representation of the rtable

    -

    Coercion Functions

    -

    -
    -

    as.rtable()

    -

    Convert an object to an rtable object

    -

    as.rtable(<table>)

    -

    Convert a table object to an rtable

    -

    Utility Functions

    -

    -
    -

    Viewer()

    -

    Dispaly an rtable object in the Viewer pane in RStudio or in a +

    +

    Coercion Functions

    +

    +
    +

    as.rtable()

    +

    Convert an object to an rtable object

    +

    as.rtable(<table>)

    +

    Convert a table object to an rtable

    +

    Utility Functions

    +

    +
    +

    Viewer()

    +

    Dispaly an rtable object in the Viewer pane in RStudio or in a browser

    -

    compare_rtables()

    -

    Corpare two rtables

    + + + +

    compare_rtables()

    + +

    Corpare two rtables

    + + + +
    - - diff --git a/docs/reference/is.no_by.html b/docs/reference/is.no_by.html index 893a4c1ff..4011d9bb3 100644 --- a/docs/reference/is.no_by.html +++ b/docs/reference/is.no_by.html @@ -25,9 +25,6 @@ - - - @@ -58,7 +55,7 @@ rtables - 0.1.1 + 0.1.0
    @@ -101,7 +98,6 @@ - @@ -109,19 +105,16 @@ -
    +
    -

    Functions to test inheritance on no_by

    -
    is.no_by(x)
    @@ -163,8 +156,6 @@

    Contents

    - - diff --git a/docs/reference/list_rcell_format_labels.html b/docs/reference/list_rcell_format_labels.html index da663c9e9..c25555c11 100644 --- a/docs/reference/list_rcell_format_labels.html +++ b/docs/reference/list_rcell_format_labels.html @@ -25,9 +25,6 @@ - - - rtables - 0.1.1 + 0.1.0
    @@ -102,7 +99,6 @@ -
    @@ -110,20 +106,17 @@ -
    +
    -

    Currently valid format lables can not be added dynamically. Format functions must be used for special cases

    -
    list_rcell_format_labels()
    @@ -132,7 +125,7 @@

    Examp
    list_rcell_format_labels()
    #> $`1d` #> [1] "xx" "xx." "xx.x" "xx.xx" "xx.xxx" "xx.xxxx" "xx%" -#> [8] "xx.x%" "xx.xx%" "xx.xxx%" "(N=xx)" ">999.9" +#> [8] "xx.x%" "xx.xx%" "xx.xxx%" #> #> $`2d` #> [1] "xx / xx" "xx. / xx." "xx.x / xx.x" @@ -170,8 +163,6 @@

    Contents

    - - diff --git a/docs/reference/names.rtable.html b/docs/reference/names.rtable.html index 5939d0e70..40dddcb7f 100644 --- a/docs/reference/names.rtable.html +++ b/docs/reference/names.rtable.html @@ -25,9 +25,6 @@ - - - @@ -58,7 +55,7 @@ rtables - 0.1.1 + 0.1.0

    @@ -101,7 +98,6 @@ -
    @@ -109,19 +105,16 @@ -
    +
    -

    Retrieve the column names of an rtable object

    -
    # S3 method for rtable
     names(x)
    @@ -164,8 +157,6 @@

    Contents

    - - diff --git a/docs/reference/no_by.html b/docs/reference/no_by.html index bc99cbbe9..c1182013e 100644 --- a/docs/reference/no_by.html +++ b/docs/reference/no_by.html @@ -25,9 +25,6 @@ - - - rtables - 0.1.1 + 0.1.0
    @@ -103,7 +100,6 @@ -
    @@ -111,21 +107,18 @@ -
    +
    -

    rtabulate has the arguments col_by and row_by which can either take a vector or if no splitting is needed the return value of no_by.

    -
    no_by(name)
    @@ -161,8 +154,6 @@

    Contents

    - - diff --git a/docs/reference/rbind.rtable.html b/docs/reference/rbind.rtable.html index b485909c7..1bc9d8b06 100644 --- a/docs/reference/rbind.rtable.html +++ b/docs/reference/rbind.rtable.html @@ -25,9 +25,6 @@ - - - @@ -58,7 +55,7 @@ rtables - 0.1.1 + 0.1.0
    @@ -101,7 +98,6 @@ -
    @@ -109,19 +105,16 @@ -
    +
    -

    stack rtable objects

    -
    # S3 method for rtable
     rbind(...)
    @@ -202,8 +195,6 @@

    Contents

    - - diff --git a/docs/reference/rcell.html b/docs/reference/rcell.html index 234072df8..543c78c8d 100644 --- a/docs/reference/rcell.html +++ b/docs/reference/rcell.html @@ -25,9 +25,6 @@ - - - rtables - 0.1.1 + 0.1.0
    @@ -102,7 +99,6 @@ -
    @@ -110,20 +106,17 @@ -
    +
    -

    rcells compose an rtable. An rcell contains the encapsulated data object, a format and column span attributes.

    -
    rcell(x, format = NULL, colspan = 1)
    @@ -178,8 +171,6 @@

    Contents

    - - diff --git a/docs/reference/rheader.html b/docs/reference/rheader.html index b7484f13a..77e47d757 100644 --- a/docs/reference/rheader.html +++ b/docs/reference/rheader.html @@ -25,9 +25,6 @@ - - - @@ -58,7 +55,7 @@ rtables - 0.1.1 + 0.1.0
    @@ -101,7 +98,6 @@ -
    @@ -109,19 +105,16 @@ -
    +
    -

    Create a rheader object

    -
    rheader(..., format = "xx")
    @@ -169,8 +162,6 @@

    Contents

    - - diff --git a/docs/reference/row.names-set-.rtable.html b/docs/reference/row.names-set-.rtable.html index cd7fb3951..b20fb2779 100644 --- a/docs/reference/row.names-set-.rtable.html +++ b/docs/reference/row.names-set-.rtable.html @@ -25,9 +25,6 @@ - - - @@ -58,7 +55,7 @@ rtables - 0.1.1 + 0.1.0
    @@ -101,7 +98,6 @@ -
    @@ -109,19 +105,16 @@ -
    +
    -

    change row names of rtable

    -
    # S3 method for rtable
     row.names(x) <- value
    @@ -173,8 +166,6 @@

    Contents

    - - diff --git a/docs/reference/row.names.rheader.html b/docs/reference/row.names.rheader.html index 4f039b132..538cfa7c4 100644 --- a/docs/reference/row.names.rheader.html +++ b/docs/reference/row.names.rheader.html @@ -25,9 +25,6 @@ - - - @@ -58,7 +55,7 @@ rtables - 0.1.1 + 0.1.0
    @@ -101,7 +98,6 @@ -
    @@ -109,19 +105,16 @@ -
    +
    -

    Retrieve the row names of an rheader object

    -
    # S3 method for rheader
     row.names(x)
    @@ -164,8 +157,6 @@

    Contents

    - - diff --git a/docs/reference/row.names.rtable.html b/docs/reference/row.names.rtable.html index 61b6a9738..ee7219e2b 100644 --- a/docs/reference/row.names.rtable.html +++ b/docs/reference/row.names.rtable.html @@ -25,9 +25,6 @@ - - - @@ -58,7 +55,7 @@ rtables - 0.1.1 + 0.1.0
    @@ -101,7 +98,6 @@ -
    @@ -109,19 +105,16 @@ -
    +
    -

    Retrieve the row names of an rtable object

    -
    # S3 method for rtable
     row.names(x)
    @@ -164,8 +157,6 @@

    Contents

    - - diff --git a/docs/reference/rrow.html b/docs/reference/rrow.html index f2af69ca8..fe2b88bea 100644 --- a/docs/reference/rrow.html +++ b/docs/reference/rrow.html @@ -25,9 +25,6 @@ - - - @@ -58,7 +55,7 @@ rtables - 0.1.1 + 0.1.0
    @@ -101,7 +98,6 @@ -
    @@ -109,19 +105,16 @@ -
    +
    -

    Defines a row for an rtable

    -
    rrow(row.name, ..., format = NULL, indent = 0)
    @@ -186,8 +179,6 @@

    Contents

    - - diff --git a/docs/reference/rrowl.html b/docs/reference/rrowl.html index 0f413b4ad..2ee012c2f 100644 --- a/docs/reference/rrowl.html +++ b/docs/reference/rrowl.html @@ -25,9 +25,6 @@ - - - rtables - 0.1.1 + 0.1.0
    @@ -102,7 +99,6 @@ -
    @@ -110,20 +106,17 @@ -
    +
    -

    The apply function family returns lists whose elements can be used as cell data with the lrow function.

    -
    rrowl(row.name, ...)
    @@ -173,8 +166,6 @@

    Contents

    - - diff --git a/docs/reference/rtable.html b/docs/reference/rtable.html index b2f453450..de297dcef 100644 --- a/docs/reference/rtable.html +++ b/docs/reference/rtable.html @@ -25,9 +25,6 @@ - - - rtables - 0.1.1 + 0.1.0
    @@ -102,7 +99,6 @@ -
    @@ -110,20 +106,17 @@ -
    +
    -

    Reporting tables allow multiple values per cell, cell formatting and merging cells. Currently an rtable can be converted to html and ascii.

    -
    rtable(header, ..., format = NULL)
    @@ -164,7 +157,7 @@

    Details

    See also

    - +

    rrow, rcell

    Examples

    @@ -329,8 +322,6 @@

    Author

    - - diff --git a/docs/reference/rtablel.html b/docs/reference/rtablel.html index 28b546364..a1203e395 100644 --- a/docs/reference/rtablel.html +++ b/docs/reference/rtablel.html @@ -25,9 +25,6 @@ - - - rtables - 0.1.1 + 0.1.0
    @@ -102,7 +99,6 @@ -
    @@ -110,20 +106,17 @@ -
    +
    -

    This function is useful to create rtable objects with lists of rrows that are returned by the apply function family.

    -
    rtablel(header, ...)
    @@ -171,8 +164,6 @@

    Contents

    - - diff --git a/docs/reference/rtabulate.data.frame.html b/docs/reference/rtabulate.data.frame.html index c37e93ce5..1934b1e98 100644 --- a/docs/reference/rtabulate.data.frame.html +++ b/docs/reference/rtabulate.data.frame.html @@ -25,9 +25,6 @@ - - - @@ -58,7 +55,7 @@ rtables - 0.1.1 + 0.1.0
    @@ -101,7 +98,6 @@ -
    @@ -109,19 +105,16 @@ -
    +
    -

    Split data.frame and apply functions

    -
    # S3 method for data.frame
     rtabulate(x, row_by_var = no_by("row_1"),
    @@ -188,18 +181,16 @@ 

    Examp FUN = function(x) { sum(x$val) } -)

    #> X Y Z -#> (N=4) (N=4) (N=4) -#> ---------------------------------------- -#> A 8 12 16 -#> B 10 14 18
    +)
    #> X Y Z +#> ------------------------------- +#> A 8 12 16 +#> B 10 14 18
    rtabulate( x = iris, row_by_var = no_by("sum"), col_by_var = "Species", FUN = function(x) sum(x$Sepal.Length) )
    #> setosa versicolor virginica -#> (N=50) (N=50) (N=50) #> --------------------------------------------------------- #> sum 250.3 296.8 329.4
    rtabulate( @@ -207,24 +198,26 @@

    Examp row_by_var = "Species", col_by_var = no_by("sum"), FUN = function(x) sum(x$Sepal.Length) -)

    #> Error in split.default(x = seq_len(nrow(x)), f = f, drop = drop, ...): group length is 0 but data length > 0
    +)
    #> sum +#> ----------------------- +#> setosa 250.3 +#> versicolor 296.8 +#> virginica 329.4
    tbl <- rtabulate( x = iris, FUN = function(cell_data) c(sum(cell_data$Sepal.Length), sd(cell_data$Sepal.Length)), format = "xx.xx (xx.xx%)" -)
    #> Error in split.default(x = seq_len(nrow(x)), f = f, drop = drop, ...): group length is 0 but data length > 0
    -tbl
    #> setosa versicolor virginica -#> (N=50) (N=50) (N=50) -#> ----------------------------------------------------------------------------------------------------------------- -#> S.L > 5 df: 20 , and 5 , and 6.13 df: 45 , and 5.9 , and 6.13 df: 47 , and 6.6 , and 6.13 -#> S.L <= 5 df: 26 , and 5 , and 4.79 - -
    -row.names(tbl)
    #> S.L > 5 S.L <= 5 -#> "S.L > 5" "S.L <= 5"
    row.names(tbl) <- "Sum of Sepal Length"
    #> Error in `row.names<-.rtable`(`*tmp*`, value = "Sum of Sepal Length"): dimension missmatch
    -tbl
    #> setosa versicolor virginica -#> (N=50) (N=50) (N=50) -#> ----------------------------------------------------------------------------------------------------------------- -#> S.L > 5 df: 20 , and 5 , and 6.13 df: 45 , and 5.9 , and 6.13 df: 47 , and 6.6 , and 6.13 -#> S.L <= 5 df: 26 , and 5 , and 4.79 - -
    +) + +tbl
    #> col_1 +#> --------------------------- +#> row_1 876.5 (82.81%)
    +row.names(tbl)
    #> row_1 +#> "row_1"
    row.names(tbl) <- "Sum of Sepal Length" + +tbl
    #> col_1 +#> ----------------------------------------- +#> Sum of Sepal Length 876.5 (82.81%)
    iris2 <- iris iris2$fsl5 <- factor(iris$Sepal.Length > 5, levels = c(TRUE, FALSE), labels = c("S.L > 5", "S.L <= 5")) @@ -249,7 +242,6 @@

    Examp row_col_data_args = TRUE ) tbl

    #> setosa versicolor virginica -#> (N=50) (N=50) (N=50) #> ----------------------------------------------------------------------------------------------------------------- #> S.L > 5 df: 20 , and 5 , and 6.13 df: 45 , and 5.9 , and 6.13 df: 47 , and 6.6 , and 6.13 #> S.L <= 5 df: 26 , and 5 , and 4.79 - -
    @@ -279,8 +271,6 @@

    Contents

    - - diff --git a/docs/reference/rtabulate.factor.html b/docs/reference/rtabulate.factor.html index 7e1275d94..8e9bb504d 100644 --- a/docs/reference/rtabulate.factor.html +++ b/docs/reference/rtabulate.factor.html @@ -25,9 +25,6 @@ - - - @@ -58,7 +55,7 @@ rtables - 0.1.1 + 0.1.0
    @@ -101,7 +98,6 @@ - @@ -109,19 +105,16 @@ -
    +
    -

    Tabulate Factors

    -
    # S3 method for factor
     rtabulate(x, col_by = no_by("col_1"), FUN = length, ...,
    @@ -182,23 +175,20 @@ 

    Value

    Examples

    -rtabulate(x = iris$Species)
    #> col_1 -#> (N=150) -#> ------------------------- -#> setosa 50 -#> versicolor 50 -#> virginica 50
    -rtabulate(x = iris$Species, no_by("sum"))
    #> sum -#> (N=150) -#> ------------------------- -#> setosa 50 -#> versicolor 50 -#> virginica 50
    +rtabulate(x = iris$Species)
    #> col_1 +#> ----------------------- +#> setosa 50 +#> versicolor 50 +#> virginica 50
    +rtabulate(x = iris$Species, no_by("sum"))
    #> sum +#> --------------------- +#> setosa 50 +#> versicolor 50 +#> virginica 50
    sl5 <- factor(iris$Sepal.Length > 5, levels = c(TRUE, FALSE), labels = c("S.L > 5", "S.L <= 5")) rtabulate(iris$Species, col_by=sl5)
    #> S.L > 5 S.L <= 5 -#> (N=118) (N=32) #> ------------------------------------------ #> setosa 22 28 #> versicolor 47 3 @@ -214,13 +204,11 @@

    Examp row_col_data_args = TRUE, format = "xx (xx.xx%)" )

    #> S.L > 5 S.L <= 5 -#> (N=118) (N=32) #> ------------------------------------------------ #> setosa 22 (18.64%) 28 (87.5%) #> versicolor 47 (39.83%) - #> virginica 49 (41.53%) -
    rtabulate(sl5, iris$Species)
    #> setosa versicolor virginica -#> (N=50) (N=50) (N=50) #> -------------------------------------------------------------- #> S.L > 5 22 47 49 #> S.L <= 5 28 3 1
    @@ -251,8 +239,6 @@

    Contents

    - - diff --git a/docs/reference/rtabulate.html b/docs/reference/rtabulate.html index 5b79a937c..91939e5cf 100644 --- a/docs/reference/rtabulate.html +++ b/docs/reference/rtabulate.html @@ -25,9 +25,6 @@ - - - rtables - 0.1.1 + 0.1.0
    @@ -103,7 +100,6 @@ -
    @@ -111,21 +107,18 @@ -
    +
    -

    rtablulate provides a number of methods to derive rtables. Conceptually the rtabulate has it's origin in tapply.

    -
    rtabulate(x, ...)
    @@ -182,8 +175,6 @@

    Author

    - - diff --git a/docs/reference/rtabulate.logical.html b/docs/reference/rtabulate.logical.html index 41abee1e1..910db4d34 100644 --- a/docs/reference/rtabulate.logical.html +++ b/docs/reference/rtabulate.logical.html @@ -25,9 +25,6 @@ - - - @@ -58,7 +55,7 @@ rtables - 0.1.1 + 0.1.0
    @@ -101,7 +98,6 @@ -
    @@ -109,19 +105,16 @@ -
    +
    -

    tabulate a logical vector

    -
    # S3 method for logical
     rtabulate(x, col_by = no_by("col_1"), FUN = function(x)
    @@ -179,16 +172,13 @@ 

    Value

    Examples

    rtabulate(iris$Species == "setosa")
    #> col_1 -#> (N=150) #> ------------------- #> 50 (33.33%)
    rtabulate(iris$Species == "setosa", no_by("Species"), row.name = "n (n/N)")
    #> Species -#> (N=150) #> -------------------------- #> n (n/N) 50 (33.33%)
    # default: percentages equal \code{TRUE} with(iris, rtabulate(Sepal.Length < 5, Species, row.name = "Sepal.Length < 5"))
    #> setosa versicolor virginica -#> (N=50) (N=50) (N=50) #> ---------------------------------------------------------------------- #> Sepal.Length < 5 20 (40%) 1 (2%) 1 (2%)
    # precentages with proportion of cell number of \code{TRUE}s to overvall @@ -197,7 +187,6 @@

    Examp FUN = function(cell_data, row_data) sum(cell_data) * c(1, 1/sum(row_data)), row_data_arg = TRUE ))

    #> setosa versicolor virginica -#> (N=50) (N=50) (N=50) #> ------------------------------------------------------------------------- #> Sepal.Length < 5 20 (90.91%) 1 (4.55%) 1 (4.55%)
    @@ -227,8 +216,6 @@

    Contents

    - - diff --git a/docs/reference/rtabulate.numeric.html b/docs/reference/rtabulate.numeric.html index 3907a9c8c..9e8fe00fb 100644 --- a/docs/reference/rtabulate.numeric.html +++ b/docs/reference/rtabulate.numeric.html @@ -25,9 +25,6 @@ - - - rtables - 0.1.1 + 0.1.0
    @@ -102,7 +99,6 @@ -
    @@ -110,20 +106,17 @@ -
    +
    -

    by default the fivenum function is applied to the vectors associated to the cells

    -
    # S3 method for numeric
     rtabulate(x, col_by = no_by("col_1"), FUN = mean, ...,
    @@ -181,15 +174,12 @@ 

    Value

    Examples

    rtabulate(iris$Sepal.Length)
    #> col_1 -#> (N=150) #> ---------------------------- #> mean 5.84333333333333
    rtabulate(iris$Sepal.Length, col_by = no_by("Sepal.Length"))
    #> Sepal.Length -#> (N=150) #> ---------------------------- #> mean 5.84333333333333
    with(iris, rtabulate(x = Sepal.Length, col_by = Species, row.name = "fivenum"))
    #> setosa versicolor virginica -#> (N=50) (N=50) (N=50) #> ------------------------------------------------------------- #> fivenum 5.006 5.936 6.588
    SL <- iris$Sepal.Length @@ -200,7 +190,6 @@

    Examp rtabulate(SL, Sp, median, row.name = "Median"), rtabulate(SL, Sp, range, format = "xx.xx - xx.xx", row.name = "Min - Max") )

    #> setosa versicolor virginica -#> (N=50) (N=50) (N=50) #> ------------------------------------------------------------------ #> n 50 50 50 #> Mean (SD) 5.01 (0.35) 5.94 (0.52) 6.59 (0.64) @@ -235,8 +224,6 @@

    Contents

    - - diff --git a/docs/reference/sub-.rheader.html b/docs/reference/sub-.rheader.html index 9bc30e49b..aca31931d 100644 --- a/docs/reference/sub-.rheader.html +++ b/docs/reference/sub-.rheader.html @@ -25,9 +25,6 @@ - - - @@ -58,7 +55,7 @@ rtables - 0.1.1 + 0.1.0
    @@ -101,7 +98,6 @@ -
    @@ -109,19 +105,16 @@ -
    +
    -

    access cell in rheader

    -
    # S3 method for rheader
     [(x, i, j, ...)
    @@ -170,8 +163,6 @@

    Contents

    - - diff --git a/docs/reference/sub-.rtable.html b/docs/reference/sub-.rtable.html index c7b1fabff..79a2a477e 100644 --- a/docs/reference/sub-.rtable.html +++ b/docs/reference/sub-.rtable.html @@ -25,9 +25,6 @@ - - - @@ -58,7 +55,7 @@ rtables - 0.1.1 + 0.1.0
    @@ -101,7 +98,6 @@ -
    @@ -109,19 +105,16 @@ -
    +
    -

    Accessor function

    -
    # S3 method for rtable
     [(x, i, j, ...)
    @@ -179,8 +172,6 @@

    Contents

    - - diff --git a/docs/reference/toString.rtable.html b/docs/reference/toString.rtable.html index b5f0b1141..d6c245b14 100644 --- a/docs/reference/toString.rtable.html +++ b/docs/reference/toString.rtable.html @@ -25,9 +25,6 @@ - - - @@ -58,7 +55,7 @@ rtables - 0.1.1 + 0.1.0
    @@ -101,7 +98,6 @@ -
    @@ -109,19 +105,16 @@ -
    +
    -

    Convert an rtable to ascii

    -
    # S3 method for rtable
     toString(x, gap = 8, indent.unit = 2, ...)
    @@ -170,8 +163,6 @@

    Contents

    - - diff --git a/man/rtabulate.data.frame.Rd b/man/rtabulate.data.frame.Rd index 913884434..2f4777a1f 100644 --- a/man/rtabulate.data.frame.Rd +++ b/man/rtabulate.data.frame.Rd @@ -6,7 +6,7 @@ \usage{ \method{rtabulate}{data.frame}(x, row_by_var = no_by("row_1"), col_by_var = no_by("col_1"), FUN = nrow, ..., row_col_data_args = FALSE, - format = "xx", indent = 0) + format = "xx", indent = 0, col_total = "(N=xx)") } \arguments{ \item{x}{a vecor} @@ -30,6 +30,10 @@ then the \code{format} is applied} \item{indent}{non-negative integer where 0 means that the row should not be indented} + +\item{col_total}{a format string for displaying the number of elements in the +column header. If \code{NULL} then no header row for the column is +displayed.} } \value{ an \code{\link{rtable}} project