---
title: "The Expense of Living Index is a metric that compares the cost of living in various countries. "
output:
flexdashboard::flex_dashboard:
orientation: rows
source_code: embed
---
```{r setup, include=FALSE}
data <- read.csv("livingcost.csv")
print(data)
library(plotly)
```
Dashboard
=======================================================================
Row
-----------------------------------------------------------------------
### The Cost of Living Index is a relative measure cost of consumer products such as groceries, restaurants, transportation, and utilities. The Price of Living Index excludes housing expenses such as rent and mortgage.A city with a Price index of 120 is 20 percent more expensive than New York, as per Data compiled.
```{r}
#bar chart for Cost.of.Living.Index and Rent price in different countries.
fig <- plot_ly(data, x = ~Country, y = ~Cost.of.Living.Index, type = 'bar', name = 'Living expenses',marker = list(color = "rgb(258, 125, 0)",
line = list(color = "rgb(258, 125, 0)",
width = 2)))
fig <- fig %>% add_trace(y = ~Rent.Index, name = 'Rent price',marker = list(color = "rgb(153, 204, 255)",
line = list(color = "rgb(153, 204, 255)",
width = 2)))
fig <- fig %>% layout(yaxis = list(title = 'Cost of living and its Rent Price'), barmode = 'stack')
fig
```
### Expenses for groceries and restaurant prices in various countries are shown
```{r}
#scatter plot to see Grocery price and Restaurant prices in different countries.
fig1 <- plot_ly(data, x = ~Groceries.Index, y = ~Country, type = 'scatter', name = 'Groceries rate',marker = list(color = "rgb(258, 155, 0)",
line = list(color = "rgb(258, 155, 0)",
width = 2)))
fig1 <- fig1 %>% add_trace(x = ~Rent.Index, name = 'Restaurant price', marker = list(color = "rgb(127, 0, 255)",
line = list(color = "rgb(127, 0, 255)",
width = 2)))
fig1 <- fig1 %>% layout(yaxis = list(title = 'Countries'), barmode = 'group')
fig1 <- fig1 %>% layout(axis = list(title = 'Countries'), barmode = 'group')
fig1
```
Row
-----------------------------------------------------------------------
### The Cost of Living Plus Rent Index spans from 0 to 130, whereas the Local Purchasing Power Index ranges from 0 to 120.
```{r}
#Pricing of living plus rent index and local purchasing power index in various nations can be seen in a box plot.
fig2 <- plot_ly(data,x = ~Cost.of.Living.Plus.Rent.Index, type = "box", name = "Living and Rent",marker = list(color = "rgb(195, 195, 195)",
line = list(color = "rgb(20, 20, 20)",
width = 2)))
fig2 <- fig2 %>% add_trace(x = ~Local.Purchasing.Power.Index, name = "Local Purchase Price", marker = list(color = "rgb(195, 195, 195)",
line = list(color = "rgb(20, 20, 20)",
width = 2)))
fig2
```
### Because it shows the connections between two numerical variables, Scatter Plot is being used for the Cost of Living Index and the Local Purchasing Power Index.
```{r}
#The Cost of Living Index and the Local Purchasing Power Index are displayed using a scatter plot.
fig3 <- plot_ly(data, x = ~Cost.of.Living.Index, y = ~Country, type = 'scatter', name = 'Living rate',marker = list(color = "rgb(153, 253, 153)",
line = list(color = "rgb(153, 253, 153)",
width = 2)))
fig3 <- fig3 %>% add_trace(x = ~Local.Purchasing.Power.Index, name = 'Purchase in Local rate', marker = list(color = "rgb(255, 102, 102)",
line = list(color = "rgb(255, 102, 102)",
width = 2)))
fig3 <- fig3 %>% layout(xaxis = list(title = 'Purchase in local and living expenditure w.r.t. Country'), barmode = 'group')
fig3
```
References
=======================================================================
Row
-----------------------------------------------------------------------
### References
* 2022 - Cost of Living Index2022.Retrieved 7 June 2022,from https://www.kaggle.com/datasets/ankanhore545/cost-of-living-index-2022?select=Cost_of_Living_Index_2022.csv
* 2022 - Plotly R Open Source Graphing Library. Retrieved 7 June 2022, from https://plotly.com/r/.
* 2022 - RGB Color Codes Chart. Retrieved 9 June 2022, from https://www.rapidtables.com/web/color/RGB_Color.html