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", ... )
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) |
all_name | a name to use for the complete data summary |
dv_col | character name of |
bq_col | character name of |
id_col | character name of |
... | other arguments passed to |
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()
.