Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

partial display of labels seems not working in biplot function selectLab parameter #76

Open
persicomaria opened this issue Sep 27, 2024 · 0 comments

Comments

@persicomaria
Copy link

Hello I am experiencing the following issue:
I have pca results from a huge dataset but I want to display only a portion of the labels in a scoreplot (p$rotation object); I wiah to display only labels extracted from a clustering procedure so a subset of rownames(p$rotation ) belonging to let say cluster X.

here a toy example (still not working)

data(iris)

Perform PCA on the iris dataset (excluding the species column)

pca_result <- pca(iris[, 1:4], metadata = iris$specie)

Subset of rows to plot (for example: points 1, 50, and 100)

subset_indices <- c(1, 50, 100)

biplot(pca_result,
lab = rownames(iris[, 1:4]), # Pass all labels from the full dataset
selectLab = subset_indices, # Only label the subset of points (indices)
showLoadings = TRUE, # show variable loadings
colby = iris$specie, # Optionally color by metadata column
shape = iris$specie, # Optionally shape by metadata column
pointSize = 5, # Customize point size
legendPosition = 'right')

Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, :
arguments imply differing number of rows: 4, 150

I am working with rstudio associated to R4.4.1 and with latest version of PCA tools
Thanks in advance for your advice. Kind regards, Maria

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant