Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6e2643b
Showing
67 changed files
with
20,513 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
Package: arsenal | ||
Title: An Arsenal of 'R' Functions for Large-Scale Statistical | ||
Summaries | ||
Version: 0.1.2 | ||
Date: 2016-12-29 | ||
Authors@R: c( | ||
person("Ethan", "Heinzen", email = "heinzen.ethan@mayo.edu", role = c("aut", "cre")), | ||
person("Jason", "Sinnwell", role="aut"), | ||
person("Elizabeth", "Atkinson", role="aut"), | ||
person("Tina", "Gunderson", role="aut"), | ||
person("Gregory", "Dougherty", role="aut"), | ||
person("Patrick", "Votruba", role="ctb"), | ||
person("Emily", "Lundt", role="ctb") | ||
) | ||
Description: An Arsenal of 'R' functions for large-scale statistical summaries, | ||
which are streamlined to work within the latest reporting tools in 'R' and | ||
'RStudio' and which use formulas and versatile summary statistics for summary | ||
tables and models. The primary functions include tableby(), a Table-1-like | ||
summary of multiple variable types 'by' the levels of a categorical | ||
variable; modelsum(), which performs simple model fits on the same endpoint | ||
for many variables (univariate or adjusted for standard covariates); | ||
and freqlist(), a powerful frequency table across many categorical variables. | ||
Suggests: knitr, rmarkdown, xtable, survival, testthat, coin, pROC, | ||
MASS, gam, rpart | ||
Depends: R (>= 3.2.0), stats (>= 3.2.0) | ||
Imports: broom, stringr | ||
VignetteBuilder: knitr | ||
License: GPL (>= 2) | ||
RoxygenNote: 5.0.1 | ||
NeedsCompilation: no | ||
Packaged: 2016-12-29 15:03:54 UTC; m144326 | ||
Author: Ethan Heinzen [aut, cre], | ||
Jason Sinnwell [aut], | ||
Elizabeth Atkinson [aut], | ||
Tina Gunderson [aut], | ||
Gregory Dougherty [aut], | ||
Patrick Votruba [ctb], | ||
Emily Lundt [ctb] | ||
Maintainer: Ethan Heinzen <heinzen.ethan@mayo.edu> | ||
Repository: CRAN | ||
Date/Publication: 2016-12-30 01:18:42 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
966d309a0df5d55be152e36454793ba7 *DESCRIPTION | ||
3f62d030021234740076da4d1ba8f002 *NAMESPACE | ||
a5124b7fb1a608cf22414d0d439c5893 *NEWS.md | ||
babe9da5c34ab0be1462ebb582b67f01 *R/arsenal.R | ||
79e2033244f329fa85d87cbc4013f678 *R/formulize.R | ||
cfa9ea4571efbb3e9de3bc79dcc56041 *R/freqlist.R | ||
e42ce669505128b0f0b20ac6c621e91d *R/freqlist.internal.R | ||
02a7e6a76fe38503ed55d6d0da6e12dd *R/internal.functions.R | ||
2f474534e9fc946996d331ad8103b5ea *R/magic8.R | ||
e54a23c0326058d798de6b3c912a8003 *R/mdy.Date.R | ||
1de6a042544ab82b1d3e5d5264e3ffe9 *R/mockstudy.R | ||
8a60fb9fd3e6b75451fd52a671343fdf *R/modelsum.R | ||
8972abaedd55f0c7f1418ad70f233302 *R/modelsum.control.R | ||
8c879e7ce937bdbedb5fd3fb31a11d3f *R/modelsum.internal.R | ||
0e56f25775a178e261295319e70889bd *R/not.in.R | ||
50cd5149107450c83f3e3f855aeb57ad *R/release_questions.R | ||
915d58ab60615cd9c66bfc92131cfba1 *R/summary.freqlist.R | ||
1dff52d601070cac366b7123de8f8680 *R/summary.modelsum.R | ||
318e7c0c95e3737f5c209a9ba9ebea7b *R/summary.tableby.R | ||
918558ed28af0fd4f0338c9d9787b926 *R/tableby.R | ||
6cd26e41a5b57be0697d1e98594fb16d *R/tableby.control.R | ||
4b5df64d48a8f090b29f7eb55008b5db *R/tableby.internal.R | ||
9bb29fd9186f2e7c11351693f70aa2e8 *R/tableby.stat.tests.R | ||
d795cb92f9d3e5ec846b31c0579badd3 *R/tableby.stats.R | ||
872993fdbe93e6707fae16f6e0a0c99f *R/write2.R | ||
018618b1d1fb15a1945e7892e2868204 *README.md | ||
4aafc7bc18223c036874a46def9050bc *build/vignette.rds | ||
30cd2d9369ee4d94dd76dcbf5a215559 *data/mockstudy.RData | ||
79433ae6628afba73b4751b5e6bbb32e *inst/doc/freqlist.R | ||
b90b634df89f2a4dc597b834d4a0457d *inst/doc/freqlist.Rmd | ||
197db4ba70c32f0a3579ba56e71b8c7b *inst/doc/freqlist.pdf | ||
2be512c16c57f0c19d46a03559fa66ed *inst/doc/modelsum.R | ||
cfe0b0bd54ea0d5dd64b179d025a5621 *inst/doc/modelsum.Rmd | ||
85570c3c621adb383c345f2e09bd5a1e *inst/doc/modelsum.html | ||
48ac3590253a78deafa97b9c8a30ba4f *inst/doc/tableby.R | ||
0f686caa3862dd071b6538bd17b5d0c8 *inst/doc/tableby.Rmd | ||
78a397ba49bf53164ac6bf6eb5278c0b *inst/doc/tableby.html | ||
fb7f3dd8cf45309fc533d5cb863271b8 *man/arsenal.Rd | ||
a08790dee110e6f91216f1c9f7b9888e *man/as.data.frame.freqlist.Rd | ||
fb7c429f3c12092d0fad2dc88754fd8f *man/as.data.frame.modelsum.Rd | ||
1326c71d7954bf79cd26895f0aedd30f *man/as.data.frame.tableby.Rd | ||
2133b459a58b59f77b1e835fafc009e6 *man/formulize.Rd | ||
c15c3a5f78637e5ac782800687fd2289 *man/freqlist.Rd | ||
b149f67287b2605109b516fbd9ef8f20 *man/freqlist.internal.Rd | ||
5148640645d5b9f0de27a83ba4ed6788 *man/grapes-nin-grapes.Rd | ||
2e1f8c2d941134f65a82f84346247458 *man/mdy.Date.Rd | ||
4cd57758131c3d1dffce65879eb34e76 *man/mockstudy.Rd | ||
fb624ea9b801473dae9d30eefe8a1047 *man/modelsum.Rd | ||
ee7241120bee38b7c92d9160f86699e0 *man/modelsum.control.Rd | ||
56b926cfc2d81c0539e70ca8a4d68794 *man/modelsum.internal.Rd | ||
562faf3ed641a245644af5887f5704aa *man/summary.freqlist.Rd | ||
1a749d94bb67684290e8d11927700f0d *man/summary.modelsum.Rd | ||
b03d9fe7d9940a052a7b539b58a4f2c5 *man/summary.tableby.Rd | ||
d8894b3a8db813af90570d664d3009dd *man/tableby.Rd | ||
e60ebe8ed16f9112a141ec2b24574b10 *man/tableby.control.Rd | ||
c00a698159af17705b7306ce44e2070b *man/tableby.internal.Rd | ||
a7d8a4fca049fadfeb6be460b35a209f *man/tableby.stats.Rd | ||
6d0a923e8398c923744d26bcbb44ddc3 *man/write2.Rd | ||
b86d96d2b720f7aeeb3b9412b87d67ef *tests/testthat.R | ||
ba8ab9b99798b694a5f5b06b9a28f2d8 *tests/testthat/test_formulize.R | ||
6811553415304e4626ae831d29c1d680 *tests/testthat/test_freqlist.R | ||
d4732617af6ee210bbdc165014b5a4b2 *tests/testthat/test_modelsum.R | ||
357806abad78c1b6ca0c358d6d4d9b4a *tests/testthat/test_tableby.R | ||
b90b634df89f2a4dc597b834d4a0457d *vignettes/freqlist.Rmd | ||
cfe0b0bd54ea0d5dd64b179d025a5621 *vignettes/modelsum.Rmd | ||
0f686caa3862dd071b6538bd17b5d0c8 *vignettes/tableby.Rmd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
S3method("[",modelsum) | ||
S3method("[",tableby) | ||
S3method("labels<-",freqlist) | ||
S3method("labels<-",modelsum) | ||
S3method("labels<-",tableby) | ||
S3method(as.data.frame,freqlist) | ||
S3method(as.data.frame,modelsum) | ||
S3method(as.data.frame,tableby) | ||
S3method(labels,freqlist) | ||
S3method(labels,modelsum) | ||
S3method(labels,tableby) | ||
S3method(merge,modelsum) | ||
S3method(merge,tableby) | ||
S3method(print,freqlist) | ||
S3method(print,modelsum) | ||
S3method(print,modelsumList) | ||
S3method(print,tableby) | ||
S3method(summary,freqlist) | ||
S3method(summary,modelsum) | ||
S3method(summary,tableby) | ||
S3method(tests,tableby) | ||
export("%nin%") | ||
export("labels<-") | ||
export(Date.mdy) | ||
export(N) | ||
export(Nevents) | ||
export(Nmiss) | ||
export(countpct) | ||
export(formulize) | ||
export(freqlist) | ||
export(mdy.Date) | ||
export(meansd) | ||
export(medSurv) | ||
export(medianq1q3) | ||
export(medianrange) | ||
export(modelsum) | ||
export(modelsum.control) | ||
export(modpval.tableby) | ||
export(na.modelsum) | ||
export(na.tableby) | ||
export(q1q3) | ||
export(tableby) | ||
export(tableby.control) | ||
export(tests) | ||
export(write2html) | ||
export(write2pdf) | ||
export(write2word) | ||
import(broom) | ||
import(stringr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# arsenal 0.1.2 | ||
|
||
* `broom` and `stringr` have been moved to `imports` instead of `depends`. | ||
|
||
* Several minor tweaks to `freqlist` for better readability and performance. | ||
|
||
# arsenal 0.1.1 | ||
|
||
* The description and the title are more descriptive now, per request. | ||
|
||
# arsenal 0.1.0 | ||
|
||
* First release contains major functions `tableby()`, `modelsum()`, `freqlist()`, `formulize()`, and `write2...`. | ||
|
||
* Vignettes are included for `tableby()`, `modelsum()`, and `freqlist()`. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
## Created: 12/13/2016 | ||
## Author: Ethan Heinzen | ||
|
||
#' An Arsenal of 'R' Functions for Large-Scale Statistical Summaries | ||
#' | ||
#' An Arsenal of 'R' functions for large-scale statistical summaries, | ||
#' which are streamlined to work within the latest reporting tools in 'R' and 'RStudio' and | ||
#' which use formulas and versatile summary statistics for summary tables and models. | ||
#' | ||
#' @section Functions: | ||
#' | ||
#' Below are listed some of the most widely used functions available in \code{arsenal}: | ||
#' | ||
#' \code{\link{tableby}}: Summary statistics Of a set of independent variables by a categorical variable. | ||
#' | ||
#' \code{\link{modelsum}}: Fit models over each of a set of independent variables with a response variable. | ||
#' | ||
#' \code{\link{freqlist}}: Approximate the output from SAS's \code{PROC FREQ} procedure when using the \code{/list} option of the \code{TABLE} statement. | ||
#' | ||
#' \code{\link{write2word}}, \code{\link{write2html}}, \code{\link{write2pdf}}: Functions to generate a word, html, or pdf document containing a single table. | ||
#' | ||
#' \code{\link{formulize}}: A shortcut to generate one-, two-, or many-sided formulas. | ||
#' | ||
#' \code{\link{mdy.Date}} and \code{\link{Date.mdy}}: Convert numeric dates for month, day, and year to Date object, and vice versa. | ||
#' | ||
#' @section Data: | ||
#' | ||
#' \code{\link{mockstudy}}: Mock study data for examples. | ||
#' | ||
#' @examples | ||
#' library(arsenal) | ||
#' | ||
#' @docType package | ||
#' @name arsenal | ||
#' | ||
NULL | ||
|
||
#### commands to build the package using devtools | ||
# devtools::document() | ||
# devtools::check_man() | ||
# devtools::test() | ||
# devtools::check() | ||
# withr::with_libpaths(c("/data5/bsi/adhoc/s200555.R-infrastructure/devel/eph/testinstalls/", .libPaths()), | ||
# devtools::install("../arsenal-eph/", build_vignettes = TRUE, dependencies = FALSE)) | ||
# devtools::build("../arsenal-eph/") | ||
## < restart R > | ||
## library(arsenal, lib.loc = "/data5/bsi/adhoc/s200555.R-infrastructure/devel/eph/testinstalls/") | ||
|
||
#### to upload to CRAN | ||
## Update DESCRIPTION, README.md, NEWS.md, and cran-comments.md | ||
# devtools::revdep_check() | ||
# devtools::release() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#' formulize | ||
#' | ||
#' A shortcut to generate one-, two-, or many-sided formulas from vectors of variable names. | ||
#' | ||
#' @param y,x,... Character vectors to be collapsed (by \code{"+"}) and put left-to-right in the formula. | ||
#' If \code{data} is supplied, these can also be numeric, denoting which column name to use. See examples. | ||
#' @param data An R object with non-null column names. | ||
#' @author Ethan Heinzen | ||
#' @examples | ||
#' ## two-sided formula | ||
#' formulize("y", c("x1", "x2", "x3")) | ||
#' | ||
#' ## one-sided formula | ||
#' formulize(x = c("x1", "x2", "x3")) | ||
#' | ||
#' ## multi-sided formula | ||
#' formulize("y", c("x1", "x2", "x3"), c("z1", "z2"), "w1") | ||
#' | ||
#' ## can use numerics for column names | ||
#' data(mockstudy) | ||
#' formulize(y = 1, x = 2:4, data = mockstudy) | ||
#' | ||
#' ## mix and match | ||
#' formulize(1, c("x1", "x2", "x3"), data = mockstudy) | ||
#' | ||
#' ## get an interaction | ||
#' formulize("y", c("x1*x2", "x3")) | ||
#' | ||
#' ## use in an lm | ||
#' form <- formulize(2, 3:4, data = mockstudy) | ||
#' summary(lm(form, data = mockstudy)) | ||
#' | ||
#' @export | ||
|
||
formulize <- function(y = "", x = "", ..., data = NULL) | ||
{ | ||
dots <- list(y = y, x = x, ...) | ||
if(!is.null(data)) | ||
{ | ||
if(is.null(colnames(data))) stop("colnames(data) is NULL") | ||
dots <- lapply(dots, function(elt, cn) if(is.numeric(elt)) cn[elt] else elt, cn = colnames(data)) | ||
} | ||
trash <- lapply(dots, function(elt) if(!is.character(elt)) stop("One or more argument isn't a character vector")) | ||
elts <- vapply(dots, paste0, character(1), collapse = " + ") | ||
stats::as.formula(paste0(elts, collapse = " ~ ")) | ||
} |
Oops, something went wrong.