JeremyGelb / spNetwork

An R package to perform spatial analysis on networks.
GNU General Public License v2.0
34 stars 2 forks source link

Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function 'coordnames': subscript out of bounds #6

Closed joshilpa-cg closed 2 years ago

joshilpa-cg commented 2 years ago

Getting this error when using nkde function

JeremyGelb commented 2 years ago

Hello ! Thank you for your interest in spNetwork. To be able to help you I need to know : What version of spNetwork are you using ? The exact code you are using (from data loading to the line with the error). And the data you are using (what type of file and if possible a sample). If your bug is not a simple error in the package use, I will probably need a minimal example with a sample of data to reproducd it.

joshilpa-cg commented 2 years ago

Hi Jeremy

Thank you for following up with me. The error was due to mismatch in the sample data and the network data passed to the function, and I have identified and made corrections to my code post which the function worked.

I am now trying to run the local Moran code. There seems to be some error in the code locmoran <- localmoran(lixels$continuous_density, listw = listw)

Error in cut.default(lx, c(-Inf, lxx, Inf), labels = lbs): lengths of 'breaks' and 'labels' differ

This if for the Montreal bike accidents code listed in the document RJ-2021-102.pdf spNetwork: A Package for Network Kernel Density Estimation

After setting zero.policy=T, the lomoran function worked.

One more error in the code is in the function for the adaptive bandwidth where palette = pal pal being undefined.

Hope this helps.

Thanks & Regards Shilpa Joshi

On Fri, Apr 15, 2022 at 4:50 PM JeremyGelb @.***> wrote:

Hello ! Thank you for your interest in spNetwork. To be able to help you I need to know : What version of spNetwork are you using ? The exact code you are using (from data loading to the line with the error). And the data you are using (what type of file and if possible a sample). If your bug is not a simple error in the package use, I will probably need a minimal example with a sample of data to reproducd it.

— Reply to this email directly, view it on GitHub https://github.com/JeremyGelb/spNetwork/issues/6#issuecomment-1100048244, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWX4G5F57KRVQIP4NG3TLS3VFFGJDANCNFSM5TP4RP4A . You are receiving this because you authored the thread.Message ID: @.***>

JeremyGelb commented 2 years ago

Hello !

It is great that you managed to resolve your first issue. Let me clarify some points:

  1. localmoran is not a part of spNetwork. If you have an error or a bug with this specific function, I am powerless.
  2. Error in cut.default(lx, c(-Inf, lxx, Inf), labels = lbs) is VERY likely related to a mapping function and again is not related to spNetwork
  3. pal being undefined means that the object pal is not defined in your environment, you probably missed a line of code somewhere.

Once again, I can not really help for debugging if you post here only some little part of code and error messages. Please consider providing the FULL code leading to the error. Moreover, this is not the right place for trouble shouting error which are not caused by spNetwork (like pal being undefined or cut.default(lx, c(-Inf, lxx, Inf), labels = lbs)).

joshilpa-cg commented 2 years ago

Hi

I am only able to share the network data I am using. and the co-ordinates which I am using for my study. If that works, I will send this information to you.

Please let me know your interest in solving these issues. As I will not be able to share the data I am using and it will require some effort on your part to create the events for the network. I do foresee that I have to use this package as it is the only one so far that can be used for network analysis. This effort is a commitment to bring a very useful package to the Data Science community. Hence the case.

I also want to know how the network distance is calculated. What exactly is snapping the events to the network? If you can share a relevant document.

You seem to have misread my mail. I have written it as the code that is included in the paper written by you resulted in errors. Wrt. pt.3 , it is not I who has missed the declaration. However, it is a trivial point and I don't want to elaborate any further on this.

The adaptive bandwidth function is crashing for my network.

That is a very lengthy mail. Thank you for taking the time to read it so far.

Once again, thank you for the spNetwork package, it seems to be very useful.

Thanks & Regards Shilpa Joshi.

On Tue, Apr 19, 2022 at 7:02 PM JeremyGelb @.***> wrote:

Hello !

It is great that you managed to resolve your first issue. Let me clarify some points:

  1. localmoran is not a part of spNetwork. If you have an error or a bug with this specific function, I am powerless.
  2. Error in cut.default(lx, c(-Inf, lxx, Inf), labels = lbs) is VERY likely related to a mapping function and again is not related to spNetwork
  3. pal being undefined means that the object pal is not defined in your environment, you probably missed a line of code somewhere.

Once again, I can not really help for debugging if you post here only some little part of code and error messages. Please consider providing the FULL code leading to the error. Moreover, this is not the right place for trouble shouting error which are not caused by spNetwork (like pal being undefined or cut.default(lx, c(-Inf, lxx, Inf), labels = lbs)).

— Reply to this email directly, view it on GitHub https://github.com/JeremyGelb/spNetwork/issues/6#issuecomment-1102661533, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWX4G5ESRBXXSGID56B25UDVF2YVTANCNFSM5TP4RP4A . You are receiving this because you authored the thread.Message ID: @.***>

JeremyGelb commented 2 years ago

Dear Shilpa Joshi.

Thank you again for your interest in spNetwork.

I do not have the time to generate some data myself and test your network, but if you can provide me a sample of data and the code producing the error, I would be happy to help.

I have an idea about what could cause the error. The code in the paper is based on a previous version of spNetwork (0.2.1) and the new version on github (0.4.x) is now using the sf library rather than sp (because of rgdal and rgeos deprecation). Please consider installing the latest version (remotes::install_github(JeremyGelb/spNetwork)) and retry with the examples provided on the website of the package : https://jeremygelb.github.io/spNetwork/

About the network distance, it depends on the function you are using. If you are using nkde like functions, it is a distance in meters along the network.

Snapping means projecting the points exactly on the lines of the network (on the nearest line).

JeremyGelb commented 2 years ago

Dear Shilpa Joshi,

have you been able to conduct your analysis? In that case, I would close this issue. Otherwise, Have you tried with the new version of spNetwork available on CRAN or github?

joshilpa-cg commented 2 years ago

Hi Jemery

Regret the delay in replying.

Ok as of now.

Thanks Shilpa

On Fri, May 20, 2022 at 7:00 PM JeremyGelb @.***> wrote:

Closed #6 https://github.com/JeremyGelb/spNetwork/issues/6 as completed.

— Reply to this email directly, view it on GitHub https://github.com/JeremyGelb/spNetwork/issues/6#event-6650734239, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWX4G5HQAVWOHGKFL7ZTGO3VK6HYVANCNFSM5TP4RP4A . You are receiving this because you authored the thread.Message ID: @.***>