-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
63 lines (52 loc) · 2.82 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
title: "README"
output: github_document
editor_options:
chunk_output_type: console
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(
echo = TRUE,
fig.path = "man/figures/"
)
```
# SmarterScotland <img src="man/figures/logo.png" align="right" />
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental) [![Build Status](https://travis-ci.org/konradzdeb/SmarterScotland.svg?branch=master)](https://travis-ci.org/konradzdeb/SmarterScotland) [![codecov](https://codecov.io/gh/konradzdeb/SmarterScotland/branch/master/graph/badge.svg)](https://codecov.io/gh/konradzdeb/SmarterScotland) [![Build status](https://ci.appveyor.com/api/projects/status/i3mfbvchkyah6gmf?svg=true)](https://ci.appveyor.com/project/konradedgar/smarterscotland-yhq6y) [![license](https://img.shields.io/badge/license-GPL--3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html) [![develVersion](https://img.shields.io/badge/devel%20version-0.0.09-yellow.svg?style=flat)](https://github.com/konradzdeb/SmarterScotland) [![CRAN status](https://www.r-pkg.org/badges/version/SmarterScotland)](https://cran.r-project.org/package=SmarterScotland)
# Overview
The SmarterScotland package provides a convenient interface for sourcing and interrogating data available through the [statistics.gov.scot](http://statistics.gov.scot).
# Example
```{r example_sourcing_and_chart, echo=TRUE, warning=FALSE, message=FALSE}
# Data
library(SmarterScotland)
# Visuals and data manipulation
suppressPackageStartupMessages(library(tidyverse))
# Data sourcing
dta_Glasgow_Crime <- get_geography_data(data_set = "recorded-crime",
geography = "Glasgow City",
measure = "count",
pre_process_results = TRUE)
# Summary chart
dta_Glasgow_Crime %>%
filter(crime_or_offence == "all-crimes") %>%
select(count, reference_period) %>%
arrange(desc(reference_period)) %>%
ggplot(aes(x = reference_period, y = count, group = 1)) +
geom_line() +
labs(x = "Reference Period",
y = "Count",
title = "Total Crime in Glasgow City") +
scale_y_continuous(labels = function(x) format(x, big.mark = ",", scientific = FALSE)) +
theme_light() +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
```
# Installation
```{r installation, echo=TRUE, message=FALSE, warning=FALSE, eval=FALSE}
if (isFALSE("remotes" %in% rownames(installed.packages()))) {
install.packages("remotes")
}
remotes::install_github(repo = "konradzdeb/SmarterScotland", build_vignettes = TRUE,
dependencies = TRUE)
```
# Similar projects
* [SmarterPoland](https://cran.r-project.org/web/packages/SmarterPoland/index.html)
* [Eurostat](https://cran.r-project.org/web/packages/eurostat/index.html)