knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(openpoweRlifting)

openpoweRifting is a library that handles keeping an up-to-date copy of the OpenPowerlifting data.

It used to use {pins}, now uses {sqlite} because too big. "Pin" is a nice verb for what we're doing, so I'm going to keep it.

Examples

openpoweRlifting has 2 functions - pin_opl_ipf and pin_opl_full. By default the pin_opl_ipf function will grab the nightly IFP dataset and pin it to the table "opl-ipf" in the SQLite database "~/.local/share/opl/opl.db"

You can then read the data with TODO: explain sqlite connections.

By means of example, I'll find the max totals for each equipment class:

pin_opl_ipf()
location = "~/.local/share/opl/"
con = DBI::dbConnect(RSQLite::SQLite(), file.path(location, "opl-ipf"))

dplyr::tbl(con, "opl") %>% 
  dplyr::group_by(equipment) %>%
  dplyr::slice_max(n=1, order_by=total_kg) %>%
  dplyr::ungroup() %>%
  knitr::kable()
con = DBI::dbDisconnect(con)

Similarly, pin_opl_full() will grab the full OPL dataset as "opl-all":

pin_opl_full()

con = DBI::dbConnect(RSQLite::SQLite(), file.path(location, "opl-all"))

dplyr::tbl(con, "opl") %>% 
  dplyr::group_by(equipment) %>%
  dplyr::slice_max(n=1, order_by=total_kg) %>%
  dplyr::ungroup() %>%
  knitr::kable()

con = DBI::dbDisconnect(con)


jimr1603/openpoweRlifting documentation built on Feb. 25, 2022, 7:39 a.m.