clumerge {clugenr}R Documentation

Merges the fields (specified in fields) of two or more data sets

Description

Merges the fields (specified in fields) of two or more data sets (passed as lists). The fields to be merged need to have the same number of columns. The corresponding merged field will contain the rows of the fields to be merged, and will have a common "supertype".

Usage

clumerge(..., fields = c("points", "clusters"), clusters_field = "clusters")

Arguments

...

One or more cluster data sets (in the form of lists) whose fields are to be merged.

fields

Fields to be merged, which must exist in the data sets given in ....

clusters_field

Field containing the integer cluster labels. If specified, cluster assignments in individual datasets will be updated in the merged dataset so that clusters are considered separate.

Details

The clusters_field parameter specifies a field containing integers that identify the cluster to which the respective points belongs to. If clusters_field is specified (by default it's specified as "clusters"), cluster assignments in individual datasets will be updated in the merged dataset so that clusters are considered separate. This parameter can be set to NA, in which case no field will be considered as a special cluster assignments field.

This function can be used to merge data sets generated with the clugen function, by default merging the points and clusters fields in those data sets. It also works with arbitrary data by specifying alternative fields in the fields parameter. It can be used, for example, to merge third-party data with clugen-generated data.

Value

A list whose fields consist of the merged fields in the original data sets.

Examples

a <- clugen(2, 5, 100, c(1, 3), 0.5, c(10, 10), 8, 1.5, 2)
b <- clugen(2, 3, 250, c(-1, 3), 0.5, c(13, 14), 7, 1, 2)
ab <- clumerge(a, b)

[Package clugenr version 1.0.3 Index]