Skip to content

Commit

Permalink
documents completed
Browse files Browse the repository at this point in the history
  • Loading branch information
kaz-yos committed Feb 15, 2014
1 parent a1e417d commit cbea5d1
Show file tree
Hide file tree
Showing 22 changed files with 117 additions and 106 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: tableone
Type: Package
Title: Create "Table 1" to describe baseline characteristics
Version: 0.2.1
Date: 2014-02-14
Date: 2014-02-15
Author: Kazuki Yoshida, Justin Bohn
Maintainer: Kazuki Yoshida <[email protected]>
Description: This package creates "Table 1", i.e., description of baseline
Expand Down
24 changes: 12 additions & 12 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
tableone 0.2.0
tableone 0.2.1 (2014-02-15)
----------------------------------------------------------------
NEW FEATURES

* CreateTableOne and related print/summary methods were added.
BUG FIXES

* CreateTableOne can crate a table with both categorical and
continuous variables.
* Documentations were fixed to represent the current version.


tableone 0.1.3
tableone 0.2.0 (2014-02-14)
----------------------------------------------------------------
NEW FEATURES

* The print method can suppress printing by printToggle option.
* CreateTableOne and related print/summary methods were added.

* (CreateTableOne and related print and summary methods are introduced).
* CreateTableOne can crate a table with both categorical and
continuous variables.

* The print method can suppress printing by printToggle option.

BUG FIXES

* In the Roxygen part of the code, only at_export followed by nothing is used.


tableone 0.1.2
tableone 0.1.2 (2014-02-09)
----------------------------------------------------------------
BUG FIXES

Expand All @@ -33,7 +33,7 @@ BUG FIXES
* Passed all the default tests by R CMD check file.tar.gz


tableone 0.1.1
tableone 0.1.1 (2014-02-09)
----------------------------------------------------------------
BUG FIXES

Expand All @@ -42,7 +42,7 @@ BUG FIXES
* Documents are now included in


tableone 0.1.0
tableone 0.1.0 (2014-02-08)
----------------------------------------------------------------
FIRST DEVELOPMENTAL VERSION

Expand Down
8 changes: 3 additions & 5 deletions R/CreateContTable.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
##' kurtosis (same definition as in SAS). All of them can be seen in the
##' summary method output. The print method uses subset of these. You can
##' choose subset of them or reorder them. They are all configure to omit NA
##' values (na.rm = TRUE).
##' @param func.additional Additional functions can be given as a named list.
##' For example, list(sum = sum).
##' values (\code{na.rm = TRUE}).
##' @param func.additional Additional functions can be given as a named list. For example, \code{list(sum = sum)}.
##' @param test If TRUE, as in the default and there are more than two groups,
##' groupwise comparisons are performed. Both tests that assume normality and
##' tests that do not are performed. Either one of the result can be obtained
Expand All @@ -27,7 +26,7 @@
##' tests. The default is \code{\link{oneway.test}}. This is equivalent of the t-test when there are only two groups.
##' @param argsNormal A named list of arguments passed to the function specified in \code{testNormal}. The default is \code{list(var.equal = TRUE)}, which makes it the ordinary ANOVA that assumes equal variance across groups.
##' @param testNonNormal A function used to perform the nonparametric tests.
##' The default is \code{kruskal.test} (Kruskal-Wallis Rank Sum Test). This is
##' The default is \code{kruskal.test} (Kruskal-Wallis rank sum test). This is
##' equivalent of the wilcox.test (Man-Whitney U test) when there are only two
##' groups.
##' @param argsNonNormal A named list of arguments passed to the function specified in \code{testNonNormal}. The default is \code{list(NULL)}, which is just a placeholder.
Expand All @@ -53,7 +52,6 @@
##' ## Create an overall table for continuous variables
##' contVars <- c("time","age","bili","chol","albumin","copper",
##' "alk.phos","ast","trig","platelet","protime")
##'
##' contTableOverall <- CreateContTable(vars = contVars, data = pbc)
##'
##' ## Simply typing the object name will invoke the print.ContTable method,
Expand Down
21 changes: 13 additions & 8 deletions R/CreateTableOne.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
##' Create an object summarizing both categorical and continuous variables
##'
##' Create an object summarizing categorical variables optionally stratifying
##' by one or more startifying variables and performing statistical tests. The
##' object gives a table that is easy to use in medical research papers. See also \code{\link{print.TableOne}} and \code{\link{summary.TableOne}}.
##'
##' Create an object summarizing all baseline variables optionally stratifying by one or more startifying variables and performing statistical tests. The object gives a table that is easy to use in medical research papers. See also \code{\link{print.TableOne}} and \code{\link{summary.TableOne}}.
##'
##' @param vars Variables to be summarized given as a character vector. Factors are
##' handled as categorical variables, whereas numeric variables are handled as continuous variables.
##' @param strata Stratifying (grouping) variable name(s) given as a character
Expand All @@ -29,19 +27,19 @@
##' memory limitation. In this situation, the large sample approximation based
##' should suffice.
##' @param argsExact A named list of arguments passed to the function specified in testExact. The default is \code{list(workspace = 2*10^5)}, which specifies the memory space allocated for \code{\link{fisher.test}}.
##' @return An object of class \code{TableOne}, which really is a list of three objects.
##' @return An object of class \code{TableOne}, which really is a list of three objects.
##' @return \item{TableOne}{a categorical-continuous mixture data formatted and printed by the \code{\link{print.TableOne}} method}
##' @return \item{ContTable}{an object of class \code{ContTable}, containing continuous variables only}
##' @return \item{CatTable}{ an object of class \code{CatTable}, containing categorical variables only}
##' @return The second and third objects can be then be examined with the \code{print} and \code{summary} method, for example, \code{summary(object$CatTable)} to examine the categorical variables in detail.
##'
##'
##' @author Justin Bohn, Kazuki Yoshida
##' @seealso
##' \code{\link{CreateTableOne}}, \code{\link{print.TableOne}}, \code{\link{summary.TableOne}},
##' \code{\link{CreateCatTable}}, \code{\link{print.CatTable}}, \code{\link{summary.CatTable}},
##' \code{\link{CreateContTable}}, \code{\link{print.ContTable}}, \code{\link{summary.ContTable}}
##' @examples
##'
##'
##' ## Load
##' library(tableone)
##'
Expand Down Expand Up @@ -71,7 +69,8 @@
##' ## Specifying nonnormal variables will show the variables appropriately,
##' ## and show nonparametric test p-values. Specify variables in the exact
##' ## argument to obtain the exact test p-values.
##' print(tableOne, nonnormal = c("time"), exact = c("ascites"))
##' print(tableOne, nonnormal = c("bili","chol","copper","alk.phos","trig"),
##' exact = c("status","stage"))
##'
##' ## Use the summary.TableOne method for detailed summary
##' summary(tableOne)
Expand All @@ -84,6 +83,12 @@
##' tableOne$ContTable
##' summary(tableOne$ContTable)
##'
##' ## If your work flow includes copying to Excel and Word when writing manuscripts,
##' ## you may benefit from the quote argument. This will quote everything so that
##' ## Excel does not mess up the cells.
##' print(tableOne, nonnormal = c("bili","chol","copper","alk.phos","trig"),
##' exact = c("status","stage"), quote = TRUE)
##'
##' @export
CreateTableOne <-
function(vars, # character vector of variable names
Expand Down
24 changes: 7 additions & 17 deletions R/ShowRegTable.R
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
##' Format regression results in medically decent format
##'
##' It shows the regression result in the HR [95\% CI] p-value format, which is
##' usually the form used in medical research papers.
##' It shows the regression result in the HR [95\% CI] p-value format, which is usually the form used in medical research papers.
##'
##'
##' @param model Regression model result objects that have the summary and
##' confint methods.
##' @param exp TRUE by default. You need to specify exp = FALSE if your model
##' is has the indentity link function (linear regression, etc).
##' @param model Regression model result objects that have the summary and confint methods.
##' @param exp TRUE by default. You need to specify exp = FALSE if your model is has the indentity link function (linear regression, etc).
##' @param digits Number of digits to print for the main part.
##' @param pDigits Number of digits to print for the p-values.
##' @param quote Whether to show everything in quotes. The default is FALSE. If
##' TRUE, everything including the row and column names are quoted so that you
##' can copy it to Excel easily.
##' @return A matrix containing what you see is returned invisibly. You can
##' capture it by assignment to an object.
##' @param quote Whether to show everything in quotes. The default is FALSE. If TRUE, everything including the row and column names are quoted so that you can copy it to Excel easily.
##' @return A matrix containing what you see is returned invisibly. You can capture it by assignment to an object.
##' @author Kazuki Yoshida
##' @seealso CreateContTable, \code{\link{print.ContTable}}, \code{\link{summary.ContTable}},
##' \code{\link{CreateCatTable}}, \code{\link{print.CatTable}}, \code{\link{summary.CatTable}}
##' @examples
##'
##' ## Load
Expand All @@ -30,10 +22,8 @@
##' head(pbc)
##'
##' ## Fit a Cox regression model
##' objCoxph <-
##' coxph(formula = Surv(time, status == 2) ~ trt + age + albumin + ascites,
##' data = pbc,
##' ties = c("efron","breslow","exact")[1])
##' objCoxph <- coxph(formula = Surv(time, status == 2) ~ trt + age + albumin + ascites,
##' data = pbc)
##'
##' ## Show the simple table
##' ShowRegTable(objCoxph)
Expand Down
4 changes: 1 addition & 3 deletions R/print.CatTable.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
##' Format and print the \code{CatTable} class objects
##'
##' This is the print method for the CatTable class objects created by
##' CreateCatTable function.
##'
##' This is the \code{print} method for the \code{CatTable} class objects created by \code{\link{CreateCatTable}} function.
##'
##' @param x The result of a call to the \code{\link{CreateCatTable}} function.
##' @param missing Whether to show missing data information (not implemented
Expand Down
4 changes: 1 addition & 3 deletions R/print.ContTable.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
##' Format and print the \code{ContTable} class objects
##'
##' This is the print method for the ContTable class objects created by
##' CreateContTable function.
##'
##' This is the \code{print} method for the \code{ContTable} class objects created by \code{\link{CreateContTable}} function.
##'
##' @param x The result of a call to the \code{\link{CreateContTable}} function.
##' @param missing Whether to show missing data information (not implemented
Expand Down
15 changes: 11 additions & 4 deletions R/print.TableOne.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
##' Format and print the \code{TableOne} class objects
##'
##' This is the print method for the TableOne class objects created by
##' CreateTableOne function.
##'
##' This is the \code{print} method for the \code{TableOne} class objects created by \code{\link{CreateTableOne}} function.
##'
##' @param x The result of a call to the \code{\link{CreateTableOne}} function.
##' @param missing Whether to show missing data information (not implemented
Expand Down Expand Up @@ -65,10 +63,19 @@
##' ## Specifying nonnormal variables will show the variables appropriately,
##' ## and show nonparametric test p-values. Specify variables in the exact
##' ## argument to obtain the exact test p-values.
##' print(tableOne, nonnormal = c("time"), exact = c("ascites"))
##' print(tableOne, nonnormal = c("bili","chol","copper","alk.phos","trig"),
##' exact = c("status","stage"))
##'
##' ## Use the summary.TableOne method for detailed summary
##' summary(tableOne)
##'
##' ## See the categorical part only using $ operator
##' tableOne$CatTable
##' summary(tableOne$CatTable)
##'
##' ## See the continuous part only using $ operator
##' tableOne$ContTable
##' summary(tableOne$ContTable)
##'
##' @export
print.TableOne <- function(x, missing = FALSE,
Expand Down
6 changes: 1 addition & 5 deletions R/summary.CatTable.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
##' Shows all results in a \code{CatTable} class object
##'
##' This method shows all the data a CatTable class object has. This includes
##' the (optionally stratified) part with summary statistics and p-values from
##' the approximation method test (chisq.test by default) and exact method test
##' (fisher.test by default).
##'
##' This method shows all the data a \code{CatTable} class object has. This includes the (optionally stratified) part with summary statistics and , if available, p-values from the approximation method test (\code{\link{chisq.test}} by default) and exact method test (\code{\link{fisher.test}} by default).
##'
##' @param object An object that has the \code{CatTable} class to be shown.
##' @param digits Number of digits to print.
Expand Down
6 changes: 1 addition & 5 deletions R/summary.ContTable.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
##' Shows all results in a \code{ContTable} class object
##'
##' This method shows all the data a \code{ContTable} class object has. This includes
##' the (optionally stratified) part with summary statistics and p-values from
##' the normal assupmtion-based test (oneway.test by default) and nonparametric
##' test (kruskal.test by default).
##'
##' This method shows all the data a \code{ContTable} class object has. This includes the (optionally stratified) part with summary statistics and , if available, p-values from the normal assupmtion-based test (\code{\link{oneway.test}} by default) and nonparametric test (\code{\link{kruskal.test}} by default).
##'
##' @param object An object that has the \code{ContTable} class to be shown.
##' @param digits Number of digits to print.
Expand Down
5 changes: 0 additions & 5 deletions R/summary.TableOne.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@
##' ## Just typing the object name will invoke the print.TableOne method
##' tableOne
##'
##' ## Specifying nonnormal variables will show the variables appropriately,
##' ## and show nonparametric test p-values. Specify variables in the exact
##' ## argument to obtain the exact test p-values.
##' print(tableOne, nonnormal = c("time"), exact = c("ascites"))
##'
##' ## Use the summary.TableOne method for detailed summary
##' summary(tableOne)
##'
Expand Down
13 changes: 11 additions & 2 deletions R/tableone-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
##'
##' Hadley Wickham for packaging advice and for creating tools this package was made with (roxygen2, devtools, testthat).
##'
##' Members of Facebook Organization of R Users for Medical Statistics in Japan (FORUMS-J) for testing pre-release versions.
##'
##' Developmental repository is on github. Your contributions are appreciated.
##'
##' https://github.com/kaz-yos/tableone
Expand Down Expand Up @@ -54,11 +56,12 @@
##' ## Specifying nonnormal variables will show the variables appropriately,
##' ## and show nonparametric test p-values. Specify variables in the exact
##' ## argument to obtain the exact test p-values.
##' print(tableOne, nonnormal = c("time"), exact = c("ascites"))
##' print(tableOne, nonnormal = c("bili","chol","copper","alk.phos","trig"),
##' exact = c("status","stage"))
##'
##' ## Use the summary.TableOne method for detailed summary
##' summary(tableOne)
##'
##'
##' ## See the categorical part only using $ operator
##' tableOne$CatTable
##' summary(tableOne$CatTable)
Expand All @@ -67,4 +70,10 @@
##' tableOne$ContTable
##' summary(tableOne$ContTable)
##'
##' ## If your work flow includes copying to Excel and Word when writing manuscripts,
##' ## you may benefit from the quote argument. This will quote everything so that
##' ## Excel does not mess up the cells.
##' print(tableOne, nonnormal = c("bili","chol","copper","alk.phos","trig"),
##' exact = c("status","stage"), quote = TRUE)
##'
NULL
8 changes: 4 additions & 4 deletions man/CreateContTable.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ CreateContTable(vars, strata, data, func.names = c("n", "miss", "mean", "sd",
(same definition as in SAS). All of them can be seen in
the summary method output. The print method uses subset
of these. You can choose subset of them or reorder them.
They are all configure to omit NA values (na.rm = TRUE).}
They are all configure to omit NA values (\code{na.rm =
TRUE}).}

\item{func.additional}{Additional functions can be given
as a named list. For example, list(sum = sum).}
as a named list. For example, \code{list(sum = sum)}.}

\item{test}{If TRUE, as in the default and there are more
than two groups, groupwise comparisons are performed.
Expand All @@ -50,7 +51,7 @@ CreateContTable(vars, strata, data, func.names = c("n", "miss", "mean", "sd",

\item{testNonNormal}{A function used to perform the
nonparametric tests. The default is \code{kruskal.test}
(Kruskal-Wallis Rank Sum Test). This is equivalent of the
(Kruskal-Wallis rank sum test). This is equivalent of the
wilcox.test (Man-Whitney U test) when there are only two
groups.}

Expand Down Expand Up @@ -87,7 +88,6 @@ head(pbc)
## Create an overall table for continuous variables
contVars <- c("time","age","bili","chol","albumin","copper",
"alk.phos","ast","trig","platelet","protime")

contTableOverall <- CreateContTable(vars = contVars, data = pbc)

## Simply typing the object name will invoke the print.ContTable method,
Expand Down
11 changes: 9 additions & 2 deletions man/CreateTableOne.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ the \code{print} and \code{summary} method, for example,
variables in detail.
}
\description{
Create an object summarizing categorical variables
Create an object summarizing all baseline variables
optionally stratifying by one or more startifying variables
and performing statistical tests. The object gives a table
that is easy to use in medical research papers. See also
Expand Down Expand Up @@ -125,7 +125,8 @@ tableOne
## Specifying nonnormal variables will show the variables appropriately,
## and show nonparametric test p-values. Specify variables in the exact
## argument to obtain the exact test p-values.
print(tableOne, nonnormal = c("time"), exact = c("ascites"))
print(tableOne, nonnormal = c("bili","chol","copper","alk.phos","trig"),
exact = c("status","stage"))

## Use the summary.TableOne method for detailed summary
summary(tableOne)
Expand All @@ -137,6 +138,12 @@ summary(tableOne$CatTable)
## See the continuous part only using $ operator
tableOne$ContTable
summary(tableOne$ContTable)

## If your work flow includes copying to Excel and Word when writing manuscripts,
## you may benefit from the quote argument. This will quote everything so that
## Excel does not mess up the cells.
print(tableOne, nonnormal = c("bili","chol","copper","alk.phos","trig"),
exact = c("status","stage"), quote = TRUE)
}
\author{
Justin Bohn, Kazuki Yoshida
Expand Down
Loading

0 comments on commit cbea5d1

Please sign in to comment.