# NOT RUN {
library(tibble)
df <- tibble(id = 1:3,
locations = c("Nantes", "Hamburg", "Los Angeles"))
# Return lat, lng, and formatted address
oc_forward_df(df, placename = locations)
# Return more detailed information about the locations
oc_forward_df(df, placename = locations, output = "all")
# Do not column bind results to input data frame
oc_forward_df(df, placename = locations, bind_cols = FALSE)
# Add more results by changing the limit from the default of 1.
oc_forward_df(df, placename = locations, limit = 5)
# Restrict results to a given bounding box
oc_forward_df(df, placename = locations,
bounds = oc_bbox(-5, 45, 15, 55))
# oc_forward_df accepts unquoted column names for all
# arguments except bind_cols and output.
# This makes it possible to build up more detailed queries
# through the data frame passed to the data argument.
df2 <- add_column(df,
bounds = oc_bbox(xmin = c(-2, 9, -119),
ymin = c(47, 53, 34),
xmax = c(0, 10, -117),
ymax = c(48, 54, 35)),
limit = 1:3,
countrycode = c("ca", "us", "co"),
language = c("fr", "de", "en"))
# Use the bounds column to help return accurate results and
# language column to specify preferred language of results
oc_forward_df(df2, placename = locations,
bounds = bounds,
language = language)
# Different limit of results for each placename
oc_forward_df(df2, placename = locations,
limit = limit)
# Specify the desired results by the countrycode column
oc_forward_df(df2, placename = locations,
countrycode = countrycode)
# }
Run the code above in your browser using DataLab