GeoDaCenter / rgeoda

R library for spatial data analysis based on libgeoda and GeoDa
70 stars 13 forks source link

change input parameters of multi-variate lisa in v0.0.4 #4

Closed lixun910 closed 3 years ago

lixun910 commented 4 years ago

in version 0.0.4, there are two multivariate lisa functions:

the second input parameter data is defined as a 2-d array, which one can get using the following code:

data <-as.list(guerry_df[c('Crm_prs','Crm_prp','Litercy','Donatns','Infants','Suicids')])
multigeary <- local_multigeary(queen_w, data)

This is NOT straightforward to R users, and the proposed change is to use a data.frame object instead:

data <- guerry_df[c('Crm_prs','Crm_prp','Litercy','Donatns','Infants','Suicids')]
multigeary <- local_multigeary(queen_w, data)

So, that requires to update the following functions in source code: R/lisa.R https://github.com/lixun910/rgeoda/blob/6f9a62bb003885127027fed0b5d0adfa0690a060/R/lisa.R#L213-L230

and here: https://github.com/lixun910/rgeoda/blob/6f9a62bb003885127027fed0b5d0adfa0690a060/R/lisa.R#L289-L306

The conversion from a data.frame to a 2-d array should be applied within these two functions.

Note: the related Rmd file under vignettes/ directory: rgeoda_tutorial_0_0_4.Rmd and rgeoda_tutorial_0_0_4cn.Rmd should be updated as well.

lixun910 commented 4 years ago

@GISerDaiShaoqing I just assigned this to you. Can you take a look at this? It should be straight forward. Let me know any questions! Thank you very much!

GISerDaiShaoqing commented 4 years ago

@GISerDaiShaoqing I just assigned this to you. Can you take a look at this? It should be straight forward. Let me know any questions! Thank you very much!

I will test the function. If any question, I will contact with you.

lixun910 commented 4 years ago

@GISerDaiShaoqing this is a to-do😄 Thanks and happy holidays!

GISerDaiShaoqing commented 4 years ago

@lixun910 Merry Christmas!

lixun910 commented 4 years ago

@GISerDaiShaoqing Thanks for your pr! I just merged it into V0.0.4 branch.

There are some more things need to be updated as well:

  1. Update the input check of 'data': ncol() should be used here to check the number of columns >= 1

https://github.com/GeoDaCenter/rgeoda/blob/228ce39ac39694727bcbdbbf0aded41da4fee250/R/lisa.R#L224-L226

https://github.com/GeoDaCenter/rgeoda/blob/228ce39ac39694727bcbdbbf0aded41da4fee250/R/lisa.R#L301-L303

  1. Update the doc of input parameter 'data'

https://github.com/GeoDaCenter/rgeoda/blob/228ce39ac39694727bcbdbbf0aded41da4fee250/R/lisa.R#L217

https://github.com/GeoDaCenter/rgeoda/blob/228ce39ac39694727bcbdbbf0aded41da4fee250/R/lisa.R#L294

e.g. A data.frame with selected variables

(First, sync your GISerDaiShaoqing:V.0.0.4 branch with upstream GeoDaCener/rgeoda:V0.0.4 branch see: https://help.github.com/en/desktop/contributing-to-projects/syncing-your-branch)

After update the doc, regenerate the Rd doc under man/ directory using Roxygen (in Rstudio, Build->Document).

Thanks!

Xun

GISerDaiShaoqing commented 4 years ago

@lixun910 I updated the input check of 'data' and the doc of input parameter 'data'. First of all, I sync my GISerDaiShaoqing: V0.0.4 branch with upstream GeoDaCenter/rgeoda V0.0.4 branch. Then I updated the input check of 'data', the doc of input parameter 'data', and regenerated the Rd doc. Thank you for your help.

lixun910 commented 4 years ago

@GISerDaiShaoqing Great! Thank you very much! Can you also send a pull request to GeoDaCenter/rgeoda:V0.0.4 , so I can merge the changes you made.

GISerDaiShaoqing commented 4 years ago

@lixun910 I send a new pull request to GeoDaCenter/rgeoda: V0.04, but I found that I pushed the code and update doc directly to the GeoDaCenter/rgeoda: V0.04 yesterday. I'm sorry. Now I have synced my GISerDaiShaoqing: master branch with upstream GeoDaCenter/rgeoda: V0.04 branch, and send a pull request of this branch to GeoDaCenter/rgeoda: V0.04 branch. Thank you very much.