Description Usage Arguments Details Note Examples
View source: R/geom_sigmark_waves.R
Apply significance markers onto an existing ggplot2 chart
1 2 3 4 |
tbl_sig |
A df object created from tbl_sig functions. |
x |
A quoted character string of the variable from the 'tbl_sig' df charted on the x-axis. Typically this is "wave_pos". |
y |
A quoted character string of the variable from the 'tbl_sig' df charted on the y-axis. Typically this is "result_pos". |
group |
An optional quoted character string of the variable from the 'tbl_sig' df that is grouped. If needed, it likely needs to be "group". |
direction |
A quoted character string of the variable from the 'tbl_sig' df indicating whether the change from one wave to the next is up or down. Typically this is "direction". |
labels |
A quoted character string vector indicating how the sig. test markers should be labeled in the legend. By default, the labels are "Increase" and "Decrease". |
colour |
A quoted character string of the variable from the 'tbl_sig' df that applies the subgroup colours. Typically this is "level". |
fill |
A quoted character string of the variable from the 'tbl_sig' df that applies the subgroup colours. Typically this is "level". |
icon |
A quoted character string indicating the type of icon to display to denote statistical significance. Default is "full triangle". |
size |
A numeric value indicating the size of the icon. Default is set to 5. |
This is essentially a wrapper for geom_point
The icon argument accepts one of the following strings:
full triangle
clear triangle
arrow
finger
1 2 3 4 5 6 7 8 9 10 11 | ## Proportions
gss_data1 <- dplyr::filter(gss_data, year_num >= 2000, !is.na(confinan))
gss_data1$year <- droplevels(gss_data1$year)
my_results <- freq_prop_test(gss_data1, "confinan", "year", weight = "wtssall")
sig <- tbl_sig(my_results, "year", space_label = 0.1, space_between = 0.2, compare = "w2w")
chart <- tbl_chart(gss_data1, "confinan", "year", weight = "wtssall")
library(ggplot2)
ggplot() +
geom_line(data = chart, aes(x = year, y = prop, colour = confinan, group = confinan)) +
geom_sigmark_waves(sig)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.