aphanotus / borealis

An R package for common activities in an integrative biology lab
5 stars 2 forks source link

Error in shape.space example code for PCA ordinations #3

Open ptfreeman07 opened 2 years ago

ptfreeman07 commented 2 years ago

Hi there!

First off -- THANK YOU for your work on this package. It's something I've been looking for for nearly a year and provides a leaps-and-bounds improvement in terms of understandability relative to the momocs packages that I've been fighting with the visualize morphospace PCAs.

I'm currently trying to replicate the visualizations with reference shapes in the shape.space example code but getting a funky error that I'm not sure how to figure out.

The introduction of a reference shape seems to throw things off in this section:

# Plots with example shapes
shape.space(PCA, group = plethodon$species, group.title = 'species', convex.hulls = TRUE,
            backtransform.examples = TRUE,
            ref.shape = Y.gpa$consensus)

where I get an error: Error in M2[links[i, 1], 1] : incorrect number of dimensions

This error seems to go away when you set bt.links = "none" as this section of code works flawlessly

But then when I try to do the TPS visualization using the last set of example code

# Example shapes displaysed as thin-plate spline (TPS) warp grids
shape.space(PCA, group = plethodon$species, group.title = 'species', convex.hulls = TRUE,
            backtransform.examples = TRUE,
            ref.shape = Y.gpa$consensus,
            shape.method = "TPS",
            lm.labels = FALSE)

I get a (potentially?) related error: Error in fast.solve(L) %*% m2[, 1] : non-conformable arguments Can you shed any light on what's happening here? Because I'm having similar issues with my own consensus shapes etc. Thank you!

aphanotus commented 2 years ago

Thank you for the kind words! I believe the error arises from changes that came in with recent updates to R. I confess that I’m focused on other projects right now, but I have an update to borealis and its vignettes on my list for new year. It is encouraging to know people find it helpful!

ptfreeman07 commented 2 years ago

No worries - totally understandable. But it fit the exact need that I had for a reviewer comment and this functionality blows Momocs out of the water. I ended up adapting some code from the StereoMorph package to get a backtransform shape space and combined with your PCA hull output I think I have a great figure!

Patrick T. Freeman B.Sc. '14, M.Sc. '15 | Earth Systems - Stanford University M.Sc. '20 | Ecology and Evolutionary Biology - Brown University pronouns: he/him/his patricktfreeman.com

On Tue, Dec 21, 2021 at 2:28 PM Dave Angelini @.***> wrote:

Thank you for the kind words! I believe the error arises from changes that came in with recent updates to R. I confess that I’m focused on other projects right now, but I have an update to borealis and its vignettes on my list for new year. It is encouraging to know people find it helpful!

— Reply to this email directly, view it on GitHub https://github.com/aphanotus/borealis/issues/3#issuecomment-999137076, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATREBJ2LDGJ4NROR6DF7MIDUSD5RTANCNFSM5KLIIYZA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>