MomX / Momocs

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

Error in import_tps or tps2coo #226

Open aConar opened 1 year ago

aConar commented 1 year ago

Hi, first thanks for this great package!. I got some outlines using tpsDig and saved as tps file. When trying to import the tps file into R using import_tps or tps2coo I get the following errors:

import_tps( "Contornos.tps")
Error in if (!cond_to_pass) stop(msg_if_not, call. = FALSE) : 
  the condition has length > 1
Además: Warning message:
In 1:coo.nb : numerical expression has 2 elements: only the first used

and when using tps2coo:

tps2coo( "Contornos.tps")
Error in 1:coo.nb : Argumento NA/NaN
Además: Warning message:
In tps2coo("Contornos.tps") : NAs introducidos por coerción

I have used Momocs and tpsDig before without problems. I followed the same steps but no luck to make it import the tps file. Thanks in advance! Kind regards,

Ale

vbonhomme commented 1 year ago

hi there,

probably a stupid bug in the way ;-) could you please send me the tps? @.***

dont promise anything but I'll try to have a look before mid nov. If I dont, ring this thread !

Le sam. 22 oct. 2022 à 22:01, aConar @.***> a écrit :

Hi, first thanks for this great package!. I got some outlines using tpsDig and saved as tps file. When trying to import the tps file into R using import_tps or tps2coo I get the following errors:

import_tps( "Contornos.tps")

Error in if (!cond_to_pass) stop(msg_if_not, call. = FALSE) :

the condition has length > 1

Además: Warning message:

In 1:coo.nb : numerical expression has 2 elements: only the first used

and when using tps2coo:

tps2coo( "Contornos.tps")

Error in 1:coo.nb : Argumento NA/NaN

Además: Warning message:

In tps2coo("Contornos.tps") : NAs introducidos por coerción

I have used Momocs and tpsDig before without problems. I followed the same steps but no luck to make it import the tps file. Thanks in advance! Kind regards,

Ale

— Reply to this email directly, view it on GitHub https://github.com/MomX/Momocs/issues/226, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABECQFRYKSD3OZIQONQ6IDTWERBZVANCNFSM6AAAAAARL7I5LE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- vincentbonhomme.fr http://www.vincentbonhomme.fr cevennette.fr https://www.cevennette.fr 🌱

aConar commented 1 year ago

Dear Vincent, I'm check-in if there was any news on import_tps. Thanks! Ale

vbonhomme commented 1 year ago

so far nope but I'll try. I'm so under snow with consulting and my other activity that I struggle to find time to do some Momocs. I would like to find funding and block like 6 months of dev on it and tackle the mountain of little things !

Le ven. 3 mars 2023 à 18:37, aConar @.***> a écrit :

Dear Vincent, I'm check-in if there was any news on import_tps. Thanks! Ale

— Reply to this email directly, view it on GitHub https://github.com/MomX/Momocs/issues/226#issuecomment-1453872752, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABECQFR2KVG756SASJWU45DW2IT7BANCNFSM6AAAAAARL7I5LE . You are receiving this because you commented.Message ID: @.***>

-- vincentbonhomme.fr http://www.vincentbonhomme.fr cevennette.fr https://www.cevennette.fr 🌱

aConar commented 1 year ago

Hi Vincent, don't worry! I have debugging a little and I found the the error happens when calling this helper function in tps2coo:

.check(nrow(coo) == coo.nb, "the number of landmarks seems to differ from LM=")

I commented that line and works fine but with warnings, also from tps2coo in this line:

coo <- tps[1:coo.nb] %>% lines2shp()

Since coo.nb is a numeric vector of many numbers, only the first one is used. So I changed to

coo <- tps[1:coo.nb[1]] %>% lines2shp()

And all warning were gone. This was a dirty and fast workaround but I didn't dig for lateral effects! Hope it hepls! Kind regards, Ale

vbonhomme commented 1 year ago

you're amazing. if I find a pile of gold for the dev, I'll wait for your CV on my desk ;-)

Le jeu. 9 mars 2023 à 20:58, aConar @.***> a écrit :

Hi Vincent, don't worry! I have debugging a little and I found the the error happens when calling this helper function in tps2coo:

.check(nrow(coo) == coo.nb, "the number of landmarks seems to differ from LM=")

I commented that line and works fine but with warnings, also from tps2coo in this line:

coo <- tps[1:coo.nb] %>% lines2shp()

Since coo.nb is a numeric vector of many numbers, only the first one is used. So I changed to

coo <- tps[1:coo.nb[1]] %>% lines2shp()

And all warning were gone. This was a dirty and fast workaround but I didn't dig for lateral effects! Hope it hepls! Kind regards, Ale

— Reply to this email directly, view it on GitHub https://github.com/MomX/Momocs/issues/226#issuecomment-1462689634, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABECQFSZNAO4KSMRBLNI2W3W3IY6RANCNFSM6AAAAAARL7I5LE . You are receiving this because you commented.Message ID: @.***>

-- vincentbonhomme.fr http://www.vincentbonhomme.fr cevennette.fr https://www.cevennette.fr 🌱