02/12/2020

R Markdown

This is an R Markdown presentation. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document.

Summary

  • The objective of this presentation is to generate a choropleth map in R using the “Plotly” library.
  • The map will display Gross Domestic Product (GDP) of countries in World with codes in 2014.

Slide with R Output

## Loading required package: ggplot2
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union

Display Of A Dataframe

##                COUNTRY GDP..BILLIONS. CODE
## 1          Afghanistan          21.71  AFG
## 2              Albania          13.40  ALB
## 3              Algeria         227.80  DZA
## 4       American Samoa           0.75  ASM
## 5              Andorra           4.80  AND
## 6               Angola         131.40  AGO
## 7             Anguilla           0.18  AIA
## 8  Antigua and Barbuda           1.24  ATG
## 9            Argentina         536.20  ARG
## 10             Armenia          10.88  ARM

Slide With Choropleth Map

## Warning: `arrange_()` is deprecated as of dplyr 0.7.0.
## Please use `arrange()` instead.
## See vignette('programming') for more help
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_warnings()` to see where this warning was generated.