Skip to content

Improve scaling function #7

@njohnso6

Description

@njohnso6

See gitlab commit entitled "Improved Scaling Function". Essentially, not only can the scaling function be vectorized, but the heatmap function can be passed any function for normalizing.
This is the function that should be used to normalize:
normalize <- function(x) {
x <- as.matrix(x)
minAttr=apply(x, 1, min)
maxAttr=apply(x, 1, max)
x <- sweep(x, 1, minAttr, FUN="-")
x=sweep(x, 1, maxAttr-minAttr, "/")

return (x)
}
Taken from Lui Kimman (https://stats.stackexchange.com/users/77829/lui-kimman), How to normalize data to 0-1 range?, URL (version: 2015-05-22): https://stats.stackexchange.com/q/153544
Modified to go by row instead of column.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions