MomX / Momocs

:dove: Morphometrics using R
http://momx.github.io/Momocs/
51 stars 18 forks source link

filter and subset don't work on PCA objects #198

Closed rkriebel closed 6 years ago

rkriebel commented 6 years ago

These functions were working fine on PCA objects until the latest version Momocs_1.2.9.2

vbonhomme commented 6 years ago

I will fix it but it's not a good idea anyway to filter on PCA. And to use subset/subsetize, more generally.

2018-06-19 22:02 GMT+02:00 Ricardo Kriebel notifications@github.com:

These functions were working fine on PCA objects until the latest version Momocs_1.2.9.2

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/MomX/Momocs/issues/198, or mute the thread https://github.com/notifications/unsubscribe-auth/AEgoFomBXxdJmi5c-CWCfDEvPpECnqFnks5t-VjXgaJpZM4UuJax .

-- vincentbonhomme.fr http://www.vincentbonhomme.fr

rkriebel commented 6 years ago

Thanks! I use subset to be able to pass a specific group by the get_chull_area function to calculate morphospace occupation of that group. Not sure how else to do it.

rkriebel commented 6 years ago

I see I can pull out all groups at once in get_chull_area so that should not be a problem. The other use I had for subset was to be able to include the outgroup species for downstream analyses matching a phylogeny but also be able to remove them for a morphospace of just the focal clade. Thanks again for your help.

vbonhomme commented 6 years ago

Id say as_df on your PCA then regular df handling ?

Le 20 juin 2018 à 02:01, Ricardo Kriebel notifications@github.com a écrit :

I see I can pull out all groups at once in get_chull_area so that should not be a problem. The other use I had for subset was to be able to include the outgroup species for downstream analyses matching a phylogeny but also be able to remove them for a morphospace of just the focal clade. Thanks again for your help.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

rkriebel commented 6 years ago

That works for matching with the tree but what I was also doing is removing the sister group and plotting the morphospace without it. The df doesn't allow that so the general question is how to remove a group and plot the morphospace without it. I was doing this: subset(pca_res, !pca_res$fac$clade=="sister")

vbonhomme commented 6 years ago

Filter on the Coe, then pca then whatever you like. You should not filter your PCA calculated on a larger set of individuals!

Le 20 juin 2018 à 18:32, Ricardo Kriebel notifications@github.com a écrit :

That works for matching with the tree but what I was also doing is removing the sister group and plotting the morphospace without it. The df doesn't allow that so the general question is how to remove a group and plot the morphospace without it. I was doing this: subset(pca_res, !pca_res$fac$clade=="sister")

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

rkriebel commented 6 years ago

I have like 10 specimens out of 411 I want to remove and they fall within the range of variation of the rest of specimens. Since the possibility of subsetting the PCA was available in Momocs, I used it. I will take your advice and stop doing so.

rkriebel commented 6 years ago

One thing that would help a lot in general and I can't figure out is to give a transparent color to colorRampPalette like you showed me to apply colors with the current version. In the example below the third group would be hidden. I tried with library scales to give a fully transparent "color" but it gives an error.

plot_PCA(pca_res, ~clade, palette=colorRampPalette(c("orange","purple", "transparent")))

vbonhomme commented 6 years ago

I know. Not exemplified and shouldbe easier but you still can go with pal_alphai guess

Le 20 juin 2018 à 23:26, Ricardo Kriebel notifications@github.com a écrit :

One thing that would help a lot in general and I can't figure out is to give a transparent color to colorRampPalette like you showed me to apply colors with the current version. In the example below the third group would be hidden. I tried with library scales to give a fully transparent "color" but it gives an error.

plot_PCA(pca_res, ~clade, palette=colorRampPalette(c("orange","purple", "transparent")))

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

vbonhomme commented 6 years ago

Dont ecactly remember but thats possibly the reasowhy i removed it ;)

Le 20 juin 2018 à 23:08, Ricardo Kriebel notifications@github.com a écrit :

I have like 10 specimens out of 411 I want to remove and they fall within the range of variation of the rest of specimens. Since the possibility of subsetting the PCA was available in Momocs, I used it. I will take your advice and stop doing so.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

vbonhomme commented 6 years ago

if everything goes fine you gonna hva an example on how to highlight there: https://momx.github.io/Momocs/reference/plot_PCA.html

vbonhomme commented 6 years ago

plus filtering on PCA is back