View source: R/data_inventory_table.R
pt_data_inventory | R Documentation |
This function summarizes your data in a specific way and returns an object
that can be converted into a latex
table.
pt_data_inventory(
data,
by = ".total",
panel = by,
inner_summary = TRUE,
drop_miss = FALSE,
stacked = FALSE,
table = NULL,
summarize_all = TRUE,
all_name = "All data",
all_name_stacked = "Group Total",
dv_col = "DV",
bq_col = find_bq_col(data),
id_col = "ID",
...
)
data |
the data frame to summarize; the user should filter or subset
so that |
by |
The outer grouping variable; may be character or quosure. |
panel |
The panel grouping variable; may be character or quosure. |
inner_summary |
If |
drop_miss |
If |
stacked |
If |
table |
a named list to use for renaming columns (see details and examples) |
summarize_all |
if |
all_name |
a name to use for the complete data summary |
all_name_stacked |
a name to use for the complete data summary when
|
dv_col |
Character name of |
bq_col |
Character name of |
id_col |
Character name of |
... |
Other arguments passed to |
Output columns include counts for subjects (SUBJ
), observations (OBS)
,
BQL observations, missing observations (MISS
) and percentage of
observations that are BQL. When panels are requested, then the percentages
for OBS
and BQL
are presented for the Overall
data and for the panel
Group
.
Specifically, please note that:
MISS
is the number of data records where DV
is missing (NA
) and where
the BQL
(or BLQ
) column is 0
OBS
is the number of data records where DV
is not missing (non-NA
)
and the BQL
(or BLQ
) column is 0
BQL
are records where the BQL
(or BLQ
) column is not equal to 0
The sum of MISS
+ OBS
+ BQL
should equal the number of rows in the
data frame passed to pt_data_inventory()
.
When calculating percent OBS
and percent BQL
, we use OBS + BQL
as the
denominator such that the percent BQL
and percent OBS
sum to 100
within a group or panel. When the panel
argument is set, these percentages
are calculated for the group (or panel
) as well as overall. In other
words, records that are MISS
are not factored into totals for OBS
or
BQL
and similarly are not factored into calculation of percent OBS
or
percent BQL
.
The summary function is expecting certain columns to be named in a certain
way. This can be modified to suit your need by passing the following
arguments: dv_col
(for observations), bq_col
(for BQL observations),
and id_col
(for ID). For example, if BQL indicator is in a column called
BELOW
you would pass bq_col = BELOW
.
See the data_inventory_chunk()
help topic for a description of these
columns.
The notes for this table are generated by pt_data_inventory_notes()
.
An object with class pmtable
; see class-pmtable.
ans <- pt_data_inventory(pmt_pk, by = c("Renal function" = "RFf"))
ans <- pt_data_inventory(
pmt_pk,
by = "STUDYf",
panel = "RFf"
)
ans <- pt_data_inventory(
pmt_obs,
by = "STUDYf",
panel = "SEQf",
stacked = TRUE
)
## Not run:
st2report(stable(ans))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.