as.matrix.transport.plan: Transform transportation plan to transportation matrix

View source: R/transport_plan.R

as.matrix.transport.planR Documentation

Transform transportation plan to transportation matrix

Description

Transform transportation plan to transportation matrix

Usage

## S3 method for class 'transport.plan'
as.matrix(x, ...)

Arguments

x

An object of class 'transport.plan'. See output of (transport_plan)[transport_plan()]

...

Unused arguments

Value

A matrix specifying the minimal joint distribution between samples. Margins will be equal to the marginal distributions of the samples

Examples

set.seed(203987)
n <- 5
d <- 2
x <- matrix(rnorm(d*n), nrow=d, ncol=n)
y <- matrix(rnorm(d*n), nrow=d, ncol=n)
#get hilbert sort orders for x in backwards way
trans_plan <- transport_plan(X=x, Y=x, ground_p = 2, p = 2, 
                         observation.orientation =  "colwise", 
                         method = "hilbert")
trans_matrix <- as.matrix(trans_plan)
print(trans_matrix)

approxOT documentation built on May 29, 2024, 3:12 a.m.