dist_mass_dataset: dist_mass_dataset

View source: R/dist_cor.R

dist_mass_datasetR Documentation

dist_mass_dataset

Description

dist_mass_dataset

Usage

dist_mass_dataset(
  x,
  margin = c("variable", "sample"),
  method = c("euclidean", "maximum", "manhattan", "canberra", "binary", "minkowski"),
  diag = FALSE,
  upper = FALSE,
  p = 2
)

Arguments

x

mass_dataset class

margin

sample or variable

method

the distance measure to be used. This must be one of "euclidean", "maximum", "manhattan", "canberra", "binary" or "minkowski". Any unambiguous substring can be given.

diag

logical value indicating whether the diagonal of the distance matrix should be printed by print.dist.

upper

logical value indicating whether the upper triangle of the distance matrix should be printed by print.dist.

p

The power of the Minkowski distance.

Value

dist returns an object of class "dist".

Author(s)

Xiaotao Shen shenxt1990@outlook.com

Examples

library(massdataset)
library(magrittr)
data("expression_data")
data("sample_info")
data("sample_info_note")
data("variable_info")
data("variable_info_note")
object =
  create_mass_dataset(
    expression_data = expression_data,
    sample_info = sample_info,
    variable_info = variable_info,
    sample_info_note = sample_info_note,
    variable_info_note = variable_info_note
  )
object
x =
  object %>%
  log(2) %>%
  scale()
variable_distance <-
  dist_mass_dataset(x = x, margin = "variable")
head(as.matrix(variable_distance)[, 1:5])
sample_distance <-
  dist_mass_dataset(x = x, margin = "sample")
head(as.matrix(sample_distance)[, 1:5])

jaspershen/massstat documentation built on March 14, 2024, 7:02 p.m.