-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.Rmd
80 lines (54 loc) · 3.79 KB
/
index.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
74
75
76
77
78
79
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE, message = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-",
out.width='95%',
fig.align='center'
)
devtools::load_all()
```
<img src="okfgr2.png" width="315" height="160" align="right" />
<br></br>
<br></br>
#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).
```{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`
```{r}
library(DescriptiveStats.OBeu)
```
<br></br>
<br></br>
<img src="obeu_logo.png" align="right" />
##Descriptive Statistics on OpenBudgets.eu platform
<br></br>
`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)
```
##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).