R code example to read data
library(pins)
<- "https://posit.byui.edu/data/DATANAMEONPOSIT/"
url_data <- board_connect_url(c("dat" = url_data))
board_url <- pin_read(board_url, "dat") dat
The Author
is the originating BYU-I course that prompted the data. All terms are searchable. This page shows all datasets available on this site. You can explore datasets by topic or course by browsing data topics. We leverage the Posit’s pin packages in Python (pins) and R (pins).
For R users, the following process will read the data from this website. You will need to change DATANAMEONPOSIT
to the actual name.
Use the following python function (read_url_pin()
) to access 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("DATANAMEONPOSIT")