Cluster analysis in

Cluster.OBeu is used on data mininig tool platform with OpenCPU integration of R and JavaScript to estimate and return the necessary parameters for cluster analysis visualizations for budget or expenditure datasets of Municipality across Europe.

The vignette shows the way Cluster.OBeu (in R and OpenCPU environment) is fitted with datasets of according to the data model. Detailed documentation about data model can be found here

The input and the resulted object are in json format.

First you have to load the library

# load Cluster.OBeu

Cluster analysis on platform is designed to estimate and return the clustering model measures of datasets.

The available clustering algorithms are hierarchical, kmeans from R base, pam, clara, fuzzy from cluster package and model based algorithms from mclust package. It can be used to find the appropriate clustering algorithm and/or the appropriate clustering number of the input data according to the internal and stability measures from clValid package.

The input data must be a JSON link according to the 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. estimates and returns the json data that are described with the data model, using cl.analysis function. input
Input Description
json_data The json string, URL or file from Open Spending API
dimensions The dimensions of the input data
amounts The amounts of the input data
measured.dimensions The dimensions to which correspond amount/numeric variables
cl.aggregate Aggregate function of the input data
cl.method clustering algorithm
cl.num Number of clusters
cl.dist Distance metric

The following table shows a sort description of the return components: return
Component Description
cluster.method Label of the clustering algorithm Input data
data.pca Principal components
modelparam Clustering model specifications
compare Clustering measures


The dataset in the following example is being used in platform and concerns the income of Aragon. in 2007.

In R environment function’s input are data as json link and described with data model.

In OpenCPU environment

Select library and function

  1. Go to: yourserver/ocpu/test

  2. Copy and paste the following function to the endpoint

  1. Select Method: Post

Add parameters

Click add parameters every time you want to add a new parameters and values.

  1. Define the input data:

    • Param Name: json_data
    • Param Value (URL of json data): "" (or any other json URL with the data)
  2. Define the dimensions parameter:

    • Param Name: dimensions
    • Param Value: "economicClassification.prefLabel"
  3. Define the amount parameter:

    • Param Name: amounts
    • Param Value: "amount.sum"
  4. Define the measured dimension parameter:

    • Param Name: measured.dimensions
    • Param Value: "fundingClassification.prefLabel"

You add likewise further parameters and change the default parameters of cl.method, cl.num, cl.dist, see Cluster.OBeu reference manual for further details.

  1. Ready! Click on Ajax request!


  1. copy the /ocpu/tmp/{this_id_number}/R/.val (second on the right panel)

  2. finally, paste yourserver/ocpu/tmp/{this_id_number}/R/.val on a new tab.

Further Details