Learn R Programming

metaplotr (version 0.0.3)

crosshairs: Creates a Cross-hairs Plot.

Description

When given effect sizes and standard errors, creates cross-hairs plots.

Usage

crosshairs(x, y, xse, yse, x_lab = NULL, y_lab = NULL, main_lab = NULL, confint = 0.95, mdrtr = NULL, mdrtr_lab = NULL, mdrtr_lab_pos = c(0.2, 0.9), lab_size = 14, pnt_size = 3, whis_on = TRUE, annotate = FALSE, grid_dense = FALSE, bxplts = TRUE)

Arguments

x
Numeric vector of effect sizes that will be used in x axis.
y
Numeric vector of effect sizes that will be used in y axis.
xse
Numeric vector standard errors of effect sizes that is used in x axis.
yse
Numeric vector standard errors of the effect sizes that is used in y axis
x_lab
Title of the x-axis.
y_lab
Title of the y-axis.
main_lab
Main label of the cross-hairs plot.
confint
Confidence interval that is used to determine length of the whiskers.
mdrtr
Whether there is a moderator variable?
mdrtr_lab
Label of the moderator variable.
mdrtr_lab_pos
Determine the positon of the moderator labels. Values between 0.1 and 0.9 are allowed.
lab_size
Size of the axis titles.
pnt_size
Determines the size of point in the plot.
whis_on
Whiskers on or off?
annotate
If true, mean effect size and correlation between effect sizes will be printed within the graph.
grid_dense
When changed to FALSE, a default denser gridlines will be used.
bxplts
Swithes boxplots on or off.

Details

crosshairs's basic output is a bitmat file that contains cross-hairs plot of given dependent effect sizes.

Examples

Run this code
## Not run: 
# # Load and attach metaplotr package to the Global Environment
# library(metaplotr)
# 
# # Remove all variables in the .GlobalEnv, effectively clearing .GlobalEvn
# rm(list = ls())
# 
# # Find out more about the data set from Ferguson and Brannick (2012)
# # help("FergusonBrannick2012")
# 
# # You can check out help file of the \code{crosshairs} function.
# # help(crosshairs)
# ## End(Not run)

# Basic usage of the \code{crosshairs} function.
crosshairs(FergusonBrannick2012$pub_z, FergusonBrannick2012$dis_z,
FergusonBrannick2012$pub_z_se, FergusonBrannick2012$dis_z_se)

## Not run: 
# # whis_on option opens and closes whiskers.
# crosshairs(FergusonBrannick2012$pub_z, FergusonBrannick2012$dis_z,
# FergusonBrannick2012$pub_z_se, FergusonBrannick2012$dis_z_se,
# whis_on = FALSE)
# ## End(Not run)

# confint option can control whiskers length.
crosshairs(FergusonBrannick2012$pub_z, FergusonBrannick2012$dis_z,
FergusonBrannick2012$pub_z_se, FergusonBrannick2012$dis_z_se, confint = .7)

crosshairs(FergusonBrannick2012$pub_z, FergusonBrannick2012$dis_z,
FergusonBrannick2012$pub_z_se, FergusonBrannick2012$dis_z_se, confint = .2)
crosshairs(FergusonBrannick2012$pub_z, FergusonBrannick2012$dis_z,
FergusonBrannick2012$pub_z_se, FergusonBrannick2012$dis_z_se, confint = .95)

# Main and axes labels can be changed.
crosshairs(FergusonBrannick2012$pub_z, FergusonBrannick2012$dis_z,
FergusonBrannick2012$pub_z_se, FergusonBrannick2012$dis_z_se,
main_lab = 'Different Main Label', x_lab = 'Different X Label',
y_lab = 'Different Y Label')

# Annotated correlation and meand values can be added to the graph.
crosshairs(FergusonBrannick2012$pub_z, FergusonBrannick2012$dis_z,
FergusonBrannick2012$pub_z_se, FergusonBrannick2012$dis_z_se, annotate = TRUE,
main_lab = 'Annotated Graph')

# Boxplots can be hidden.
crosshairs(FergusonBrannick2012$pub_z, FergusonBrannick2012$dis_z,
FergusonBrannick2012$pub_z_se, FergusonBrannick2012$dis_z_se,
main_lab = 'No Boxplots', bxplts = FALSE)

## Not run: 
# # Moderator legend and annotations can be used simulaneously.
# crosshairs(FergusonBrannick2012$pub_z, FergusonBrannick2012$dis_z,
# FergusonBrannick2012$pub_z_se, FergusonBrannick2012$dis_z_se,
# mdrtr = FergusonBrannick2012$mod, annotate = TRUE,
# main_lab = 'Moderator Legend and Annotation')
# 
# # Moderator legend position can be adjusted.
# crosshairs(FergusonBrannick2012$pub_z, FergusonBrannick2012$dis_z,
# FergusonBrannick2012$pub_z_se, FergusonBrannick2012$dis_z_se,
# mdrtr = FergusonBrannick2012$mod, mdrtr_lab_pos = c(0.8, 0.8),
# main_lab = 'Moderator Legend Position Change')
# 
# # Dot size can be changed.
# crosshairs(FergusonBrannick2012$pub_z, FergusonBrannick2012$dis_z,
# FergusonBrannick2012$pub_z_se, FergusonBrannick2012$dis_z_se,
# mdrtr = FergusonBrannick2012$mod, pnt_size = 6,
# main_lab = 'Bigger Dots')
# 
# # Size of labels can be changed.
# crosshairs(FergusonBrannick2012$pub_z, FergusonBrannick2012$dis_z,
# FergusonBrannick2012$pub_z_se, FergusonBrannick2012$dis_z_se,
# mdrtr = FergusonBrannick2012$mod, lab_size = 20,
# main_lab = 'Label Size Change')
# ## End(Not run)

Run the code above in your browser using DataLab