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.
## # 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
## Observations: 924
## Variables: 7
## $ date <date> 2016-01-04, 2016-01-05, 2016-01-06, 2016-01-07, 2016-0…
## $ open <dbl> 656.29, 646.86, 622.00, 621.80, 619.66, 612.48, 625.25,…
## $ high <dbl> 657.72, 646.91, 639.79, 630.00, 624.14, 619.85, 625.99,…
## $ low <dbl> 627.51, 627.65, 620.31, 605.21, 606.00, 598.57, 612.24,…
## $ close <dbl> 636.99, 633.79, 632.65, 607.94, 607.05, 617.74, 617.89,…
## $ volume <dbl> 9314500, 5822600, 5329200, 7074900, 5512900, 4891600, 4…
## $ adjusted <dbl> 636.99, 633.79, 632.65, 607.94, 607.05, 617.74, 617.89,…
There are 7 columns or vairables of data in this chart.
On January 5th, Amazon opened with a price of 647 and closed with a price of 634. Their low was 628 dollars and their high was 647 dollars. They had a volume of 5,822,600 stocks and their adjusted price was 634 dollars.
Hint: Watch the video, “Basic Data Types”, in DataCamp: Introduction to R for Finance: Ch1 The Basics.
The data in our charts is numerical data, the other types of data are logical and character data.
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.
For more information on the ggplot() function, refer to Ch2 Introduction to ggplot2 in one of our e-textbooks, Data Visualization with R.
At the beginning of 2019, Amazon Stock started in a trough, as the year went on they started to have an expansion and and then hit a slight recession before going back up again.
Hint: Use message, echo and results in the chunk options. Refer to the RMarkdown Reference Guide.
Hint: Use eval in the chunk option. Refer to the RMarkdown Reference Guide.