buildClusteringSample: Clustering loading

View source: R/sampleClustering.R

buildClusteringSampleR Documentation

Clustering loading

Description

Load a clustering result from a csv file into a data.sample object.

Usage

buildClusteringSample(filename.csv, data.sample, noise.cluster = "Noise")

Arguments

filename.csv

character vector specifying the path and the name of the csv file containing the clustering result.

data.sample

matrix of raw data (point by line).

noise.cluster

character name of the cluster "Noise".

Details

buildClusteringSample builds a clustering result from a csv file to be later embedded into a data.sample object

Value

The function returns a list 'clustering' containing:

label

vector of labels.

summary

data.frame containing clusters summaries (min, max, sum, average, sd).

K

number of clusters.

See Also

saveClustering

Examples

dat <- rbind(matrix(rnorm(100, mean = 0, sd = 0.3), ncol = 2), 
             matrix(rnorm(100, mean = 2, sd = 0.3), ncol = 2), 
             matrix(rnorm(100, mean = 4, sd = 0.3), ncol = 2))
tf1 <- tempfile()
write.table(dat, tf1, sep=",", dec=".")
x <- importSample(file.features=tf1)

lab <- data.frame(ID=1:nrow(dat), label=c(rep("Cluster 1",50), rep("Cluster 2",50), 
                                          rep("Cluster 3",50)))
tf2 <- tempfile()
write.table(lab, tf2, sep=",")

clustering <- buildClusteringSample(tf2, x)


RclusTool documentation built on May 29, 2024, 5:23 a.m.