k_centroids {GSgalgoR} | R Documentation

## Function to calculate the centroids of different groups (classes)

### Description

This function calculates the mean value for each feature of each class to calculate the prototypic centroids of the different groups

### Usage

    k_centroids(data, class)

### Arguments

`data` | a scaled gene expression `matrix` or `data.frame` with samples as columns and features as rows
`class` | a vector with the samples classes

### Value

returns a `data.frame` with the estimated prototypic centroids for each class with the features names as rownames

### Examples

    # load example dataset
    require(iC10TrainingData)
    require(pamr)

    data(train.Exp)

    calculate_distance <- select_distance(distancetype = "pearson")
    Dist <- calculate_distance(train.Exp)
    k <- 4
    Pam <- cluster_algorithm(Dist, k)
    table(Pam$cluster)
    centroids <- k_centroids(train.Exp, Pam)

[Package GSgalgoR version 1.4.0 Index]