Diving Elephant Seals

Researchers Jessica U. Meir and Paul J. Ponganis measured the body temperatures of a sample of diving elephant seals. A thermistor was placed at a specific location on each seal to measure its body temperature. They showed that the body temperature of seals tends to decrease as they dive. The researchers estimated the typical body temperature of each seal at the time they initiate a dive and called this the ‘representative temperature’ of the seal. The researchers deployed each seal and took measurements on body temperature as well as diving depth and duration. Masses, dive counts, and deployment durations were also recorded.
ecology
animals
Author

MATH 221

Published

April 29, 2024

Data details

There are 13 rows and 14 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/diving_elephant_seals.

This data is available to all.

Variable description

  • Seal.s.Name Name of elephant seal
  • Mass..kg. Mass (kg)
  • Length.of.Deployment..Days.at.Sea. Days elephant seal was deployed at sea
  • Number.of.Dives Number of times seal dived
  • Thermistor.Location Location of thermistor (a device similar to a thermometer, which measures temperature)
  • Mean.Dive.Duration..min. Mean duration of dive (minutes)
  • SD.Dive.Duration..min. Standard deviation of dive duration (minutes)
  • Min.Dive.Duration..min. Minimum dive duration (minutes)
  • Max.Dive.Duration..min. Maximum dive duration (minutes)
  • Mean.Max.Depth..m. Mean maximum depth of dive (meters)
  • SD.Max.Depth..m. Standard deviation of max dive depth (meters)
  • Min.Max.Depth..m. Minimum dive depth (meters)
  • Max.Max.Depth..m. Maximum dive depth (meters)
  • Representative.Temperature Typical body temperature of seal at initiation of dive (C)

Variable summary

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
Mass..kg. 0 1 195.15 45.79 148.00 160.00 180.00 226.00 288.00 ▇▂▂▁▂
Length.of.Deployment..Days.at.Sea. 0 1 5.51 6.22 1.00 1.40 3.00 8.00 21.00 ▇▂▁▁▁
Number.of.Dives 0 1 246.85 171.24 33.00 132.00 218.00 312.00 621.00 ▆▇▂▃▂
Mean.Dive.Duration..min. 0 1 10.45 2.43 5.80 8.90 10.50 12.20 14.20 ▂▆▇▃▆
SD.Dive.Duration..min. 0 1 5.08 1.47 2.30 4.50 5.70 6.40 6.50 ▂▁▂▁▇
Min.Dive.Duration..min. 0 1 1.88 1.61 1.00 1.00 1.10 1.40 5.40 ▇▁▁▁▂
Max.Dive.Duration..min. 0 1 27.38 7.21 11.70 24.40 27.50 29.90 43.70 ▁▃▇▁▁
SD.Max.Depth..m. 0 1 99.06 38.98 28.40 71.70 106.60 124.80 157.80 ▃▃▃▇▆
Min.Max.Depth..m. 0 1 10.00 10.56 5.00 5.00 6.00 7.00 41.00 ▇▁▁▁▁
Max.Max.Depth..m. 0 1 462.46 113.84 234.00 416.00 443.00 504.00 699.00 ▁▃▇▁▂
Representative.Temperature 0 1 38.21 1.26 35.77 37.25 38.16 39.32 39.74 ▂▅▃▃▇

Variable type: character

skim_variable n_missing complete_rate min max empty n_unique whitespace
Seal.s.Name 0 1 3 11 0 13 0
Thermistor.Location 0 1 10 19 0 4 0
Mean.Max.Depth..m. 0 1 3 5 0 13 0
Explore generating code using R
library(tidyverse)
library(pins)
library(connectapi)

diving_elephant_seals <- read_csv('https://github.com/byuistats/data/raw/master/DivingElephantSeals/DivingElephantSeals.csv')


# Publish the data to the server with Bro. Hathaway as the owner.
board <- board_connect()
pin_write(board, diving_elephant_seals, type = "parquet", access_type = "all")

pin_name <- "diving_elephant_seals"
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: diving_elephant_seals.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/diving_elephant_seals/"
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("diving_elephant_seals")

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/diving_elephant_seals")
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/diving_elephant_seals")