Due Date: 11:59pm, Oct 25

Part 1

Honor Code for Assignment

Honor Pledge: I have recreated my group submission using using the tools I have installed on my own computer

Part 1: Results

data(EuStockMarkets) # load EuStockMarkets
dat <- as.data.frame(EuStockMarkets) # coerce it to a data frame
dat$time <- time(EuStockMarkets) # add `time` variable
longdat <- gather(dat, key = "stock", value = "price", -time) 
# wide to long format
longdat$stock <-as.factor(longdat$stock)
fig <- plot_ly(longdat, x = ~time, y = ~price, type = 'scatter',
               color=longdat$stock)

Part 1: Plot

fig

Part 2

Part 2: Data Description

This dataset has different measurements of penguins. It was collected and made publicly available by Dr. Kristen Gorman and the Palmer Station, Antarctica LTER, a member of the Long Term Ecological Research Network. The dataset is made up of 9 columns: species, island, bill_length_mm, bill_depth_mm, flipper_length_mm, body_mass_g, sex, and year. The dataset can be found on kaggle with this link: https://www.kaggle.com/larsen0966/penguins. The columns are explained more in depth below.

Part 2: Data Description Continued

  • Species: type of penguin
  • Island: the island the penguin is from
  • bill_length_mm: the length of the penguin’s bill in mm
  • bill_depth_mm: the depth of the penguin’s bill in mm
  • flipper_length_mm: the length of the penguin’s flipper in mm
  • body_mass_g: the body mass of the penguin given in grams
  • sex: the gender of the penguin
  • year: the year the data was collected

Part 2: Results

df2 <- read.csv("penguins.csv")
df2 <- gather(df2, key = penguin_att, value = value, 
                    "bill_length_mm": "bill_depth_mm")
df2$species <- as.factor(df2$species)
fig2 <- ggplot(df2, aes(x=species, y=value, fill = species)) +
   geom_boxplot() + 
   facet_grid(~ penguin_att) + theme_classic()+ 
   theme(legend.position = 'None')+
   labs(title = 'Boxplots for Bill Depth and Bill Length')+
   xlab("Species") + ylab("Measurement in mm") + 
   theme(plot.title = element_text(hjust = .5))

Part 2: Plot

fig2