Skip to content

Commit

Permalink
version 3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
eheinzen authored and cran-robot committed Jun 13, 2019
1 parent 252ac77 commit a71126b
Show file tree
Hide file tree
Showing 31 changed files with 299 additions and 123 deletions.
8 changes: 4 additions & 4 deletions DESCRIPTION
@@ -1,8 +1,8 @@
Package: arsenal
Title: An Arsenal of 'R' Functions for Large-Scale Statistical
Summaries
Version: 3.1.0
Date: 2019-05-03
Version: 3.2.0
Date: 2019-06-13
Authors@R: c(
person("Ethan", "Heinzen", email = "heinzen.ethan@mayo.edu", role = c("aut", "cre")),
person("Jason", "Sinnwell", role="aut"),
Expand Down Expand Up @@ -41,7 +41,7 @@ RoxygenNote: 6.1.1
LazyData: true
Encoding: UTF-8
NeedsCompilation: no
Packaged: 2019-05-03 13:59:18 UTC; m144326
Packaged: 2019-06-13 20:05:07 UTC; m144326
Author: Ethan Heinzen [aut, cre],
Jason Sinnwell [aut],
Elizabeth Atkinson [aut],
Expand All @@ -56,4 +56,4 @@ Author: Ethan Heinzen [aut, cre],
Maddie McCullough [art]
Maintainer: Ethan Heinzen <heinzen.ethan@mayo.edu>
Repository: CRAN
Date/Publication: 2019-05-03 14:20:06 UTC
Date/Publication: 2019-06-13 20:30:18 UTC
60 changes: 30 additions & 30 deletions MD5
@@ -1,14 +1,14 @@
b9c5e4126a4ad6e7fffa3063b22fab0e *DESCRIPTION
b4dcfe9b4f2371361d7d4e9e01e42c7d *DESCRIPTION
07c8d8057816eac6ff49061346142fd7 *NAMESPACE
03f2ee293cef0553da3c3e42926f485b *NEWS.md
78c494e5f79737c26f2058024d6670ea *NEWS.md
5b33cdf09e4978d1a2579d9592c4b1cc *R/arsenal.R
abb1a9664cc88888a6e2f5b157c01c9b *R/arsenal_table.R
ae4cc563cec6903508dd14f27bdb6198 *R/arsenal_table.R
59d0400128715ca191a6f4ef69eb7fc4 *R/as.data.frame.freqlist.R
ae9df496897ab4de26a64a2ffad239ad *R/as.data.frame.modelsum.R
ec9777d58f7c3ed96fd74fafa087b2fb *R/as.data.frame.tableby.R
7bdf19ee28eaada5910c825ef65555da *R/comparedf.R
cf64d94a1c4cd1104df8884bdc11a9e5 *R/comparedf.R
e504af4f850d271d3377bb09ec7d552d *R/comparedf.control.R
8a1313fb84b9c624fad42e56ad428721 *R/comparedf.internal.R
9ef1d13a6661ff41b66b73b26fa717be *R/comparedf.internal.R
f9f65a3c5586c48d03d87b10e13979e6 *R/comparedf.tolerances.R
d2f83d6128a6e5008822e8b71f657923 *R/defunct.R
03fb09ede835462d843db3e527cc4355 *R/deprecated.R
Expand All @@ -22,28 +22,28 @@ f0a1429f4166c383330c680dc3f9362b *R/formulize.R
310d0f18b36486d507146ac617eb00c1 *R/magic8.R
f3bc182ae0dcd827a0d3d3e191db4828 *R/mdy.Date.R
551c162106f2f1b9a25b8ccc697d13cc *R/mockstudy.R
fefbe0db8d2c55b288a97b5cdcca8b67 *R/modelsum.R
ac1e9e45139a00caad05c1a1369d84f3 *R/modelsum.control.R
6cdda29d232c29b0ef7a8426cdf36f59 *R/modelsum.R
0b1790878b9e3dc503aea8b74be9a727 *R/modelsum.control.R
f185db7745b08bf5fede8713b58c8f2f *R/modelsum.families.R
0e48b04e537a5666a40d0a92c9ca20c4 *R/modelsum.internal.R
d280d3f55b975402d897e7d03047b59d *R/na.operations.R
15be85a18a2039cd41e3bf7bb81645e5 *R/not.in.R
e2458db48a5f1c367d36bf8cd890c549 *R/padjust.R
bef5a31f0313bbc80b94c630ec3cd4ac *R/paired.R
58daa2898d3eaa108413bbcf8f91fe2c *R/paired.R
2f599abb94e552e242d5024992e6dde8 *R/paired.control.R
20ece227c49dc16e0dadcbbca96500cf *R/paired.internal.R
478c34566a5036fa736f0b97cf40f58e *R/paired.stat.tests.R
e1427edd79dc20bae932449d90fb5161 *R/release_questions.R
dee452a9211b126fd3ce4ae349cb60fe *R/summary.comparedf.R
61d3d00697e72fe4067cb2b3eb8683af *R/summary.comparedf.R
a9b398c9003e293c1e8f6c308c8f8fed *R/summary.freqlist.R
fef6172e4c68c6ec93a794d7854951d2 *R/summary.modelsum.R
9eeb16b706ecf923d80d53f050ea3573 *R/summary.tableby.R
548264ee6d2548a2815f82ddf1e59c30 *R/tableby.R
89c9caf443ac45b4c7c12ff2b1fdf2a9 *R/summary.tableby.R
1336a4ebd60a44353698599eb1c2b85d *R/tableby.R
c9fb8b29f224d3de3bdecf8ecd6940d6 *R/tableby.control.R
ee6e5f95993724b74104205ab2070498 *R/tableby.internal.R
5c8294f30960768d2c4f501c7a80c148 *R/tableby.internal.R
bd1d097f9cd5925e287a66a8ba092acc *R/tableby.stat.tests.R
21f9a2d8f24f8d2e1d14451fadc44e40 *R/tableby.stats.R
bb3dd49aeca6fa9fbb42b1de58115e07 *R/write2.R
a8199d9cbc7b5cc81a504f7450a2a65b *R/write2.R
fa24ed85ce920343eb89c0f1ccb71553 *R/write2.default.R
9a853a569d232f1d0150ba7135a7c46e *R/write2.internal.R
c758b698e0c957f3004fd3113a10852e *R/write2specific.R
Expand All @@ -53,25 +53,25 @@ efa9906133e987f9abd69af472e09104 *README.md
30cd2d9369ee4d94dd76dcbf5a215559 *data/mockstudy.RData
a9b0eb3dac08dcda212cfd67abf6a5ba *inst/doc/comparedf.R
ca30a0326f2242eeaca8977684c31da0 *inst/doc/comparedf.Rmd
33a254a41c9c99a8c4a36918b1b3bcbc *inst/doc/comparedf.html
2c1a49e561650d78c89ce3a91ff6eba7 *inst/doc/comparedf.html
8a6b20817c3475bea6e85c61b4df62aa *inst/doc/freqlist.R
2ee669dcd5bbfff01fe56a5efa887770 *inst/doc/freqlist.Rmd
cc8cae2f4f968239ceb75b8d0954ade4 *inst/doc/freqlist.html
46ae86cf21d9e7d7243bba6c5a19dd8e *inst/doc/freqlist.html
959bef168b2edd04f6ef65f7ae52c649 *inst/doc/labels.R
61e81a2662d1117e1e2edd3c7b4e873f *inst/doc/labels.Rmd
b4ea37bcea9b1ed0f67ac3cc098c8d87 *inst/doc/labels.html
bb29e538ef346b165ace8f2346fc0685 *inst/doc/labels.html
5126203a30608388138304208e21c88c *inst/doc/modelsum.R
56a13a8963c20b55ec70fffb786c4b03 *inst/doc/modelsum.Rmd
dc1d9fb5df5c3f0f334bbfa6c0d5a039 *inst/doc/modelsum.html
5e814739399f30f7842173d2182196fa *inst/doc/modelsum.Rmd
b0f0aa1b73af2c1412f5ed75ba49ddf6 *inst/doc/modelsum.html
5952422462e488184a0279fc950ce329 *inst/doc/paired.R
c5648935a8f77b50b4e0dac60e9c8edf *inst/doc/paired.Rmd
009d52b4885cdd82f56ec8f3e45fb7ca *inst/doc/paired.html
d0fd004ee3435c439f81be9a48ffe91b *inst/doc/paired.html
3403766f99d562f36710b21486bdca45 *inst/doc/tableby.R
03284bc47fc9d4b2855bee84804929c5 *inst/doc/tableby.Rmd
521dc162c92ba64d99d880fdd02476d9 *inst/doc/tableby.html
139d970b261afe31311b4f282917f5eb *inst/doc/tableby.html
ac0f06cd6853cad72041d42887b0dd7c *inst/doc/write2.R
070dcaff0d24e34fc2ee83350c592edb *inst/doc/write2.Rmd
01a98ac9412014e61196a6ffb131fbcc *inst/doc/write2.html
612f51b70cd8205fbe248ccb16b568f2 *inst/doc/write2.html
24de5e45bd9a676927300962673534fd *man/NA.operations.Rd
fddd35de21bd3139cfd8df7526681165 *man/arsenal-defunct.Rd
1df478ecf265a7b0ea7f8701e1e793ff *man/arsenal-deprecated.Rd
Expand Down Expand Up @@ -113,41 +113,41 @@ be95212fdcc541dfa85913d60442d41b *man/tableby.control.Rd
60ce70b48e1530b5a1419e9f9aaed771 *man/tableby.internal.Rd
c270363525a365445eefe6a19b0bbcf6 *man/tableby.stats.Rd
63d0ada03a137dfb7c9042d36b2978af *man/tableby.stats.internal.Rd
d97e865e49ae9815d34cec8303d0f5bc *man/write2.Rd
3734d8a04519e86b83b22bc8d6dcea7b *man/write2.Rd
bd37dd5f49360a5a5d2a676bec1a8dd5 *man/write2.internal.Rd
c7fc15db72ee5bc262c6b816ae565f48 *man/write2specific.Rd
a0caade19c743fa6c1dfb2cbdb537a01 *man/yaml.Rd
b86d96d2b720f7aeeb3b9412b87d67ef *tests/testthat.R
48bee3e500877f2e38183bac2f96c09e *tests/testthat/helper-data.R
0e1b2cd238f9c449a27ba0cb5abd358b *tests/testthat/helper-script.R
422b5e4f05f56ef1f659e4c98d318ef5 *tests/testthat/mdat.rds
85c2ca41ad03d0024299f71a861b5ba9 *tests/testthat/test_comparedf.R
cccc5048fbbe33d25398dba3c4be4f55 *tests/testthat/test_comparedf.R
f12f36814298535220fe0c326cebbe05 *tests/testthat/test_formulize.R
3bb24311a37e7c16473a6ef2e3686494 *tests/testthat/test_freqlist.R
c04c29dbdce4f382d34b30c0bbe57684 *tests/testthat/test_keep.labels.R
de47e8a77a6ad7ac83d6c414ef092ab9 *tests/testthat/test_lhs_freqlist.R
6b2b35b56aaac54280fd855b42d39770 *tests/testthat/test_lhs_modelsum.R
0594e850a6ba34b3790a5d71448a4e60 *tests/testthat/test_lhs_tableby.R
1d457ad15dd3dba305f2ca7227e5ab39 *tests/testthat/test_lhs_tableby.R
d1f8bfd04242feecbb078b3b1b6a8b54 *tests/testthat/test_modelsum.R
24c7c0a28e636eb7939780e768954039 *tests/testthat/test_paired.R
3a9f5f951b4a22c5e33f873042d6d1ef *tests/testthat/test_tableby.R
7bdcbe4161dbc385515d4287bcfbd08b *tests/testthat/test_write2.R
55b2813ac0ea150bae2332b91721c87b *tests/testthat/test_paired.R
144ae2b443142733c884265f95ef15b8 *tests/testthat/test_tableby.R
4ee82f2c3d172bd162ad62c80783f998 *tests/testthat/test_write2.R
a3cb5fc2c67b666bd620946a87f19db7 *tests/testthat/write2.char.html.Rmd
ba6f1bee225bd630589a71a317b22127 *tests/testthat/write2.freqlist.doc.Rmd
e8c763ecc2290ce29980a96ca5a06703 *tests/testthat/write2.freqlist.html.Rmd
8322b7c9c82ef447c1a996729986859a *tests/testthat/write2.lm.pdf.Rmd
f36e89c7b1e05f8cbecb243947236092 *tests/testthat/write2.lm.pdf.Rmd
5b7b0951780ce2a0173e211c94008b60 *tests/testthat/write2.modelsum.html.Rmd
f5607094f5254cb9f4f52858bf937378 *tests/testthat/write2.multititles.pdf.Rmd
313cfea9983de10e4f9b66706f4cc317 *tests/testthat/write2.mylist.pdf.Rmd
5eaf850ce8e0c8d50583a44104915d63 *tests/testthat/write2.mylist2.doc.Rmd
fc47e093d3d5bd5ddfb72a3a057786c9 *tests/testthat/write2.mylists.pdf.Rmd
30b1725d421f80f460816a1cf453cda3 *tests/testthat/write2.render.html.Rmd
91341e80ce604a3f513b99d4f93116ec *tests/testthat/write2.tableby.html.Rmd
af61cd8368e9c8a04c22c0a1045a57a5 *tests/testthat/write2.yaml.pdf.Rmd
2664f1e86af3bc19f4364e0eb1d1ab88 *tests/testthat/write2.yaml.pdf.Rmd
ca30a0326f2242eeaca8977684c31da0 *vignettes/comparedf.Rmd
2ee669dcd5bbfff01fe56a5efa887770 *vignettes/freqlist.Rmd
61e81a2662d1117e1e2edd3c7b4e873f *vignettes/labels.Rmd
56a13a8963c20b55ec70fffb786c4b03 *vignettes/modelsum.Rmd
5e814739399f30f7842173d2182196fa *vignettes/modelsum.Rmd
c5648935a8f77b50b4e0dac60e9c8edf *vignettes/paired.Rmd
03284bc47fc9d4b2855bee84804929c5 *vignettes/tableby.Rmd
070dcaff0d24e34fc2ee83350c592edb *vignettes/write2.Rmd
30 changes: 30 additions & 0 deletions NEWS.md
@@ -1,3 +1,33 @@
# arsenal v3.2.0

* `comparedf()`:

- Fixed a bug when "row.names" was used in combination with other by-variables. (#212)

- Allowed for comparison of variables which have any class in common. (#216)

- `summary.comparedf()`:

* Removed the "comparedf.frame.summary" class from the first element to allow it to print. (#211)

* Fixed a bug with reporting blank by-variables. (#213)

* Fixed a bug with reporting by-variables as variables in common. (#214)

* `modelsum()`: added Wald confidence intervals to `binom.stats=`. (#219)

* `tableby()` / `paired()`:

- Fixed a bug with `merge.arsenal_table()` losing control parameters for `tableby()` objects. (#221)

- Allowed for variable-name-only `labelTranslations=` assignment for terms with inline statistical test specification.
Backward compatibility should be maintained here. (#220)

- Fixed a bug with assigning `NULL` labels with inline statistical test specifications. (#222)

- `summary.tableby()`: fixed a bug with formatting when strata aren't in alphabetical order and have different number of elements
(e.g., if only one includes missing values). (#215)

# arsenal v3.1.0

* `tableby()` / `paired()`:
Expand Down
14 changes: 12 additions & 2 deletions R/arsenal_table.R
Expand Up @@ -156,7 +156,14 @@ make_ms_labs <- function(x)
val <- unname(value[L])
for(j in seq_along(x$tables[[i]]$x))
{
if(nm %in% x$tables[[i]]$x[[j]]$term) x$tables[[i]]$x[[j]]$label[x$tables[[i]]$x[[j]]$term == nm] <- val
if(nm %in% x$tables[[i]]$x[[j]]$term)
{
x$tables[[i]]$x[[j]]$label[x$tables[[i]]$x[[j]]$term == nm] <- val
} else if(nm %in% x$tables[[i]]$x[[j]]$term.orig)
{
# for backwards-compatibility
x$tables[[i]]$x[[j]]$label[x$tables[[i]]$x[[j]]$term.orig == nm] <- val
}
}
for(j in seq_along(x$tables[[i]]$adjust))
{
Expand Down Expand Up @@ -215,10 +222,13 @@ merge.arsenal_table <- function(x, y, all = FALSE, all.x = all, all.y = all, ...
if(!identical(x$tables[[ytrm]]$strata, y$tables[[ytrm]]$strata)) stop("Strata not identical for term ", ytrm)
if(!identical(x$tables[[ytrm]]$adjust, y$tables[[ytrm]]$adjust)) stop("Adjust not identical for term ", ytrm)
if(x$tables[[ytrm]]$hasWeights != y$tables[[ytrm]]$hasWeights) stop("Weights not present in both objects for term ", ytrm)
if(!identical(x$tables[[ytrm]]$family, y$tables[[ytrm]]$family)) stop("Weights not present in both objects for term ", ytrm)
if(!identical(x$tables[[ytrm]]$family, y$tables[[ytrm]]$family)) stop("'family' not the same in both objects for term ", ytrm)

xtrms <- names(y$tables[[ytrm]]$x)
x$tables[[ytrm]]$x[xtrms] <- y$tables[[ytrm]]$x
if(!is.null(x$tables[[ytrm]]$control.list) && !is.null(y$tables[[ytrm]]$control.list))
x$tables[[ytrm]]$control.list[xtrms] <- y$tables[[ytrm]]$control.list

for(j in seq_along(x$tables[[ytrm]]$tables))
{
x$tables[[ytrm]]$tables[[j]][xtrms] <- y$tables[[ytrm]]$tables[[j]]
Expand Down
8 changes: 4 additions & 4 deletions R/comparedf.R
Expand Up @@ -78,14 +78,14 @@ comparedf <- function(x, y, by = NULL, by.x = by, by.y = by, control = NULL, ...
if("row.names" %in% by.x)
{
x[["..row.names.."]] <- if(byrow) seq_len(nrow(x)) else row.names(x)
by.x <- "..row.names.."
by.x[by.x == "row.names"] <- "..row.names.."
}
if("row.names" %in% by.y)
{
y[["..row.names.."]] <- if(byrow) seq_len(nrow(y)) else row.names(y)
by.y <- "..row.names.."
by.y[by.y == "row.names"] <- "..row.names.."
}
frame.summary$by <- list(by.x, by.y)
frame.summary$by <- set_attr(list(by.x, by.y), "byrow", byrow)
frame.summary$attrs <- tmp.attrs

#### tweak the column names ####
Expand Down Expand Up @@ -147,7 +147,7 @@ print.comparedf <- function(x, ...)
cat("Function Call: \n")
print(x$Call)
cat("\n")
cat("Shared: ", sum(!idx_var_sum(x, "vars.not.shared")), " variables and ", x$frame.summary$n.shared[1], " observations.\n", sep = "")
cat("Shared: ", sum(idx_var_sum(x, "nonby.vars.shared")), " non-by variables and ", x$frame.summary$n.shared[1], " observations.\n", sep = "")
cat("Not shared: ", sum(idx_var_sum(x, "vars.not.shared")), " variables and ",
n.diff.obs(x), " observations.\n", sep = "")
cat("\n")
Expand Down
7 changes: 5 additions & 2 deletions R/comparedf.internal.R
Expand Up @@ -80,7 +80,7 @@ compare_values <- function(i, v, df, byvars, contr)
int.num <- function(vr) is.integer(vr) || is.numeric(vr)
fac.chr <- function(vr) is.factor(vr) || is.character(vr)

if(!identical(v$class.x[i], v$class.y[i]) &&
if(length(intersect(v$class.x[[i]], v$class.y[[i]])) == 0 &&
!(contr$int.as.num && int.num(var.x) && int.num(var.y)) &&
!(contr$factor.as.char && fac.chr(var.x) && fac.chr(var.y))) return("Not compared")

Expand Down Expand Up @@ -154,13 +154,16 @@ compare_attrs <- function(i, v, x_, y_)
####################################################################################################
####################################################################################################

idx_var_sum <- function(object, which = c("vars.not.shared", "vars.compared", "vars.not.compared",
idx_var_sum <- function(object, which = c("vars.not.shared", "nonby.vars.shared", "vars.compared", "vars.not.compared",
"differences.found", "non.identical.attributes", "by.variables"))
{
which <- match.arg(which, several.ok = FALSE)
if(which == "vars.not.shared")
{
vapply(object$vars.summary$values, is.null, logical(1))
} else if(which == "nonby.vars.shared")
{
vapply(object$vars.summary$values, function(elt) !is.null(elt) && !identical(elt, "by-variable"), logical(1))
} else if(which == "vars.not.compared")
{
vapply(object$vars.summary$values, identical, logical(1), y = "Not compared")
Expand Down
7 changes: 6 additions & 1 deletion R/modelsum.R
Expand Up @@ -252,7 +252,12 @@ modelsum <- function(formula, family="gaussian", data, adjust=NULL, na.action =
coeffORTidy <- broom::tidy(fit, exponentiate=TRUE, conf.int=TRUE, conf.level=control$conf.level)
coeffORTidy[coeffORTidy$term == "Intercept", -1] <- NA
coeffTidy <- broom::tidy(fit, exponentiate=FALSE, conf.int=TRUE, conf.level=control$conf.level)
coeffTidy <- cbind(coeffTidy, OR=coeffORTidy$estimate, CI.lower.OR=coeffORTidy$conf.low, CI.upper.OR=coeffORTidy$conf.high)

waldTidy <- broom::confint_tidy(fit, conf.level=control$conf.level, func = stats::confint.default)

coeffTidy <- cbind(coeffTidy, OR=coeffORTidy$estimate, CI.lower.OR=coeffORTidy$conf.low, CI.upper.OR=coeffORTidy$conf.high,
CI.lower.wald=waldTidy$conf.low, CI.upper.wald=waldTidy$conf.high,
CI.lower.OR.wald=exp(waldTidy$conf.low), CI.upper.OR.wald=exp(waldTidy$conf.high))
modelGlance <- c(broom::glance(fit), concordance = pROC::auc(rocOut))

} else if (family == "quasipoisson" || family == "poisson") {
Expand Down
12 changes: 10 additions & 2 deletions R/modelsum.control.R
Expand Up @@ -93,7 +93,9 @@ modelsum.control <- function(
##Other model fits: logLik,AIC,BIC
binomial.stats.valid <- c(
"Nmiss", "OR", "CI.lower.OR", "CI.upper.OR", "p.value", "concordance", # default
"estimate", "CI.OR", "CI.estimate", "CI.lower.estimate", "CI.upper.estimate", "N", "Nmiss2", "endpoint", "std.error", "statistic",
"estimate", "CI.OR", "CI.estimate", "CI.lower.estimate", "CI.upper.estimate",
"CI.wald", "CI.lower.wald", "CI.upper.wald", "CI.OR.wald", "CI.lower.OR.wald", "CI.upper.OR.wald",
"N", "Nmiss2", "endpoint", "std.error", "statistic",
"logLik", "AIC", "BIC", "null.deviance", "deviance", "df.residual", "df.null"
)

Expand All @@ -108,6 +110,12 @@ modelsum.control <- function(
if(any(binomial.stats == "CI.estimate")) {
binomial.stats <- unique(c(binomial.stats[binomial.stats != "CI.estimate"], "CI.lower.estimate", "CI.upper.estimate"))
}
if(any(binomial.stats == "CI.wald")) {
binomial.stats <- unique(c(binomial.stats[binomial.stats != "CI.wald"], "CI.lower.wald", "CI.upper.wald"))
}
if(any(binomial.stats == "CI.OR.wald")) {
binomial.stats <- unique(c(binomial.stats[binomial.stats != "CI.OR.wald"], "CI.lower.OR.wald", "CI.upper.OR.wald"))
}

##########################
## Gaussian stats:
Expand Down Expand Up @@ -155,7 +163,7 @@ modelsum.control <- function(
}

##########################
## Poisson stats:
## Negbin stats:
##########################

negbin.stats.valid <- c(
Expand Down
3 changes: 2 additions & 1 deletion R/paired.R
Expand Up @@ -182,7 +182,8 @@ paired <- function(formula, data, id, na.action, subset=NULL, strata, control =
xTerms <- Map(modeldf, names(modeldf), f = function(col, nm) {
if(is.null(nameEff <- attr(col, "name"))) nameEff <- nm
if(is.null(labelEff <- attr(col, "label"))) labelEff <- nameEff
list(variable=nameEff, label=labelEff, term=nm)
if(is.null(termEff <- attr(col, "term"))) termEff <- nm
list(variable=nameEff, label=labelEff, term=termEff, term.orig = nm)
})
names(xTerms) <- vapply(xTerms, "[[", NA_character_, "variable")

Expand Down
8 changes: 5 additions & 3 deletions R/summary.comparedf.R
Expand Up @@ -25,7 +25,7 @@ summary.comparedf <- function(object, ..., show.attrs = FALSE)

#### start with summaries of the data.frames ####

frame.summary <- object$frame.summary[c("version", "arg", "ncol", "nrow")]
frame.summary <- as.data.frame(object$frame.summary[c("version", "arg", "ncol", "nrow")])

#### after we've done all that, summaries of the overall comparison ####
diffs.byvar <- diffs(object, by.var = TRUE)
Expand All @@ -34,15 +34,17 @@ summary.comparedf <- function(object, ..., show.attrs = FALSE)
nobs.uneq <- length(unique(diffs.tab$row.x))
comparison.summary <- data.frame(
statistic = c(
"Number of by-variables", "Number of variables in common", "Number of variables compared",
"Number of by-variables",
"Number of non-by variables in common", "Number of variables compared",
"Number of variables in x but not y", "Number of variables in y but not x",
"Number of variables compared with some values unequal", "Number of variables compared with all values equal",
"Number of observations in common", "Number of observations in x but not y", "Number of observations in y but not x",
"Number of observations with some compared variables unequal", "Number of observations with all compared variables equal",
"Number of values unequal"
),
value = c(
sum(idx_var_sum(object, "by.variables")), sum(!idx_var_sum(object, "vars.not.shared")), sum(idx_var_sum(object, "vars.compared")),
(!attr(object$frame.summary$by, "byrow"))*sum(idx_var_sum(object, "by.variables")),
sum(idx_var_sum(object, "nonby.vars.shared")), sum(idx_var_sum(object, "vars.compared")),
sum(is.na(object$vars.summary$var.y)), sum(is.na(object$vars.summary$var.x)),
sum(diffs.byvar$n > 0), sum(diffs.byvar$n == 0),
nobs.shared, nrow(object$frame.summary$unique[[1]]), nrow(object$frame.summary$unique[[2]]),
Expand Down

0 comments on commit a71126b

Please sign in to comment.