Plot Cohen's d as sample size increases.
cohen_d_over_n(
data = NULL,
iv_name = NULL,
dv_name = NULL,
save_as_png = FALSE,
png_name = NULL,
xlab = NULL,
ylab = NULL,
width = 16,
height = 9
)
the output will be a list of (1) ggplot object (histogram by group) and (2) a data.table with Cohen's d by sample size
a data object (a data frame or a data.table)
name of the independent variable (grouping variable)
name of the dependent variable (measure variable of interest)
if save = TRUE
, the plot will be saved
as a PNG file.
name of the PNG file to be saved. By default, the name will be "cohen_d_over_n_" followed by a timestamp of the current time. The timestamp will be in the format, jan_01_2021_1300_10_000001, where "jan_01_2021" would indicate January 01, 2021; 1300 would indicate 13:00 (i.e., 1 PM); and 10_000001 would indicate 10.000001 seconds after the hour.
title of the x-axis for the histogram by group.
If xlab = FALSE
, the title will be removed. By default
(i.e., if no input is given), dv_name
will be used as
the title.
title of the y-axis for the histogram by group.
If ylab = FALSE
, the title will be removed. By default
(i.e., if no input is given), iv_name
will be used as
the title.
width of the plot to be saved. This argument will be
directly entered as the width
argument for the ggsave
function within ggplot2
package (default = 16)
height of the plot to be saved. This argument will be
directly entered as the height
argument for the ggsave
function within ggplot2
package (default = 9)
if (FALSE) {
cohen_d_over_n(data = mtcars, iv_name = "am", dv_name = "mpg")
}
Run the code above in your browser using DataLab