What's next in googleway: accessors

Due: version 2.4

After a while it gets quite tiresome writing


to access the one piece of information I want from Google's Directions API response.

So I've decided to wirte some "accessor" methods that do the job for me. I've tried to pick the most common elements that I use, but if anyone has other suggestions for elements they'd like quick access to let me know


## until v2.4 is released you'll need the development version

apiKey <- symbolix.utils::apiKey()

## the accessors work on both lists and JSON (defined via the simplify argument)
lst <- google_directions(origin = "Symbolix, Melbourne, Australia",
               destination = "Flinders Street Station, Melbourne"
               key = apiKey,
               simplify = TRUE)

js <- google_directions(origin = "Symbolix, Melbourne, Australia",
               destination = "Flinders Street Station, Melbourne",
               key = apiKey,
               simplify = FALSE)

## calling the function directly
# [1] "rgogFgi~tZjGzBXBAICSRiDNuB^_ ...

# [1] "rgogFgi~tZjGzBXBAICSRiDNuB^_ ... 

## or using the 'access_result' function
access_result(lst, "polyline")
# [1] "rgogFgi~tZjGzBXBAICSRiDNuB^_ ...

For more updates about googleway or any of our open source projects, come and visit us at our github page: https://github.com/SymbolixAU