barline: Draws a bar-line plot

Description Usage Arguments Value Author(s) References Examples

View source: R/barline.R

Description

Draws a bar-line plot

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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

1
2
3
4
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")

BasketballAnalyzeR documentation built on July 2, 2020, 2:14 a.m.