Excalibur Staff Times

Author

Sisi

1) Load necessary library

# Thu Oct 10 01:10:40 2024 ------------------------------
library(tidyverse)
Warning: package 'tidyverse' was built under R version 4.4.1
Warning: package 'ggplot2' was built under R version 4.4.1
Warning: package 'tibble' was built under R version 4.4.1
Warning: package 'tidyr' was built under R version 4.4.1
Warning: package 'readr' was built under R version 4.4.1
Warning: package 'purrr' was built under R version 4.4.1
Warning: package 'dplyr' was built under R version 4.4.1
Warning: package 'stringr' was built under R version 4.4.1
Warning: package 'forcats' was built under R version 4.4.1
Warning: package 'lubridate' was built under R version 4.4.1
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.5
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.5.1     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.1
✔ purrr     1.0.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(lubridate)

Read .csv file of member times as dataframe

df <- read.csv("C:/Users/Sisi/Documents/EXCALIBUR/Excalibur Member Times.csv")

View column names for understanding structure

colnames(df)
[1] "Name"                   "Date"                   "Arrival.Time"          
[4] "Departure.Time"         "Duration..Time.Format."

Convert arrival time and departure time for calculations and plotting

df <- df %>%
  mutate(Arrival_Time = as.POSIXct(Arrival.Time, format="%I:%M %p"),
         Departure_Time = as.POSIXct(Departure.Time, format="%I:%M %p"))

2) Calculate stay duration in minutes

df <- df %>%
  mutate(Duration_Minutes = as.numeric(difftime(Departure_Time, Arrival_Time, units = "mins")))

3) Calculate peak meeting time

time_range <- seq(min(df$Arrival_Time), max(df$Departure_Time), by = "1 min")

Calculate number of members present at each minute

attendance <- sapply(time_range, function(t) sum(df$Arrival_Time <= t & df$Departure_Time >= t))

Determine peak time (max attendance)

peak_time <- time_range[which.max(attendance)]
print(paste("Peak meeting time:", format(peak_time, "%I:%M %p")))
[1] "Peak meeting time: 12:30 PM"

4) Correlation between arrival and departure times

arrival_departure_correlation <- cor(as.numeric(df$Arrival_Time), as.numeric(df$Departure_Time))
print(paste("Correlation between Arrival and Departure times:", round(arrival_departure_correlation, 2)))
[1] "Correlation between Arrival and Departure times: -0.21"

5) Plot the data with peak time and line of best fit

ggplot(df, aes(x = Arrival_Time, y = Duration_Minutes)) +
  geom_point(aes(color = Duration_Minutes, size = Duration_Minutes), alpha = 0.7) +  # Aesthetic: color and size
  geom_smooth(method = "lm", linetype = "dashed", color = "red", se = FALSE) +  # Add a regression line (best fit)
  geom_vline(xintercept = as.POSIXct(peak_time), linetype = "dotted", color = "purple", size = 1.2) +  # Peak time line
  scale_color_gradient(low = "blue", high = "red") +  # Color gradient for better visuals
  labs(title = "Excalibur Meeting Attendance Duration",
       subtitle = paste("Peak meeting time:", format(peak_time, "%I:%M %p"), 
                        "| Correlation:", round(arrival_departure_correlation, 2)),
       x = "Arrival Time",
       y = "Duration (Minutes)",
       color = "Duration (Minutes)") +
  theme_minimal() +
  theme(plot.title = element_text(hjust = 0.5))
Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` instead.
`geom_smooth()` using formula = 'y ~ x'

Data Summary

In this chart, I analyzed when people arrived at the meeting and how long they stayed. This chart is a sample of Oct. 4 attendees, showing a preview of what I will observe in the following meetings for planning purposes.

Key Observation A slight negative trend shows that people who arrived later tended to leave earlier. For example, those who came around 10:30 AM stayed longer, while those arriving closer to noon left sooner. The red dashed line shows this pattern, but it’s not very strong—just something to keep in mind.

Peak Meeting Time The purple dotted line marks 12:30 PM, which is when most people were present at the meeting.

Who stayed the longest? The bigger and redder the bubble, the longer someone stayed. People who arrived earlier (around 10:30 AM) tended to stay longer, while those arriving closer to noon stayed for much less time.

Why this matters

Understanding these patterns can help us plan our future meetings better. If we know that late arrivals leave earlier, we can make important announcements earlier in the meeting so more people are there to hear them.

Future Considerations

By tracking this data, we can see if people tend to arrive and leave at similar times or if their attendance patterns vary. This will help us understand who is more punctual and actively participating in the meetings, allowing us to plan meetings more effectively and ensure key discussions happen when the majority of engaged attendees are present.