/
ff_column_totals.Rd
69 lines (60 loc) · 1.59 KB
/
ff_column_totals.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ff_column_totals.R
\name{ff_column_totals}
\alias{ff_column_totals}
\alias{finalfit_column_totals}
\title{Add column totals to \code{summary_factorlist()} output}
\usage{
ff_column_totals(
df.in,
.data,
dependent,
na_include_dependent = FALSE,
percent = TRUE,
digits = 1,
label = NULL,
prefix = ""
)
finalfit_column_totals(
df.in,
.data,
dependent,
na_include_dependent = FALSE,
percent = TRUE,
digits = 1,
label = NULL,
prefix = ""
)
}
\arguments{
\item{df.in}{\code{summary_factorlist()} output.}
\item{.data}{Data frame used to create \code{summary_factorlist()}.}
\item{dependent}{Character. Name of dependent variable.}
\item{na_include_dependent}{Logical. When TRUE, missing data in the dependent
variable is included in totals.}
\item{percent}{Logical. Include percentage.}
\item{digits}{Integer length 1. Number of digits for percentage.}
\item{label}{Character. Label for total row.}
\item{prefix}{Character. Prefix for column totals, e.g "N=".}
}
\value{
Data frame.
}
\description{
Add column totals to \code{summary_factorlist()} output
}
\examples{
explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor")
dependent = 'mort_5yr'
colon_s \%>\%
summary_factorlist(dependent, explanatory) \%>\%
ff_column_totals(colon_s, dependent)
# Ensure works with missing data in dependent
colon_s = colon_s \%>\%
dplyr::mutate(
mort_5yr = forcats::fct_explicit_na(mort_5yr)
)
colon_s \%>\%
summary_factorlist(dependent, explanatory) \%>\%
ff_column_totals(colon_s, dependent)
}