umap() produces matrix instead of S3 object
Closed this issue · 2 comments
I have a data frame, b, with 21 sample rows and 1789 uniquely-names gene rows.
> class(b)
[1] "data.frame"
> ncol(b)
[1] 1789
> nrow(b)
[1] 21
umap runs without error or warning. I think that umap is supposed to generate an S3 object, but I only get a 2-column matrix with coordinates. This is fine for generating the plot, but I wanted to extract other information from layout. Any suggestions? Thanks!
> um<-umap(b,n_neighbors = 10)
> class(um)
[1] "matrix"
> nrow(um)
[1] 21
> ncol(um)
[1] 2
Hi @umasstr. Yes, the output is supposed to be an S3 object. If you are getting a matrix, is it possible that you loaded package uwot
after loading package umap
? (Package uwot
performs dimensional reduction in a similar way, but it has slightly different features and API.) If that's the case, and if you want to keep using both packages in the same R session, you can still run umap from this package by calling umap::umap(b)
.
Wow, I wouldn't have thought of that. All set—runs quickly and without error or warning.
Thanks, and happy holidays!