Due Date: 11:59pm, Oct 25

Part 1

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
stocks <- as.data.frame(EuStockMarkets) %>%
  gather(index, price) %>%
  mutate(time = rep(time(EuStockMarkets), 4))
plot_ly(stocks, x = ~time, y = ~price, color = ~index, mode = "lines")

Part 1 Insights

The SMI was worth the most starting a little after 1997. The FTSE appears to have the lowest growth from 1992. The DAX looks like it has promise to grow at a strong rate.

Part 2

Part 2: Data Description

This data came from Kaggle, but it was originally collected by Dr. Kristen Gorman and the Palmer Station, Antarctica Long Term Ecological Research Network (LTER). It has data about penguin attributes such as bill length, bill depth, flipper length, sex, and body mass. There are 344 rows and 9 columns.

peng <- read.csv("penguins.csv")
head(peng,5)
  X species    island bill_length_mm bill_depth_mm flipper_length_mm
1 1  Adelie Torgersen           39.1          18.7               181
2 2  Adelie Torgersen           39.5          17.4               186
3 3  Adelie Torgersen           40.3          18.0               195
4 4  Adelie Torgersen             NA            NA                NA
5 5  Adelie Torgersen           36.7          19.3               193
  body_mass_g    sex year
1        3750   male 2007
2        3800 female 2007
3        3250 female 2007
4          NA   <NA> 2007
5        3450 female 2007

Part 2: Gather

longpeng <- gather(peng, key = peng_att, value = measurement,
                    bill_length_mm:flipper_length_mm)
head(longpeng,5)
  X species    island body_mass_g    sex year       peng_att measurement
1 1  Adelie Torgersen        3750   male 2007 bill_length_mm        39.1
2 2  Adelie Torgersen        3800 female 2007 bill_length_mm        39.5
3 3  Adelie Torgersen        3250 female 2007 bill_length_mm        40.3
4 4  Adelie Torgersen          NA   <NA> 2007 bill_length_mm          NA
5 5  Adelie Torgersen        3450 female 2007 bill_length_mm        36.7

Part 2: Boxplot

ggplot(longpeng, aes(x=species, y=measurement)) + geom_boxplot() +
   facet_grid(~ peng_att) + theme_classic()

Boxplot Insights

The Gentoo penguins tend to have a shorter bill depth, but the Adelie penguins have a shorter bill length. The Gentoo penguins have the longest flipper length.

Separating flipper_length_mm from the others since the values of it are a lot bigger than bill depth and bill length.

Flipper Length