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

Error in import_tps or tps2coo #226

Open
aConar opened this issue Oct 22, 2022 · 5 comments
Open

Error in import_tps or tps2coo #226

aConar opened this issue Oct 22, 2022 · 5 comments

Comments

@aConar
Copy link

aConar commented Oct 22, 2022

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
Copy link
Collaborator

vbonhomme commented Oct 25, 2022 via email

@aConar
Copy link
Author

aConar commented Mar 3, 2023

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

@vbonhomme
Copy link
Collaborator

vbonhomme commented Mar 9, 2023 via email

@aConar
Copy link
Author

aConar commented Mar 9, 2023

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
Copy link
Collaborator

vbonhomme commented Mar 9, 2023 via email

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

2 participants