Using revgeocode function in a FOR loop. Help required

后端 未结 1 662
我寻月下人不归
我寻月下人不归 2021-01-22 16:40

My problem is as detailed below:

My input data is of the format as given in the small example below:

USERID  LONGITUDE   LATITUDE 
1            -8.7965         


        
相关标签:
1条回答
  • 2021-01-22 17:08

    No need to use a for-loop here. I recommand you to use lapply to avoid side effect, and pre-allocate problems:

        locaddr <- lapply(seq(nrow(location)), function(i){ 
               revgeocode(location[i,], 
                             output = c("address"), 
                             messaging = FALSE, 
                             sensor = FALSE, 
                             override_limit = FALSE)
                  })
    
    0 讨论(0)
提交回复
热议问题