Print Abbreviated Ouput
brief.RdPrint data objects and statistical model summaries in abbreviated form.
Usage
brief(object, ...)
# S3 method for class 'data.frame'
brief(object, rows = if (nr <= 10) c(nr, 0) else c(3, 2),
cols, head=FALSE, tail=FALSE, elided = TRUE,
classes = inherits(object, "data.frame"), ...)
# S3 method for class 'tbl'
brief(object, ...)
# S3 method for class 'matrix'
brief(object, rows = if (nr <= 10) c(nr, 0) else c(3, 2), ...)
# S3 method for class 'numeric'
brief(object, rows = c(2, 1), elided = TRUE, ...)
# S3 method for class 'integer'
brief(object, rows = c(2, 1), elided = TRUE, ...)
# S3 method for class 'character'
brief(object, rows = c(2, 1), elided = TRUE, ...)
# S3 method for class 'factor'
brief(object, rows=c(2, 1), elided=TRUE, ...)
# S3 method for class 'list'
brief(object, rows = c(2, 1), elided = TRUE, ...)
# S3 method for class 'function'
brief(object, rows = c(5, 3), elided = TRUE, ...)
# S3 method for class 'lm'
brief(object, terms = ~ .,
intercept=missing(terms), pvalues=FALSE,
digits=3, horizontal=TRUE, vcov., ...)
# S3 method for class 'glm'
brief(object, terms = ~ .,
intercept=missing(terms), pvalues=FALSE,
digits=3, horizontal=TRUE, vcov., dispersion, exponentiate, ...)
# S3 method for class 'multinom'
brief(object, terms = ~ .,
intercept=missing(terms), pvalues=FALSE,
digits=3, horizontal=TRUE, exponentiate=TRUE, ...)
# S3 method for class 'polr'
brief(object, terms = ~ .,
intercept, pvalues=FALSE,
digits=3, horizontal=TRUE, exponentiate=TRUE, ...)
# Default S3 method
brief(object, terms = ~ .,
intercept=missing(terms), pvalues=FALSE,
digits=3, horizontal=TRUE, ...)Arguments
- object
a data or model object to abbreviate.
- rows
for a matrix or data frame, a 2-element integer vector with the number of rows to print at the beginning and end of the display; for a vector or factor, the number of lines of output to show at the beginning and end; for a list, the number of elements to show at the beginning and end; for a function, the number of lines to show at the beginning and end.
- cols
for a matrix or data frame, a 2-element integer vector with the number of columns to print at the beginning (i.e., left) and end (right) of the display.
- head, tail
alternatives to the
rowsargument; ifTRUE, print the first or last 6 rows; can also be the number of the first or last few rows to print; only one ofheadsandtailsshould be specified; ignored ifFALSE(the default).- elided
controls whether to report the number of elided elements, rows, or columns; default is
TRUE.- classes
show the class of each column of a data frame at the top of the column; the classes are shown in single-character abbreviated form—e.g.,
[f]for a factor,[i]for an integer variable,[n]for a numeric variable,[c]for a character variable.- terms
a one-sided formula giving the terms to summarize; the default is
~ .—i.e., to summarize all terms in the model.- intercept
whether or not to include the intercept; the default is
TRUEunless thetermsargument is given, in which case the default isFALSE; ignored forpolrmodels.- pvalues
include the p-value for each coefficient in the table; default is
FALSE.- exponentiate
for a
"glm"or"glmerMod"model using thelogorlogitlink, or a"polr"or"multinom"model, show exponentiated coefficient estimates and confidence bounds.- digits
significant digits for printing.
- horizontal
if
TRUE(the default), orient the summary produced bybriefhorizontally, which typically saves space.- dispersion
use an estimated covariance matrix computed as the dispersion times the unscaled covariance matrix; see
summary.glm- vcov.
either a matrix giving the estimated covariance matrix of the estimates, or a function that when called with
objectas an argument returns an estimated covariance matrix of the estimates. If not set,vcov(object, complete=FALSE)is called to use the usual estimated covariance matrix with aliased regressors removed. Other choices include the functions documented athccm, and a bootstrap estimatevcov.=vcov(Boot(object)); see the documentation forBoot. NOTES: (1) Thedispersionandvcov.arguments may not both be specified. (2) Settingvcov.=vcovreturns an error if the model includes aliased terms; usevcov.=vcov(object, complete=FALSE). (3) Thehccmmethod will generally return a matrix of full rank even if the model has aliased terms. Similarlyvcov.=vcov(Boot(object))may return a full rank matrix.- ...
arguments to pass down.
References
Fox, J. and Weisberg, S. (2019) An R Companion to Applied Regression, Third Edition, Sage.
Author
John Fox jfox@mcmaster.ca
Examples
brief(rnorm(100))
#> 100 element numeric vector
#> [1] -0.79249402 -1.15853913 0.71089000 1.26760175 -0.14315106 -0.51502891
#> [7] 1.48289118 -0.16258891 0.04170917 0.48303990 -1.18012717 -0.66357374
#>
#> . . . (14 lines omitted)
#>
#> [97] 1.05773737 -0.36032080 0.35059377 0.02825766
brief(Duncan)
#> 45 x 4 data.frame (40 rows omitted)
#> type income education prestige
#> [f] [i] [i] [i]
#> accountant prof 62 86 82
#> pilot prof 72 76 83
#> architect prof 75 92 90
#> . . .
#> policeman bc 34 47 41
#> waiter bc 8 32 10
brief(OBrienKaiser, elided=TRUE)
#> 16 x 17 data.frame (11 rows and 7 columns omitted)
#> treatment gender pre.1 pre.2 pre.3 pre.4 pre.5 post.1 . . . fup.4 fup.5
#> [f] [f] [n] [n] [n] [n] [n] [n] [n] [n]
#> 1 control M 1 2 4 2 1 3 4 4
#> 2 control M 4 4 5 3 4 2 4 1
#> 3 control M 5 6 5 7 7 4 7 6
#> . . .
#> 15 B F 2 2 3 4 4 6 6 7
#> 16 B F 4 5 7 5 4 7 8 7
brief(matrix(1:500, 10, 50))
#> 10 x 50 matrix (38 columns omitted)
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] . . . [,49] [,50]
#> [1,] 1 11 21 31 41 51 61 71 81 91 481 491
#> [2,] 2 12 22 32 42 52 62 72 82 92 482 492
#> [3,] 3 13 23 33 43 53 63 73 83 93 483 493
#> [4,] 4 14 24 34 44 54 64 74 84 94 484 494
#> [5,] 5 15 25 35 45 55 65 75 85 95 485 495
#> [6,] 6 16 26 36 46 56 66 76 86 96 486 496
#> [7,] 7 17 27 37 47 57 67 77 87 97 487 497
#> [8,] 8 18 28 38 48 58 68 78 88 98 488 498
#> [9,] 9 19 29 39 49 59 69 79 89 99 489 499
#> [10,] 10 20 30 40 50 60 70 80 90 100 490 500
brief(lm)
#> lm <- function (formula, data, subset, weights, na.action, method = "qr",
#> model = TRUE, x = FALSE, y = FALSE, qr = TRUE, singular.ok = TRUE,
#> contrasts = NULL, offset, ...)
#> {
#> ret.x <- x
#>
#> . . . (64 lines omitted)
#>
#> z$qr <- NULL
#> z
#> }
mod.prestige <- lm(prestige ~ education + income + type, Prestige)
brief(mod.prestige, pvalues=TRUE)
#> (Intercept) education income typeprof typewc
#> Estimate -0.623 3.67e+00 0.001013 6.039 -2.737
#> Std. Error 5.228 6.41e-01 0.000221 3.867 2.514
#> Pr(>|t|) 0.905 1.21e-07 0.000014 0.122 0.279
#>
#> Residual SD = 7.09 on 93 df, R-squared = 0.835
brief(mod.prestige, ~ type)
#> typeprof typewc
#> Estimate 6.04 -2.74
#> Std. Error 3.87 2.51
mod.mroz <- glm(lfp ~ ., data=Mroz, family=binomial)
brief(mod.mroz)
#> (Intercept) k5 k618 age wcyes hcyes lwg inc
#> Estimate 3.182 -1.463 -0.0646 -0.0629 0.807 0.112 0.605 -0.03445
#> Std. Error 0.644 0.197 0.0680 0.0128 0.230 0.206 0.151 0.00821
#> exp(Estimate) 24.098 0.232 0.9375 0.9391 2.242 1.118 1.831 0.96614
#>
#> Residual deviance = 905 on 745 df