MomX / Momocs

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

layer_morphospace_LDA issue #218

Open lrocax opened 3 years ago

lrocax commented 3 years ago

Hi,

What I do wrong with the layer_morphospace_LDA script as I get this error: Error in x$mod.pred$x[, axes] : subscript out of bounds

library(Momocs)

lf <- list.files("C:/Data/outline/", pattern = ".txt$",full.names=TRUE) lf1<-lf_structure(lf, split = "C:/ Data /outline/", trim.extension = FALSE) lf2<-data.frame(substr(lf1$V2, 1, 5)) names(lf2)[1] <- "Type"

coordinates <- import_txt(lf) do <- Out(coordinates, fac = lf2)

do.f <- efourier(do, nb.h=32, norm=TRUE)

do.p <- PCA(do.f)

do.l <- LDA(do.p, ~Type) plot_LDA(do.l) plot_LDA(do.l, 'Type') + layer_morphospace_LDA(do.l)

vbonhomme commented 3 years ago

I m on holidays and afk but i gonna have a look asap.

Le sam. 20 févr. 2021 15:39, Lluis Roca notifications@github.com a écrit :

Hi,

What I do wrong with the layer_morphospace_LDA script as I get this error: Error in x$mod.pred$x[, axes] : subscript out of bounds

library(Momocs)

lf <- list.files("C:/Data/outline/", pattern = ".txt$",full.names=TRUE) lf1<-lf_structure(lf, split = "C:/ Data /outline/", trim.extension = FALSE) lf2<-data.frame(substr(lf1$V2, 1, 5)) names(lf2)[1] <- "Type"

coordinates <- import_txt(lf) do <- Out(coordinates, fac = lf2)

do.f <- efourier(do, nb.h=32, norm=TRUE)

do.p <- PCA(do.f)

do.l <- LDA(do.p, ~Type) plot_LDA(do.l) plot_LDA(do.l, 'Type') + layer_morphospace_LDA(do.l)

— 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/218, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABECQFSAD4VK2ZK24C2ZBBLS77CRVANCNFSM4X553KPQ .

vbonhomme commented 3 years ago

Does type only have two levels ? If so this cannot work :(

Le sam. 20 févr. 2021 15:39, Lluis Roca notifications@github.com a écrit :

Hi,

What I do wrong with the layer_morphospace_LDA script as I get this error: Error in x$mod.pred$x[, axes] : subscript out of bounds

library(Momocs)

lf <- list.files("C:/Data/outline/", pattern = ".txt$",full.names=TRUE) lf1<-lf_structure(lf, split = "C:/ Data /outline/", trim.extension = FALSE) lf2<-data.frame(substr(lf1$V2, 1, 5)) names(lf2)[1] <- "Type"

coordinates <- import_txt(lf) do <- Out(coordinates, fac = lf2)

do.f <- efourier(do, nb.h=32, norm=TRUE)

do.p <- PCA(do.f)

do.l <- LDA(do.p, ~Type) plot_LDA(do.l) plot_LDA(do.l, 'Type') + layer_morphospace_LDA(do.l)

— 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/218, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABECQFSAD4VK2ZK24C2ZBBLS77CRVANCNFSM4X553KPQ .

lrocax commented 3 years ago

I have in the dataset three groups (If you mean two levels as two groups than)

vbonhomme commented 3 years ago

Ok. Gonna have a look next week

Le dim. 21 févr. 2021 20:57, Lluis Roca notifications@github.com a écrit :

I have in the dataset three groups (If you mean two levels as two groups than)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MomX/Momocs/issues/218#issuecomment-782915845, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABECQFS26FVRXSSWRUYIHMTTAFQSRANCNFSM4X553KPQ .

vbonhomme commented 3 years ago

Have you tried :

plot_LDA(do.l, morphospace=T)

Or

plot_LDA(do.l) + layer_morphospace_LDA()

?

Wih plot_LDA you dont have to mention the fac, as its already defined in the LDA call.

Le lun. 22 févr. 2021 11:52, Vincent Bonhomme bonhomme.vincent@gmail.com a écrit :

Ok. Gonna have a look next week

Le dim. 21 févr. 2021 20:57, Lluis Roca notifications@github.com a écrit :

I have in the dataset three groups (If you mean two levels as two groups than)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MomX/Momocs/issues/218#issuecomment-782915845, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABECQFS26FVRXSSWRUYIHMTTAFQSRANCNFSM4X553KPQ .

lrocax commented 3 years ago

I tried plot_LDA(do.l) + layer_morphospace_LDA() and I got this error:

vbonhomme commented 3 years ago

What about plot_LDA(do.l, morphospace=T) ?

Le ven. 5 mars 2021 22:05, Lluis Roca notifications@github.com a écrit :

I tried plot_LDA(do.l) + layer_morphospace_LDA() and I got this error:

  • layer_morphospace_LDA is back, but experimental Error in layer_morphospace_LDA() : argument "x" is missing, with no default

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MomX/Momocs/issues/218#issuecomment-791693388, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABECQFQRY77G5PLEEX73Z3LTCFBRLANCNFSM4X553KPQ .

lrocax commented 3 years ago

I also got an error: