odb_params: Convert query parameters

Description Usage Arguments Details Value Examples

View source: R/utils.R

Description

A convenience helper to transform R named lists to HTML syntax.

Usage

1
odb_params(params = list(), encode = TRUE)

Arguments

params

named list or character string.

encode

logical. Should the strings be encoded to URL scheme?

Details

This is normally used inside the getter functions. Note that if this function receives an unnamed character string, it returns the same string. This can be used to construct more complex queries.

The 'encode' parameter is used to encode the parameter list, replacing special symbols with their corresponding hexadecimal representation so they can be used as an URL. For instance, 'CapĆ£o da Canoa' would be encoded as 'Cap so if you call odb_params using a literal string, these will be ignored. If you need to run a query using these symbols (such as if your locality name contains a &), you will need to use the list version of this function. See the help on URLencode for the underlying encoding function.

Value

character

Examples

1
2
odb_params(list(level=210, valid=TRUE))
odb_params("search=edulis")

opendatabio/opendatabio-r documentation built on Sept. 27, 2021, 1:32 a.m.