dr: dr

View source: R/dr.R

drR Documentation

dr

Description

dimensional reduction

Usage

dr(data, fun, ...)

Arguments

data

input data

fun

function to perform dimensional reduction

...

additional parameters passed to 'fun'

Details

This function call the user-provided function ('fun') to perform dimensional reduction on the input data ('data')

sample_info is an optional list that a dr_extract() method may return alongside the coordinates. It is meant to carry method-specific, per-sample information (e.g. local density, k-nearest-neighbour indices or cluster labels). Every element of sample_info that holds one value per sample – a vector or factor of length nrow(data) – is merged into the data.frame returned by fortify(), using the element name as the column name, so that it can be mapped in autoplot(). Elements that do not hold one value per sample, and elements whose name is already taken by a coordinate or a metadata column, are not merged and a warning is issued. None of the dr_extract() methods shipped with the package returns a sample_info element, so sample_info is NULL unless a custom dr_extract() method supplies one.

Value

a DrResult object, which contains 'data' (original data), 'drdata' (coordination after dimensionality reduction), eigenvalue (standard deviation explained by each dimension), stress (evaluate the effect of dimensionality reduction) and 'sample_info' (method-specific additional information, see Details)

Author(s)

Guangchuang Yu

Examples

x = dr(iris[,1:4], prcomp)
autoplot(x, aes(color=.group), metadata=iris$Species)

tidydr documentation built on Oct. 9, 2026, 5:07 p.m.