knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
datahut
provides datasets for statistical data analysis.
You can install the development version from GitHub with:
# install.packages("devtools") devtools::install_github("pridiltal/datahut")
This is a basic example which shows you how to solve a common problem:
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")
head(touristsl_purpose) p<- autoplot(touristsl_purpose) + geom_point(aes(shape= Purpose)) + scale_shape_manual(values = 1:11) print(p)
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.