library(readxl)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(plotly)
## Loading required package: ggplot2
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
# Read the data
Nerf <- read_xlsx("Nerf.xlsx",
                  col_types = c("date", "text", "text", "text", "text", "numeric"))
names(Nerf) <- c("Time", "Blaster", "Modified", "DartType", "DartNumber", "Distance")

# Create a 3D scatter plot
fig <- plot_ly(Nerf, x = ~Blaster, y = ~DartType, z = ~Distance, color = ~DartType, colors = 'Pastel1') %>%
  add_markers() %>%
  layout(scene = list(xaxis = list(title = 'Blaster'),
                      yaxis = list(title = 'Dart Type'),
                      zaxis = list(title = 'Distance')))

# Print the plot
fig