# Using Cluster.OBeu with OpenCPU

# Introduction

This document describes the use of the functions implemented in Cluster.OBeu package in OpenCPU environment, after installing OpenCPU and Cluster.OBeu package on your OpenCPU server address(/ocpu/test).

# How to use functions

- Go to: yourserver/ocpu/test

- Type to the endpoint:

     ../library/ {name of the library} /R/ {function}

- If you want to see the function parameters you should:

  - Select Method: `Get`

- To run a function you should:

  - Select Method: `Post`

- Then you can click on Ajax Request.

# OpenCPU and Cluster.OBeu

## cl.analysis

In this example we will use `cl.analysis` function that returns in a single call a json string or a list with the following components:

`cl.analysis` components
Component | Description
--- | ---
cluster.method | Label of the clustering algorithm
raw.data | Input data
data.pca | Principal components
modelparam | Clustering model specifications
compare | Clustering measures

## Select library and function

1. Go to: yourserver/ocpu/test

2. Copy and paste the following function to the endpoint

    ../library/Cluster.OBeu/R/cl.analysis
    # library/ {name of the library} /R/ {function}

3. Select Method: `Post`

## Adding parameters parameters

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

4. Define the input data:

   - Param Name: `cl.data`
   - Param Value: e.g. `sample_city_data`

5. Define the cluster algorithm parameter:

   - Param Name: `cl.meth`
   - Param Value: `pam`

6. Define the cluster number parameter:

   - Param Name: `clust.numb`
   - Param Value: `3`

For larger datasets you can specify likewise a specific clustering feature (cl_feature), the amounts and the aggregation if needed by defining cl_feature, amount, cl.aggregate parameters, see Cluster.OBeu reference manual for further details.

7. Ready! Click on Ajax request!

## Results

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

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

# Further Details

- HTTP in OpenCPU
- OpenCPU Help
- OpenCPU JavaScript Client
- OpenCPU on CRAN

# Github

- OpenCPU package development version
- Cluster.OBeu package development version