View source: R/transport_plan.R
as.matrix.transport.plan | R Documentation |
Transform transportation plan to transportation matrix
## S3 method for class 'transport.plan'
as.matrix(x, ...)
x |
An object of class 'transport.plan'. See output of (transport_plan)[transport_plan()] |
... |
Unused arguments |
A matrix specifying the minimal joint distribution between samples. Margins will be equal to the marginal distributions of the samples
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.