Package 'footballpenaltiesBL'

Title: Penalties in the German Men's Football Bundesliga
Description: Basic analysis of all penalties taken in the German men's Bundesliga between the start of its inaugural season and May 2017. The main functions are suitable printing and plotting functions. Flexible selection of a player is supported via grep. Missed penalties can easily be included or excluded, depending on the user's wishes.
Authors: Leo N. Geppert [aut, cre], Peter Gnändinger [ctb], Katja Ickstadt [ctb], Björn Bornkamp [ctb], Arno Fritsch [ctb], Oliver Kuß [ctb]
Maintainer: Leo N. Geppert <[email protected]>
License: GPL-2 | GPL-3
Version: 1.0.0
Built: 2025-02-28 04:46:05 UTC
Source: https://github.com/cran/footballpenaltiesBL

Help Index


Penalties in the German Men's Football Bundesliga

Description

Basic analysis of all penalties taken in the German men's Bundesliga between the start of its inaugural season and May 2017. The main functions are suitable printing and plotting functions. Flexible selection of a player is supported via grep. Missed penalties can easily be included or excluded, depending on the user's wishes.

Author(s)

Leo N. Geppert [aut, cre], Peter Gnändinger [ctb], Katja Ickstadt [ctb], Björn Bornkamp [ctb], Arno Fritsch [ctb], Oliver Kuß [ctb]

Maintainer: Leo N. Geppert <[email protected]>

Examples

data(penalties)
penaltyPrint("Illgner", exact = FALSE, pendat = penalties)
penaltyPlot("Illgner", exact = FALSE, pendat = penalties)

Penalty Shots in the German Men's Bundesliga (Association Football)

Description

This data set contains information on all penalty shot's taken in the German Men's Bundesliga from its inaugural season 1963/64 until the end of season 2016/17.

Usage

data("penalties")

Format

A data frame with 4599 observations on the following 15 variables.

date

Date vector containing the date the penalty was taken.

season

Character vector containing the season the penalty was taken in.

matchday

Numeric vector that specifies the match day the penalty was taken on. Usually, seasons in the men\'s bundesliga consist of 34 match days, but there have been some seasons with a varying number, 30 and 38.

goalkeeper

Character vector containing the name of the goalkeeper the penalty was taken against.

penaltytaker

Character vector containing the name of the player who took the penalty.

homegame

Numeric vector that specifies where the match was played, 1 indicates an away match for the goalkeeper, 2 a home match. In many cases it is advisable to convert this variable to a factor.

result

Character vector that gives the result of the penalty in German. Possible values are

  • Tor: Goal

  • gehalten: Save (abbreviation for gehalten)

  • vorbei: Miss (abbreviation for vorbei)

  • drüber: Miss, too high (abbreviation for drüber)

  • Latte: Miss, hit the crossbar (abbreviation for Latte)

  • Pfosten: Miss, hit the post (abbreviation for Pfosten)

The difference between a save and a miss is that the goalkeeper actively stopped the ball for save, whereas the penalty taker missed the goal without the goalkeeper touching it in the latter case.

The distinction between different types of misses is included for historical reasons only. Current policy is to distinguish between goals, saves, and misses only. Analyses that rely on drüb, Latt or Pfos are likely misleading.

minute

Numeric vector specifying the minute of the match the penalty was taken in.

goaldiff

Numeric vector that gives the goal difference before the penalty was taken. A positive number indicates that the goalkeeper's club is in the lead.

gkclub

Character vector that specifies the goalkeeper's club

ptclub

Character vector that specifies the penalty taker's club

gkage

Numeric vector giving the goalkeeper's age in years at the time the penalty was given

ptage

Numeric vector giving the penalty taker's age in years at the time the penalty was given

gkexp

Numeric vector giving the goalkeeper's experience, measured in number of seasons. 0 stands for the debut season, from then on, 1 is added for every following season, regardless of whether the player played in the Bundesliga or not.

ptexp

Numeric vector giving the penalty taker's experience, measured in number of seasons. 0 stands for the debut season, from then on, 1 is added for every following season, regardless of whether the player played in the Bundesliga or not.

Source

Updated regularly

Examples

data(penalties)
str(penalties)

penaltyPrint('Illgner', exact = FALSE, pendat = penalties)
penaltyPlot('Illgner', exact = FALSE, pendat = penalties)

Plot an overview of all penalties taken by or against a men's Bundesliga player.

Description

Search for a player – either exact match or using fixed regular expressions – and create a plot of all penalties taken by or against this player as table with the date on the x-axis and the result on the y-axis.

Usage

penaltyPlot(player, goalkeeper = TRUE, exact = TRUE, pendat, includeMisses = TRUE,
  quarterlyAxis = TRUE, colours = NULL, main = NULL, sub = NULL, jitter = TRUE,
  yvalconst = FALSE)

Arguments

player

Character vector of length 1 which contains the full name of a player in pendat or a part thereof.

goalkeeper

Boolean, specifies whether player is searched for among goalkeepers (TRUE) or penalty takers (FALSE).

exact

Boolean, specifies whether to look for an exact match. If set to FALSE, grep(player, fixed = TRUE) is used to search for the player.

pendat

Name of a data set containing the penalties. The data set needs to follow the format of penalties.

includeMisses

Boolean, indicates whether to include penalties that missed the goal without the goalkeeper actively saving the ball.

quarterlyAxis

Boolean, to customise the x-axis. If TRUE, the beginning of every quarter of each year will be included on the axis, if FALSE, only the beginning of each year will be marked.

colours

Vector of length 3 that indicate the colours for saves, misses, and goals. The default value tries to reflect the relative success of each outcome for goalkeepers and penalty takers.

main

Main title of the plot. The default indicates who the penalties were taken by or against.

sub

Subtitle of the plot. The defaults indicates whether missed shots were included or not.

jitter

Boolean, should observations be jittered along the y-axis to avoid overlap?

yvalconst

Boolean, if TRUE, all penalties are plotted with a constant y-value (jitter may be added afterwards if jitter = TRUE). If FALSE, saves, misses, and goals are plotted with three different y-values (plus possible jitter). A legend is added to the top of the plot in that case.

Value

No value is returned, function is called for its side-effect of producing a plot.

Author(s)

Leo N. Geppert, with thanks to Marius Ötting for the inspiration.

See Also

penaltyPrint

Examples

data(penalties)
# Basic goalkeeper plot with quarterly and yearly marks. Depending on the duration of the career,
# quarterly marks may be too cluttered.
penaltyPlot('Illgner', pendat = penalties, exact = FALSE)
penaltyPlot('Illgner', pendat = penalties, exact = FALSE, quarterly = FALSE)

# similar plot for a penalty taker
penaltyPlot('Polster', pendat = penalties, exact = FALSE, quarterly = FALSE, goalkeeper = FALSE)

# demonstrate the effect of keeping the value on the y-axis constant as well as of excluding misses
penaltyPlot('Neuer', pendat = penalties, exact = FALSE, quarterly = FALSE)
penaltyPlot('Neuer', pendat = penalties, exact = FALSE, quarterly = FALSE, yvalconst = TRUE)
penaltyPlot('Neuer', pendat = penalties, exact = FALSE, quarterly = FALSE, includeMisses = FALSE)

Show a table of all penalties taken by or against a men's Bundesliga player.

Description

Search for a player – either exact match or using fixed regular expressions – and return all penalties taken by or against this player as table.

Usage

penaltyPrint(player, goalkeeper = TRUE, exact = TRUE, pendat, includeMisses = TRUE)

Arguments

player

Character vector of length 1 which contains the full name of a player in pendat or a part thereof.

goalkeeper

Boolean, specifies whether player is searched for among goalkeepers (TRUE) or penalty takers (FALSE).

exact

Boolean, specifies whether to look for an exact match. If set to FALSE, grep(player, fixed = TRUE) is used to search for the player.

pendat

Name of a data set containing the penalties. The data set needs to follow the format of penalties.

includeMisses

Boolean, indicates whether to include penalties that missed the goal without the goalkeeper actively saving the ball.

Value

Returns a data.frame that is a subset of pendat.

Author(s)

Leo N. Geppert

See Also

penaltyPlot

Examples

data(penalties)
penaltyPrint('Illgner, Bodo', pendat = penalties)
penaltyPrint('Illgner', exact = FALSE, pendat = penalties)