Use the given code below to answer the questions.

Q1 Get Walmart 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 Walmart. You may find the ticker symbol for Microsoft from Yahoo Finance.

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

## Import data
stocks <- tq_get("WMT.MX", get = "stock.prices", from = "2016-01-01")
stocks
## # A tibble: 1,025 x 7
##    date        open  high   low close volume adjusted
##    <date>     <dbl> <dbl> <dbl> <dbl>  <dbl>    <dbl>
##  1 2016-01-04 1054. 1054. 1053  1053     126    1048.
##  2 2016-01-05 1065. 1092. 1065. 1091    1081    1085.
##  3 2016-01-06 1108. 1109. 1108. 1109.   1023    1104.
##  4 2016-01-07 1118. 1153. 1118. 1153.   7220    1147.
##  5 2016-01-08 1170  1172  1165  1165     573    1159.
##  6 2016-01-11 1165  1172  1147  1147    1104    1141.
##  7 2016-01-12 1143  1150  1142  1150    6405    1144.
##  8 2016-01-13 1130  1130  1130. 1130.    564    1124.
##  9 2016-01-14 1130  1130  1130  1130      30    1124.
## 10 2016-01-15 1121. 1121. 1121. 1121.   2460    1115.
## # … with 1,015 more rows

Q2 How many columns (variables) are there?

7 columns

Q3 Interpret the second observation?

The stock keeps going up from 01/04/16 to 01/15/16 67 times to be exact.

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.

Walmart has numeric data and the other kinds include logical and character.

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 Walmart stock has performed since the beginning of 2019.

Walmarts stock has been going up with a few drops here and there in their stock but they are mostly going in a upward slope.

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.