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 = close)) +
  geom_line()

Q1 Get Amazon stock prices, instead of Apple.

Hint: Insert a new code chunk below and type in the code, using the tq_get() function above. Replace the ticker symbol for Microsoft. You may find the ticker symbol for Microsoft from Yahoo Finance.

## Import data
## Load package
library(tidyverse) # for cleaning, plotting, etc
library(tidyquant) # for financial analysis
stocks <- tq_get("AMZN", get = "stock.prices", from = "2016-01-01")
stocks
## # A tibble: 924 x 7
##    date        open  high   low close  volume adjusted
##    <date>     <dbl> <dbl> <dbl> <dbl>   <dbl>    <dbl>
##  1 2016-01-04  656.  658.  628.  637. 9314500     637.
##  2 2016-01-05  647.  647.  628.  634. 5822600     634.
##  3 2016-01-06  622   640.  620.  633. 5329200     633.
##  4 2016-01-07  622.  630   605.  608. 7074900     608.
##  5 2016-01-08  620.  624.  606   607. 5512900     607.
##  6 2016-01-11  612.  620.  599.  618. 4891600     618.
##  7 2016-01-12  625.  626.  612.  618. 4724100     618.
##  8 2016-01-13  621.  621.  579.  582. 7655200     582.
##  9 2016-01-14  580.  602.  570.  593  7238000     593 
## 10 2016-01-15  572.  585.  565.  570. 7784500     570.
## # … with 914 more rows

Q2 How many columns (variables) are there?

7 column variables ## Q3 Interpret the second observation? for the second oversation in 2016-01-05, the high was 106 and opened at 106 ## Q4 What type of data are they? What are other basic data types in R? Hint: Watch the video, “Basic Data Types”, in DataCamp: Introduction to R for Finance: Ch1 The Basics. charecter, numeric, integer, complex, and logical.

Q5 Plot the adjusted closing price in a line chart.

Hint: Insert a new code chunk below and type in the code, using the ggplot() function above. Revise the code so that it maps adjusted to the y-axis, instead of close.

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

``` For more information on the ggplot() function, refer to Ch2 Introduction to ggplot2 in one of our e-textbooks, Data Visualization with R.

Q6 From the chart you created in Q5, briefly describe how the Amazon stock has performed since the beginning of 2019.

in 2019 the stocks grew significantly, before 2019 it decreased

Q7 Hide the messages and the code, but display results of the code from the webpage.

Hint: Use message, echo and results in the chunk options. Refer to the RMarkdown Reference Guide.

Q8 Hide the given code at the top and its results from the webpage.

Hint: Use eval in the chunk option. Refer to the RMarkdown Reference Guide.

Q9 Display the title and your name correctly at the top of the webpage.

Q10 Use the correct slug.