pt_data_inventory.Rd
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,
all_name = "all",
dv_col = "DV",
bq_col = find_bq_col(data),
id_col = "ID",
...
)
the data frame to summarize; the user should filter or subset
so that data
contains exactly the records to be summarized; pmtables will
not add or remove rows prior to summarizing data
The outer grouping variable; may be character or quosure.
The panel grouping variable; may be character or quosure.
If TRUE
, then a summary of the inner variable will
be provided.
If TRUE
, then MISS
will be dropped, but only when all
MISS
values are equal to zero.
If TRUE
, then independent summaries are created by outer
and included in a single table (see examples).
a named list to use for renaming columns (see details and examples)
a name to use for the complete data summary
Character name of DV
column.
Character name of BQL
column; see find_bq_col()
.
Character name of ID
column.
Other arguments passed to data_inventory_chunk()
.
An object with class pmtable
; see class-pmtable.
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()
.