pcl.tsne | R Documentation |
This function performs t-Distributed Stochastic Neighbor Embedding (t-SNE) ordination on the input data or distance matrix.
pcl.tsne(
dat,
D = NA,
as = FALSE,
asinsqrt = as,
index = "bray/curtis",
k = 2,
seed = 1234
)
dat |
A list containing at least an element 'x' which is the data matrix. |
D |
Distance matrix. If NA, it will be computed from dat$x. Default is NA. |
as |
Logical. If TRUE, performs arcsine transformation (deprecated parameter). Default is FALSE. |
asinsqrt |
Logical. If TRUE, performs arcsine square root transformation. Default is the value of 'as'. |
index |
Character string specifying the distance index to use when computing D. Default is "bray/curtis". |
k |
Integer. The number of dimensions for t-SNE. Must be at least 2. Default is 2. |
seed |
Integer. Random seed for reproducibility. Default is 1234. |
The function first checks if a distance matrix D is provided. If not, it computes the distance matrix from the input data using the specified index. If asinsqrt is TRUE, the data is transformed using an arcsine square root transformation before computing distances. The t-SNE algorithm is then applied to the distance matrix.
A list containing two elements:
points |
A matrix of t-SNE coordinates |
ordnames |
A character vector of dimension names |
This function requires the 'tsne' and 'labdsv' packages.
## Not run:
data <- list(x = matrix(rnorm(1000), ncol = 10))
rownames(data$x) <- paste0("Sample", 1:100)
result <- pcl.tsne(data, k = 3)
plot(result$points[, 1], result$points[, 2], main = "t-SNE plot")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.