Skip to content

geocode.R: urlonly parameter does not get passed to single-pass function call via ldply  #207

@janhkoch

Description

@janhkoch

Sorry for omitting a reproducible example, but I think my problem should be understandable from the code below.

I was wondering why a geocode run for many locations and "urlonly = TRUE" was querying Google anyway. To my understanding, it should not. I found out that the reason for this behavior is in lines 122 and 124 of geocode.R. They are currently:

    # geocode ply and out
    if(output == "latlon" || output == "latlona" || output == "more"){
      return(ldply(as.list(location), geocode, output = output, source = source, messaging = messaging, inject = inject))
    } else { # output = all
      return(llply(as.list(location), geocode, output = output, source = source, messaging = messaging, inject = inject))
    }

The ldply call omits the urlonly parameter. Thus, even if the "top-level function" function is called with "urlonly = TRUE", the single-item function call queries the data source.

If I do not understand the urlonly parameter completely wring, I think that section should be:

    # geocode ply and out
    if(output == "latlon" || output == "latlona" || output == "more"){
      return(ldply(as.list(location), geocode, output = output, source = source, messaging = messaging, inject = inject, urlonly = urlonly))
    } else { # output = all
      return(llply(as.list(location), geocode, output = output, source = source, messaging = messaging, inject = inject, urlonly = urlonly))
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions