Description Usage Arguments Details Examples

View source: R/rescale_coordinates.R

Returns a list containing 2 functions to translate x and y coordinates, from one set of pitch dimensions (i.e. data provider) to another.

Any x or y coordinate is rescaled linearly between the nearest two pitch markings. For example, the edge of the penalty box and the half way-line.

1 2 3 | ```
rescale_coordinates(from, to)
rescale_international(from)
``` |

`from` |
The dimensions to convert from (see |

`to` |
The dimensions to convert to (see |

`pitch_international`

creates a rescaler to `pitch_international`

coordinates.

1 2 3 4 5 6 7 8 9 10 11 12 13 | ```
opta_to_wyscout <- rescale_coordinates(
from = pitch_opta,
to = pitch_wyscout
)
opta_xs <- c(10, 22, 55, 78)
opta_ys <- c(10, 22, 55, 78)
opta_to_wyscout$x(opta_xs)
#> c(9.75000, 21.15152, 55.15152, 78.84848)
opta_to_wyscout$y(opta_ys)
#> c(9.004739, 20.031847, 55.172414, 79.968153)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.