Tourist Visit Visualization

Using dygraph visualization to view the number of tourist visiting Nepal

Kishan K.C.
Data Scientist

Tourist Visit Data

Lumbini, Nepal is birthplace of Gautam Buddha. Every year, there are huge number of tourists visiting Lumbini. I have created a shiny application Tourist Visit to Nepal to present the data as visualization and presenting my idea in this presentation. Lumbini is famous all over the world and people from around the world are visiting thsi place. I have tried to answer which country has highest number of tourist visit to Lumbini in year 2012-2014. In this presentation, I will show the steps I took to create the visualization. I downloaded the data from Open Data Nepal

tourist <- read.csv("tourist.csv")
nrow(tourist)
## [1] 1524
names(tourist)
## [1] "Year.AD"        "Year.BS"        "Country"        "Month"         
## [5] "No.of.Visitors"

Look into dataset

str(tourist)
## 'data.frame':    1524 obs. of  5 variables:
##  $ Year.AD       : int  2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 ...
##  $ Year.BS       : int  2069 2069 2069 2069 2069 2069 2069 2069 2069 2069 ...
##  $ Country       : Factor w/ 57 levels "Afghanistan",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ Month         : Factor w/ 12 levels "April","Aug.",..: 5 4 8 1 9 7 6 2 12 11 ...
##  $ No.of.Visitors: int  0 0 0 0 0 0 0 0 0 0 ...

Data contains information about visitors from 57 different countries for 12 months in 2012,2013 and 2014.

Convert data to time series(xts) format

#Change month to convert it to time series format
tourist$Month <- factor(tourist$Month
                        , levels = c("Jan.","Feb.","Mar.","April","May","June","July",
                                     "Aug.","Sept.","Oct.","Nov.","Dec.")
                        , labels = c("01","02","03","04","05","06","07",
                                     "08","09", "10","11","12"))
#subset data for Srilanka
touristData <- subset(tourist, Country == "Srilanka")
tourist_xts <- as.xts(
        touristData[5]
        , order.by = as.Date(
                paste0(touristData$Year.AD,"-",touristData$Month,
                       "-01",format = "%Y-%M-01")
        )
)

Dygraph Visualization of tourist from Srilanka

dygraph(data = tourist_xts, 
        main = paste("Tourist Visit from Srilanka",
                     " to Lumbini, Nepal", sep = "")) %>% 
        dyRangeSelector()

Plot

This flow is made dynamic to be drived with the country selected by user.