-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.rmd
73 lines (60 loc) · 5.26 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
64
65
66
67
68
69
70
71
72
73
---
title: DescriptiveStats.OBeu <img src="okfgr2.png" align="right" />
author: "Kleanthis Koupidis, Aikaterini Chatzopoulou, Charalampos Bratsas"
output:
github_document:
fig_width: 8
fig_height: 8
dev: png
html_preview: no
number_sections: yes
---
<!-- badges: start -->
[![R-CMD-check](https://github.com/okgreece/DescriptiveStats.OBeu/workflows/R-CMD-check/badge.svg)](https://github.com/okgreece/DescriptiveStats.OBeu/actions)
<!-- badges: end -->
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/DescriptiveStats.OBeu)](https://cran.r-project.org/package=DescriptiveStats.OBeu)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active)
[![Pending Pull-Requests](http://githubbadges.herokuapp.com/okgreece/DescriptiveStats.OBeu/pulls.svg)](https://github.com/okgreece/DescriptiveStats.OBeu/pulls)
[![Github Issues](http://githubbadges.herokuapp.com/okgreece/DescriptiveStats.OBeu/issues.svg)](https://github.com/okgreece/DescriptiveStats.OBeu/issues)
[![minimal R version](https://img.shields.io/badge/R%3E%3D-3.1-6666ff.svg)](https://cran.r-project.org/)
[![](http://cranlogs.r-pkg.org/badges/grand-total/DescriptiveStats.OBeu)](http://cran.rstudio.com/web/packages/DescriptiveStats.OBeu/index.html)
[![Licence](https://img.shields.io/badge/licence-GPL--2-blue.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
[![Rdoc](http://www.rdocumentation.org/badges/version/DescriptiveStats.OBeu)](http://www.rdocumentation.org/packages/DescriptiveStats.OBeu)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1289784.svg)](https://doi.org/10.5281/zenodo.1289784)
#[DescriptiveStats.OBeu ](https://okgreece.github.io/DescriptiveStats.OBeu/)
Εstimate and return the necessary parameters for descriptive statistics visualizations, used in [OpenBudgets.eu](http://openbudgets.eu/). It includes functions for measuring central tendency and dispersion of amount variables along with their distributions and correlations and the frequencies of categorical variables for Budget data of municipalities across Europe, according to the [OpenBudgets.eu data model](https://github.com/openbudgets/data-model).
This package can generally be used to extract visualization parameters convert them to JSON format and use them as input in a different graphical interface. Most functions can have general use out of the [OpenBudgets.eu data model](https://github.com/openbudgets/data-model).
You can see detailed information [here](https://okgreece.github.io/DescriptiveStats.OBeu/).
```{r, eval=FALSE, include=TRUE}
# install DescriptiveStats.OBeu- cran stable version
install.packages(DescriptiveStats.OBeu)
# or
# alternatively install the development version from github
devtools::install_github("okgreece/DescriptiveStats.OBeu")
```
Load library `DescriptiveStats.OBeu` <img src="obeu_logo.png" align="right" />
```{r}
library(DescriptiveStats.OBeu)
```
#Descriptive Statistics in a call
`ds.analysis` is used to estimate *minimum*, *maximum*, *range*, *mean*, *median*, *first and third quantiles*, *variance*, *standart deviation*, *skewness* and *kurtosis*, *boxplot*, *histogram parameters* needed for visualization of numeric variables and *frequencies* of factor variables of a given vector, matrix or data frame of data.
`ds.analysis` returns by default a list object, we set `tojson` parameter `TRUE`, `outliers` parameter `FALSE`, `fr.select = "Produktbereich"`. Τhere is one numeric variable, correlation will be empty.
```{r}
wuppertalanalysis = ds.analysis(Wuppertal_df,outliers=FALSE, fr.select = "Produktbereich", tojson=TRUE) # json string format
jsonlite::prettify(wuppertalanalysis) # use prettify of jsonlite library to add indentation to the returned JSON string
```
`ds.analysis` uses internally the functions `ds.statistics`,`ds.hist`,`ds.boxplot`,`ds.correlation` and `ds.frequency`. However, these functions can be used independently and depends on the user requirements (see package manual or vignettes).
#Descriptive Statistics on OpenBudgets.eu platform
`open_spending.ds` is designed to estimate and return the basic descriptive measures, the correlation and the boxplot parameters of all the numerical variables and the frequencies of all factor variables of [OpenBudgets.eu](http://openbudgets.eu/) datasets.
The input data must be a JSON link according to the [OpenBudgets.eu data model](https://github.com/openbudgets/data-model). There are different parameters that a user could specify, e.g. `dimensions`,
`measured.dimensions` and `amounts` should be defined by the user, to form the dimensions of the dataset. Then the basic descriptive measures of tendency and spread, boxplot and histogram parameters are estimated in order to describe and visualize the distribution characteristics of the desired dataset.
`open_spending.ds` estimates and returns the json data that are described with the [OpenBudgets.eu data model](https://github.com/openbudgets/data-model), using `ds.analysis` function.
```{r}
descript = open_spending.ds(
json_data = Wuppertal_openspending,
dimensions ="functional_classification_3.Produktgruppe|date_2.Year",
amounts = "Amount"
)
# Pretty output using prettify of jsonlite library
jsonlite::prettify(descript,indent = 2)
```