knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

datahut

datahut provides datasets for statistical data analysis.

Installation

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("pridiltal/datahut")

Example

This is a basic example which shows you how to solve a common problem:

Tourism in Sri Lanka

Special events

library(datahut)
## basic example code
library(fable)
library(ggplot2)
head(touristsl)
autoplot(touristsl)+
  ggtitle("Tourist arrivals to Sri Lanka from 1970 to 2018")+
  xlab("Year") +
  ylab("Tourist Arrivals")
head(touristsl_monthly)
touristsl_monthly%>% autoplot(Arrivals)
touristsl_monthly[433:588,]  %>% autoplot()
library(feasts)
touristsl_monthly %>%
  feasts::gg_season(Arrivals, labels = "both") +   ylab("Arrivals") +
ggtitle("Seasonal plot: Monthly tourist arrivals to Sri Lanka")
touristsl_monthly %>%
feasts::gg_subseries(Arrivals) + ylab("Arrivals") + ggtitle("Subseries plot: Monthly tourist arrivals to Sri Lanka")

Tourist arrivals to Sri Lanka by purpose of visit

head(touristsl_purpose)
p<- autoplot(touristsl_purpose) +
  geom_point(aes(shape= Purpose)) +
  scale_shape_manual(values = 1:11)
print(p)

Unemployment in Sri Lanka

library(tidyverse)
head(unemp_ratesl)
unemp_ratesl %>% autoplot(Total)
p <- unemp_ratesl %>%
  select(Year, Male, Female) %>%
  pivot_longer(-Year, names_to = "Gender", values_to = "Unemployment_rate") %>%
  as_tsibble(index = Year, key = Gender) %>%
  autoplot()

print(p)


pridiltal/datahut documentation built on Dec. 31, 2020, 2:05 a.m.