The get_tt_param() function can help you to obtain a single parameter value from a summary table generated by the tt_*() functions tt_summary_stats(), tt_string_info(), tt_tbl_dims(), or tt_tbl_colnames(). The following parameters are to be used depending on the input tbl:
from tt_string_info(): "length_mean", "length_min", "length_max"
from tt_tbl_dims(): "rows", "columns"
from tt_tbl_colnames(): any integer present in the .param. column
The tt_summary_stats() and tt_string_info() functions will generate summary tables with columns that mirror the numeric and character columns in their input tables, respectively. For that reason, a column name must be supplied to the column argument in get_tt_param().
get_tt_param(tbl, param, column =NULL)
Arguments
tbl: Summary table generated by specific transformer functions
obj:<tbl_*> // required
A summary table generated by either of the tt_summary_stats(), tt_string_info(), tt_tbl_dims(), or tt_tbl_colnames() functions.
param: Parameter name
scalar<character> // required
The parameter name associated to the value that is to be gotten. These parameter names are always available in the first column (.param.) of a summary table obtained by tt_summary_stats(), tt_string_info(), tt_tbl_dims(), or tt_tbl_colnames().
column: The target column
scalar<character> // required (in select cases)
The column in the summary table for which the data value should be obtained. This must be supplied for summary tables generated by tt_summary_stats() and tt_string_info() (the tt_tbl_dims() and tt_tbl_colnames() functions will always generate a two-column summary table).
Returns
A scalar value.
Examples
Get summary statistics for the first quarter of the game_revenue dataset that's included in the pointblank package.
Sometimes you need a single value from the table generated by the tt_summary_stats() function. For that, we can use the get_tt_param()
function. So if we wanted to test whether the maximum session duration during the rest of the time period (the remaining 0.75) is never higher than that of the first quarter of the year, we can supply a value from stats_tbl to test_col_vals_lte():