We are very pleased to announce DescriptiveStats.OBeu v1.2.1 on CRAN!
DescriptiveStats.OBeu
is used on OpenBudgets.eu data mininig tool platform to estimate central tendency and dispersion of numeric variables along with their distributions and correlations and the frequencies of categorical dimensions for budget or expenditure datasets of Municipality across Europe.
The datasets on OpenBudgets.eu are described with the OpenBudgets.eu data model. Detailed documentation about OpenBudgets.eu data model can be found here
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.
First install DescriptiveStats.OBeu
install.packages(DescriptiveStats.OBeu) # or# alternatively install the development version from github
devtools::install_github("okgreece/DescriptiveStats.OBeu")
and load the library
library(DescriptiveStats.OBeu)
open_spending.ds
is designed to estimate and return the basic descriptive measures, correlation, histogram and boxplot parameters of all the numerical variables and the frequencies of all the nominal variables of OpenBudgets.eu datasets.
The input data must be a JSON link that are described with the OpenBudgets.eu 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. 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.
Input | Description |
---|---|
json_data |
The json string, URL or file from Open Spending API |
dimensions |
The dimensions of the input data |
amounts |
The measures of the input data |
measured.dimensions |
The dimensions to which correspond amount/numeric variables |
coef.outl |
Determines the length of the “whiskers” plot. Default is 1.5. |
box.outliers |
If TRUE the outliers will be computed at the selected “coef.outl” level |
box.width |
The width level is determined 0.15 times the square root of the size of the input data. |
cor.method |
The correlation coefficient method to compute: “pearson” (default),“kendall” or “spearman”. |
freq.select |
One or more nominal variables to calculate their corresponding frequencies. |
The output is a list in json format divided into four components of parameters and results with the first subcomponents.
Here is a sort description of these components:
Function | Output | Description |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The dataset we use is available as json link in DescriptiveStats.OBeu package and represents the budget for Wuppertal for 2009 to 2020.
open_spending.ds
function’s input are data as json link and described with OpenBudgets.eu data model.
Wuppertal_openspending
## [1] "http://next.openspending.org/api/3/cubes/4b6d969e07ef7a86aa54e539fc127a14:wuppertalhaushalt/facts"
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)
## {## "descriptives": {## "Min": {
## "Amount": [
## 533.21
## ]
## },
## "Max": {
## "Amount": [
## 2997043.49
## ]
## },
## "Range": {
## "Amount": [
## 2996510.28
## ]
## },
## "Mean": {
## "Amount": [
## 659132.4457
## ]
## },
## "Median": {
## "Amount": [
## 476400.565
## ]
## },
## "Quantiles": {
## "Amount": [
## 313924.26,
## 656962.815
## ]
## },
## "Variance": {
## "Amount": [
## 469375540712.697
## ]
## },
## "StandardDeviation": {
## "Amount": [
## 685109.8749
## ]
## },
## "Kurtosis": [
## 5.7675
## ],
## "Skewness": [
## 2.5221
## ]
## },
## "boxplot": {
## "Amount": {
## "lo.whisker": [
## 533.21
## ],
## "lo.hinge": [
## 306296.49
## ],
## "median": [
## 476400.565
## ],
## "up.hinge": [
## 658308.4
## ],
## "up.whisker": [
## 1185907.2
## ],
## "box.width": [
## 1.5
## ],
## "lo.out": [
##
## ],
## "up.out": [
## 2954238.51,
## 2979998.49,
## 2992244.95,
## 2916160.36,
## 2885816.5,
## 2997043.49,
## 2875275.56,
## 1252420.49,
## 1248584.45
## ],
## "n": [
## 100
## ]
## }
## },
## "histogram": {
## "Amount": {
## "cuts": [
## 0,
## 500000,
## 1000000,
## 1500000,
## 2000000,
## 2500000,
## 3000000
## ],
## "counts": [
## 54,
## 32,
## 7,
## 0,
## 0,
## 7
## ],
## "mean": [
## 659132.4457
## ],
## "median": [
## 476400.565
## ]
## }
## },
## "frequencies": {
## "frequencies": {
## "functional_classification_3.Produktgruppe": [
## {
## "Var1": "",
## "Freq": 2
## },
## {
## "Var1": "(entfallen in 2013) Geschäftsbereichsleitung GB 1.1 ",
## "Freq": 5
## },
## {
## "Var1": "Beschäftigtenvertretung",
## "Freq": 1
## },
## {
## "Var1": "Bezirksvertretungen",
## "Freq": 7
## },
## {
## "Var1": "Geschäftsbereichsleitung GB 1",
## "Freq": 15
## },
## {
## "Var1": "Geschäftsbereichsleitung GB 2.1",
## "Freq": 7
## },
## {
## "Var1": "Geschäftsbereichsleitung GB 2.2",
## "Freq": 7
## },
## {
## "Var1": "Geschäftsbereichsleitung GB 4",
## "Freq": 28
## },
## {
## "Var1": "Gleichstellung von Frau und Mann",
## "Freq": 7
## },
## {
## "Var1": "Politische Gremien",
## "Freq": 7
## },
## {
## "Var1": "Verwaltungsführung",
## "Freq": 14
## }
## ],
## "date_2.Year": [
## {
## "Var1": "2009",
## "Freq": 16
## },
## {
## "Var1": "2010",
## "Freq": 15
## },
## {
## "Var1": "2011",
## "Freq": 14
## },
## {
## "Var1": "2012",
## "Freq": 14
## },
## {
## "Var1": "2013",
## "Freq": 15
## },
## {
## "Var1": "2014",
## "Freq": 13
## },
## {
## "Var1": "2015",
## "Freq": 13
## }
## ]
## },
## "relative.frequencies": {
## "functional_classification_3.Produktgruppe": [
## {
## "Var1": "",
## "Freq": 0.02
## },
## {
## "Var1": "(entfallen in 2013) Geschäftsbereichsleitung GB 1.1 ",
## "Freq": 0.05
## },
## {
## "Var1": "Beschäftigtenvertretung",
## "Freq": 0.01
## },
## {
## "Var1": "Bezirksvertretungen",
## "Freq": 0.07
## },
## {
## "Var1": "Geschäftsbereichsleitung GB 1",
## "Freq": 0.15
## },
## {
## "Var1": "Geschäftsbereichsleitung GB 2.1",
## "Freq": 0.07
## },
## {
## "Var1": "Geschäftsbereichsleitung GB 2.2",
## "Freq": 0.07
## },
## {
## "Var1": "Geschäftsbereichsleitung GB 4",
## "Freq": 0.28
## },
## {
## "Var1": "Gleichstellung von Frau und Mann",
## "Freq": 0.07
## },
## {
## "Var1": "Politische Gremien",
## "Freq": 0.07
## },
## {
## "Var1": "Verwaltungsführung",
## "Freq": 0.14
## }
## ],
## "date_2.Year": [
## {
## "Var1": "2009",
## "Freq": 0.16
## },
## {
## "Var1": "2010",
## "Freq": 0.15
## },
## {
## "Var1": "2011",
## "Freq": 0.14
## },
## {
## "Var1": "2012",
## "Freq": 0.14
## },
## {
## "Var1": "2013",
## "Freq": 0.15
## },
## {
## "Var1": "2014",
## "Freq": 0.13
## },
## {
## "Var1": "2015",
## "Freq": 0.13
## }
## ]
## }
## },
## "correlation": {
##
## }
## }
##
Go to: yourserver/ocpu/test
Copy and paste the following function to the endpoint
../library/DescriptiveStats.OBeu/R/open_spending.ds# library/ {name of the library} /R/ {function}
Post
Click add parameters every time you want to add a new parameters and values.
Define the input data:
json_data
"http://next.openspending.org/api/3/cubes/21260d070eb5d63a121ea4c400dafbbb:apbn_fungsi_2016/facts?pagesize=20"
(or any other json URL with the data)Define the dimensions parameter:
dimensions
"functional_classification_2.Function|functional_classification_2.Code"
Define the amount parameter:
amounts
"Revised"
Likewise, you can add more parameters to change the defaults of coef.outl
, box.outliers
, box.wdth
, cor.method
, see DesciptiveStats.OBeu reference manual for further details.
copy the /ocpu/tmp/{this_id_number}/R/.val (second on the right panel)
finally, paste yourserver/ocpu/tmp/{this_id_number}/R/.val
on a new tab.
Please feel free to make questions, issue reports or pull requests.
Posted 12 April 2021
© 2021 TechTarget, Inc.
Powered by
Badges | Report an Issue | Privacy Policy | Terms of Service
Most Popular Content on DSC
To not miss this type of content in the future, subscribe to our newsletter.
Other popular resources
Archives: 2008-2014 | 2015-2016 | 2017-2019 | Book 1 | Book 2 | More
Most popular articles
You need to be a member of Data Science Central to add comments!
Join Data Science Central