heatmapplot: heatmap

View source: R/heatmapplot.R

heatmapplotR Documentation

heatmap

Description

heatmap

Usage

heatmapplot(
  formula,
  data,
  xbreaks = NULL,
  ybreaks = NULL,
  addvals = FALSE,
  addN = FALSE,
  digits = 1,
  ...
)

Arguments

formula

formula for plot

data

data set for plot (typically a data frame)

xbreaks

numeric, the breakpoints for the horizontal axis

ybreaks

numeric, the breakpoints for the vertical axis

addvals

add the response values to the plot

addN

add the sample size to the plot

digits

numeric: if response variable is plotted, round to this many digits (default is 1)

...

other parameters passed on to plot() or text()

Value

a plot

Examples

xdata <- expand.grid(a = seq(0, 1, 0.1), b = seq(10, 20, 1))
xdata$resp <- rnorm(nrow(xdata))
heatmapplot(resp ~ a + b, data = xdata)

set.seed(123)
xdata <- expand.grid(k = seq(8, 200, length.out = 31), shape = seq(0, 1, length.out = 31))
idata <- randomsequence(10, 50, reversals = 0.3)
allids <- colnames(idata$pres)[2:ncol(idata$pres)]
winner <- as.character(idata$seqdat$winner)
loser <- as.character(idata$seqdat$loser)

myranks <- 1:length(allids)
names(myranks) <- allids

for(i in 1:nrow(xdata)) {
  kv <- rep(xdata$k[i], length(winner))
  sv <- createstartvalues(ranks = myranks, shape = xdata$shape[i])$res
  res <- fastelo(WINNER = winner, LOSER = loser, ALLIDS = allids, KVALS = kv, STARTVALUES = sv,
                 ROUND = FALSE)
  xdata$ll[i] <- likelo(res)
}

heatmapplot(ll ~ k + shape, data = xdata)

gobbios/EloRating documentation built on July 19, 2024, 4:05 a.m.