LED example bulbs of lumen output

An example data set of LED bulbs based on actual data.
products
Author

M119

Published

February 1, 2024

Data details

There are 8,888 rows and 5 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/led_study.

This data is available to all.

Variable description

  • id: An id for each LED light measured
  • hours: The number of hours since the first measurement
  • intensity: The lumen output of the bulb. 800 lumens maps to a 60 watt incandescent bulb (https://www.lumens.com/how-tos-and-advice/light-bulb-facts.html)
  • normalized_intensity: The normalized light output based on the first measured intensity of the bulb
  • percent_intensity: The normalized_intensity multiplied by 100

Variable summary

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
id 0 1 101.50 58.31 1.00 51.00 101.50 152.00 202.00 ▇▇▇▇▇
hours 0 1 2262.32 1534.33 0.00 978.25 2050.00 3546.25 5010.00 ▇▇▆▃▆
intensity 0 1 803.80 11.01 753.64 796.78 803.93 811.05 840.29 ▁▁▇▆▁
normalized_intensity 0 1 1.01 0.01 0.99 1.01 1.01 1.02 1.04 ▁▃▇▅▁
percent_intensity 0 1 101.25 0.68 98.96 100.79 101.28 101.72 103.52 ▁▃▇▅▁
NULL
Explore generating code using R
pacman::p_load(tidyverse, googledrive, connectapi)

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

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

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

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