Learn R Programming

metaplot (version 0.2.7)

scatter.data.frame: Scatterplot Method for Data Frame

Description

Scatterplot method for class 'data.frame'. Uses nonstandard evaluation. By default, passes arguments to scatter_data_frame.

Usage

# S3 method for data.frame
scatter(x, ..., ylog = log, xlog = log, yref = NULL,
  xref = NULL, ylab = NULL, xlab = NULL, ysmooth = FALSE,
  xsmooth = FALSE, density = FALSE, iso = FALSE, main = FALSE,
  corr = FALSE, na.rm = TRUE, conf = FALSE, fit = conf, loc = 0,
  aspect = 1, cols = NULL, crit = 1.3, auto.key = NULL,
  as.table = TRUE, log = FALSE, msg = "metastats", panel = metapanel,
  fun = getOption("metaplot_scatter", "scatter_data_frame"))

Arguments

x

data.frame

...

unquoted names for variables: y, x, groups (may be missing) and conditioning variables (facets)

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

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)

na.rm

whether to remove data points with one or more missing coordinates

conf

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

fit

draw a linear fit of y ~ x

loc

where to print statistics on a panel

aspect

passed to xyplot

cols

suggested columns for auto.key

crit

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

auto.key

passed to xyplot

as.table

passed to xyplot

log

a default shared 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

fun

function to draw the plot

See Also

scatter_data_frame

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

Other scatter: scatter.folded, scatter_data_frame

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(Theoph,conc, Time)
scatter(Theoph, conc, Time, Subject) # Subject as groups
scatter(Theoph, conc, Time, , Subject) # Subject as facet
scatter(Theoph %>% filter(conc > 0), conc, Time, Subject, ylog = TRUE, yref = 5)
scatter(Theoph, conc, Time, Subject,ysmooth = TRUE)
scatter(Theoph, conc, Time, main = TRUE, corr = TRUE)
scatter(Theoph, conc, Time, conf = TRUE, loc = 3, yref = 6)
# }

Run the code above in your browser using DataLab