Use the given code below to answer the questions.

## Load package
library(tidyverse) # for cleaning, plotting, etc
library(tidyquant) # for financial analysis

## Import data
stocks <- tq_get("AAPL", get = "stock.prices", from = "2016-01-01")
stocks

## Visualize
stocks %>%
ggplot(aes(x = date, y = adjusted)) +
geom_line()

## Q1 Import Netflix stock prices, instead of Apple.

library(tidyverse) # for cleaning, plotting, etc
library(tidyquant) # for financial analysis

stocks <- tq_get("NFLX", get = "stock.prices", from = "2017-01-01")
stocks

## Q2 How many shares of the stock were traded on January 13, 2017?

There were 10515000 shares of Netflix stock traded on January 13, 2017.

## Q3 Stock prices in this data would be a good example of numeric data. Character and logical are two other basic data types in R. List one example of character data and one example of logical data.

One example of character data would be (“one” or “two”). Logical data is represented in a true or false scenario, such as (false, false, true, true, false)

## Q4 Plot the closing price in a line chart.

stocks %>%
ggplot(aes(x = date, y = close)) +
geom_line()

## Q5 From the chart you created in Q4, briefly describe how the Netflix stock has performed since the beginning of 2019.

   Netflix has done well, but hit a hiccup around the middle of 2019. But overall, it grew from $250 to$400.

## Q6 Import two stocks: Netflix and Amazon for the same time period.

library(tidyverse) # for cleaning, plotting, etc
library(tidyquant) # for financial analysis

stocks <- tq_get("NFLX", "AMZN", get = "stock.prices", from = "2017-01-01")
stocks
## # A tibble: 781 x 7
##    date        open  high   low close   volume adjusted
##    <date>     <dbl> <dbl> <dbl> <dbl>    <dbl>    <dbl>
##  1 2017-01-03  125.  128.  124.  127.  9437900     127.
##  2 2017-01-04  127.  130.  127.  129.  7843600     129.
##  3 2017-01-05  129.  133.  129.  132. 10185500     132.
##  4 2017-01-06  132.  134.  130.  131. 10657900     131.
##  5 2017-01-09  131.  132.  130.  131.  5771800     131.
##  6 2017-01-10  131.  132.  129.  130.  5985800     130.
##  7 2017-01-11  131.  132.  129.  130.  5615100     130.
##  8 2017-01-12  131.  131.  128.  129.  5388900     129.
##  9 2017-01-13  131.  134.  131.  134. 10515000     134.
## 10 2017-01-17  135.  135.  132.  133. 12220200     133.
## # … with 771 more rows