Learn R Programming

metaplot (version 0.2.7)

scatter_data_frame: Scatterplot Function for Data Frame

Description

Scatterplot function for class 'data.frame'. Uses standard evaluation.

Usage

scatter_data_frame(x, yvar, xvar, groups = NULL, facets = NULL,
  ylog = log, xlog = log, yref = NULL, xref = NULL, ylab = NULL,
  xlab = NULL, ysmooth = FALSE, xsmooth = FALSE, cols = NULL,
  density = FALSE, iso = FALSE, main = FALSE, corr = FALSE,
  crit = 1.3, na.rm = TRUE, fit = conf, conf = FALSE, loc = 0,
  aspect = 1, auto.key = NULL, as.table = TRUE, log = FALSE,
  msg = "metastats", panel = metapanel, ...)

Arguments

x

data.frame

yvar

character: y variable(s)

xvar

character: x variable

groups

optional grouping item; ignored if more than one yvar

facets

character: up to two grouping items

ylog

log transform y axis (guessed if NULL)

xlog

log transform x axis (guessed if NULL)

yref

reference line from y axis

xref

reference line from x axis

ylab

y axis label, constructed from attributes label and guide if available

xlab

x axis label, constructed from attributes label and guide if available

ysmooth

supply loess smooth of y on x

xsmooth

supply loess smmoth of x on y

cols

suggested columns for auto.key

density

plot point density instead of points (ignored if groups is supplied)

iso

use isometric axes with line of unity

main

logical: whether to construct a default title; or a substitute title or NULL

corr

append Pearson correlation coefficient to default title (only if main is TRUE)

crit

if ylog or xlog missing, log transform if mean/median ratio for non-missing values is greater than crit

na.rm

whether to remove data points with one or more missing coordinates

fit

draw a linear fit of y ~ x

conf

logical, or width for a confidence region around a linear fit; passed to region; TRUE defaults to 95 percent confidence interval

loc

where to print statistics on a panel

aspect

tpassed to xyplot

auto.key

passed to xyplot

as.table

passed to xyplot

log

a default sharede by ylog and xlog

msg

a function to print text on a panel: called with x values, y values, and ….

panel

name or definition of panel function

...

passed to region

See Also

metapanel

Other bivariate plots: boxplot.folded, metaplot.data.frame, metaplot.folded, scatter.data.frame, scatter.folded

Other scatter: scatter.data.frame, scatter.folded

Examples

Run this code
# NOT RUN {
library(magrittr)
library(dplyr)
attr(Theoph$conc,'label') <- 'theophylline concentration'
attr(Theoph$conc,'guide') <- 'mg/L'
attr(Theoph$Time,'label') <- 'time'
attr(Theoph$Time,'guide') <- 'h'
attr(Theoph$Subject,'guide') <- '////'
scatter_data_frame(Theoph, 'conc', 'Time')
scatter_data_frame(Theoph, 'conc','Time', 'Subject')
scatter_data_frame(Theoph, 'conc','Time', facets = 'Subject')
scatter_data_frame(Theoph %>% filter(conc > 0), 'conc','Time', 'Subject',ylog = TRUE, yref = 5)
scatter_data_frame(Theoph, 'conc','Time', 'Subject',ysmooth = TRUE)
scatter_data_frame(Theoph, 'conc','Time', main = TRUE, corr = TRUE)
scatter_data_frame(Theoph, 'conc','Time', conf = TRUE, loc = 3, yref = 6)
# }

Run the code above in your browser using DataLab