tbl_sig: Create a data frame for geom_sigmark charting

Description Usage Arguments Details Examples

View source: R/tbl_sig.R

Description

Create a data frame for charting from the freq_t_test and freq_prop_test outputs

Usage

1
2
tbl_sig(tbl_df, subgroup, space_label = NULL, space_between = NULL,
  compare = "all")

Arguments

tbl_df

A df object created from either the freq_t_test or the freq_prop_test functions.

subgroup

A factor variable name that subgroups cases, in quotes.

space_label

A numeric value indicating how much to offset the icons from a geom_text label. This doesn't need a value if 'compare' is set to "w2w" or "curr". It is recommended to be 0.3 for proportions, but trial and error may be necessary. It definitely is for means.

space_between

A numeric value indicating how much to offset the icons from each other. A value is needed if 'compare' is set to "total", but can otherwise be ignored. It is recommended to be 0.1 for proportions, but trial and error may be necessary. It definitely is for means.

compare

A string value indicating how the result of significant differences will be displayed. This is expanded in the Details section.

Details

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
### With proportions:
gss_data1 <- dplyr::filter(gss_data, year == "2016",
                                      conlegis %in% c("A GREAT DEAL", "ONLY SOME", "HARDLY ANY"))

my_results <- freq_prop_test(gss_data1, "conlegis", "region", weight = "wtssall")
tbl_sig(my_results, "region", space_label = 0.1, space_between = 0.2)

### With means:
gss_data1 <- dplyr::filter(gss_data, year == "2016", coninc > 0)

my_results <- freq_t_test(gss_data1, "coninc", "region", weight = "wtssnr")
tbl_sig(my_results, "region", space_label = 1, space_between = 4)

philstraforelli/ggsigmark documentation built on May 20, 2019, 1:59 p.m.