barline {BasketballAnalyzeR}R Documentation

Draws a bar-line plot

Description

Draws a bar-line plot

Usage

barline(
  data,
  id,
  bars,
  line,
  order.by = id,
  decreasing = TRUE,
  labels.bars = NULL,
  label.line = NULL,
  title = NULL
)

Arguments

data

a data frame.

id

character, name of the ID variable.

bars

character vector, names of the bar variables.

line

character, name of the line variable.

order.by

character, name of the variable used to order bars (on the x-axis).

decreasing

logical; if TRUE, decreasing order.

labels.bars

character vector, labels for the bar variables.

label.line

character, label for the line variable on the second y-axis (on the right).

title

character, plot title.

Value

A ggplot2 object

Author(s)

Marco Sandri, Paola Zuccolotto, Marica Manisera (basketballanalyzer.help@unibs.it)

References

P. Zuccolotto and M. Manisera (2020) Basketball Data Science: With Applications in R. CRC Press.

Examples

dts <- subset(Pbox, Team=="Houston Rockets" & MIN>=500)
barline(data=dts, id="Player", bars=c("P2p","P3p","FTp"),
        line="MIN", order.by="Player",
        labels.bars=c("2P","3P","FT"), title="Houston Rockets")

[Package BasketballAnalyzeR version 0.5.0 Index]