##Installing the package

## install.packages("wbstats")

Load the package

library(wbstats)

Understand what is in the data (This is Specific to this API)

meta_data <- wb_cache()

Export thr dataframe into flat files

write.csv(meta_data$topics, "topics.csv")
write.csv(meta_data$countries, "countries.csv")

Search indicators based on a pattern

wb_search("population")
## # A tibble: 3,967 × 3
##    indicator_id         indicator                               indicator_desc  
##    <chr>                <chr>                                   <chr>           
##  1 1.0.HCount.1.90usd   Poverty Headcount ($1.90 a day)         The poverty hea…
##  2 1.0.HCount.2.5usd    Poverty Headcount ($2.50 a day)         The poverty hea…
##  3 1.0.HCount.Mid10to50 Middle Class ($10-50 a day) Headcount   The poverty hea…
##  4 1.0.HCount.Ofcl      Official Moderate Poverty Rate-National The poverty hea…
##  5 1.0.HCount.Poor4uds  Poverty Headcount ($4 a day)            The poverty hea…
##  6 1.0.HCount.Vul4to10  Vulnerable ($4-10 a day) Headcount      The poverty hea…
##  7 1.0.PGap.1.90usd     Poverty Gap ($1.90 a day)               The poverty gap…
##  8 1.0.PGap.2.5usd      Poverty Gap ($2.50 a day)               The poverty gap…
##  9 1.0.PGap.Poor4uds    Poverty Gap ($4 a day)                  The poverty gap…
## 10 1.1.HCount.1.90usd   Poverty Headcount ($1.90 a day)-Rural   The poverty hea…
## # ℹ 3,957 more rows

Download data using indicator ID (From wbdata github)

pop <- wb_data("SP.POP.TOTL")
gdp <- wb_data("NY.GDP.MKTP.CD")

Financial Data - quantmod

#install.packages("quantmod")
library(quantmod)
## Loading required package: xts
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
## Loading required package: TTR
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo
getSymbols(c("CRWV", "AAPL", "NVDA"), source = "yahoo")
## [1] "CRWV" "AAPL" "NVDA"
plot(AAPL)

plot(NVDA)

getSymbols(c("FPCPITOTLZGUSA", "FPCPITOTLZGEGY", "FPCPITOTLZGUSA", "FPCPITOTLZGCHN"), source = "FRED")
## Warning: Failed to open
## 'https://query2.finance.yahoo.com/v8/finance/chart/FPCPITOTLZGUSA?period1=1167609600&period2=1770076800&interval=1d':
## The requested URL returned error: 404
## Warning: Unable to import "FPCPITOTLZGUSA".
## cannot open the connection
## Warning: Failed to open
## 'https://query2.finance.yahoo.com/v8/finance/chart/FPCPITOTLZGEGY?period1=1167609600&period2=1770076800&interval=1d':
## The requested URL returned error: 404
## Warning: Unable to import "FPCPITOTLZGEGY".
## cannot open the connection
## Warning: Failed to open
## 'https://query2.finance.yahoo.com/v8/finance/chart/FPCPITOTLZGCHN?period1=1167609600&period2=1770076800&interval=1d':
## The requested URL returned error: 404
## Warning: Unable to import "FPCPITOTLZGCHN".
## cannot open the connection
## NULL

Warning because of high usage of API