The full set of runners for the Jerusalem marathon.

This data set has ~2.5k observations. Marathon website - https://jerusalem-marathon.com/en/home-page/
marathon
Author

DS 150

Published

January 25, 2024

Data details

There are 2,438 rows and 20 columns. The data source1 is used to create our data that is stored in our pins table. You can access this pin from a connection to posit.byui.edu using hathawayj/marathon_jerusalem.

This data is available to all.

Variable description

  • age The age of the runner
  • gender The gender of the runner (M/F)
  • chiptime The time in minutes for the runner
  • year The year of the marathon
  • marathon The name of the marathon
  • country The country where the marathon was held
  • finishers The number of finishers at the marathon

Variable summary

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
age 786 0.68 43.65 11.51 18.00 36.00 44.00 52.00 76.00 ▃▆▇▅▁
split_half 1611 0.34 112.78 14.99 68.62 103.58 111.38 121.94 189.10 ▁▇▅▁▁
clocktime 1600 0.34 255.81 39.17 134.68 231.41 255.25 280.72 394.18 ▁▅▇▃▁
chiptime 0 1.00 258.11 41.31 134.45 230.48 256.00 283.42 410.03 ▁▆▇▂▁
year 0 1.00 2011.98 0.82 2011.00 2011.00 2012.00 2013.00 2013.00 ▇▁▇▁▇
split_10k 864 0.65 58.43 8.79 34.72 53.20 57.57 62.88 150.37 ▇▇▁▁▁
split_30k 73 0.97 177.42 26.27 96.78 159.73 176.37 193.78 273.48 ▁▆▇▂▁
split_40k 76 0.97 243.69 36.85 128.97 218.78 242.22 266.74 349.32 ▁▃▇▅▁
finishers 0 1.00 814.25 22.44 786.00 786.00 814.00 841.00 841.00 ▇▁▇▁▇
meantime 0 1.00 257.90 3.05 253.79 253.79 259.24 260.88 260.88 ▇▁▁▇▇
female 2438 0.00 NaN NA NA NA NA NA NA
us 0 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 ▁▁▇▁▁
canada 0 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 ▁▁▇▁▁
europe 0 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 ▁▁▇▁▁
other 0 1.00 1.00 0.00 1.00 1.00 1.00 1.00 1.00 ▁▁▇▁▁
age_gender 0 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 ▁▁▇▁▁

Variable type: character

skim_variable n_missing complete_rate min max empty n_unique whitespace
gender 2438 0 NA NA 0 0 0
marathon 0 1 18 18 0 1 0
country 0 1 6 6 0 1 0
marathon2 0 1 23 23 0 3 0
Explore generating code using R
pacman::p_load(pins, tidyverse, downloader, fs, glue, rvest, googledrive, connectapi)


# Data is from master_marathon. 
sdrive <- shared_drive_find("byuids_data") # This will ask for authentication.
google_file <- drive_ls(sdrive)  |>
  filter(stringr::str_detect(name, "master_marathon"))
tempf <- tempfile()
drive_download(google_file, tempf)
dat <- read_csv(tempf)


# Filter for the Jerusalem Marathon only
marathon_jerusalem <- dat %>%
  filter(marathon == "Jerusalem Marathon")




board <- board_connect()
pin_write(board, marathon_jerusalem, type = "parquet")

pin_name <- "marathon_jerusalem"
meta <- pin_meta(board, paste0("hathawayj/", pin_name))
client <- connect()
my_app <- content_item(client, meta$local$content_id)
set_vanity_url(my_app, paste0("data/", pin_name))

Access data

This data is available to all.

Direct Download: marathon_jerusalem.parquet

R and Python Download:

URL Connections:

For public data, any user can connect and read the data using pins::board_connect_url() in R.

library(pins)
url_data <- "https://posit.byui.edu/data/marathon_jerusalem/"
board_url <- board_connect_url(c("dat" = url_data))
dat <- pin_read(board_url, "dat")

Use this custom function in Python to have the data in a Pandas DataFrame.

import pandas as pd
import requests
from io import BytesIO

def read_url_pin(name):
  url = "https://posit.byui.edu/data/" + name + "/" + name + ".parquet"
  response = requests.get(url)
  if response.status_code == 200:
    parquet_content = BytesIO(response.content)
    pandas_dataframe = pd.read_parquet(parquet_content)
    return pandas_dataframe
  else:
    print(f"Failed to retrieve data. Status code: {response.status_code}")
    return None

# Example usage:
pandas_df = read_url_pin("marathon_jerusalem")

Authenticated Connection:

Our connect server is https://posit.byui.edu which you assign to your CONNECT_SERVER environment variable. You must create an API key and store it in your environment under CONNECT_API_KEY.

Read more about environment variables and the pins package to understand how these environment variables are stored and accessed in R and Python with pins.

library(pins)
board <- board_connect(auth = "auto")
dat <- pin_read(board, "hathawayj/marathon_jerusalem")
import os
from pins import board_rsconnect
from dotenv import load_dotenv
load_dotenv()
API_KEY = os.getenv('CONNECT_API_KEY')
SERVER = os.getenv('CONNECT_SERVER')

board = board_rsconnect(server_url=SERVER, api_key=API_KEY)
dat = board.pin_read("hathawayj/marathon_jerusalem")