get_records: fetch dataset records

Description Arguments Details Examples

Description

This method is used to retrieve records for a specific dataset. If the number of rows to return is higher than the maximum allowed by the search API (see the constants section in fodr), the download API is used.

Arguments

nrows

an integer, indicates the number of records to fetch (defaults to 10)

refine

a named list

exclude

a named list

sort

a character

q

a character, used to do full-text search

lang

a character, the language used in the q parameter

geofilter.distance

a numeric vector of three elements in the (latitude, longitude, distance (in meters)) format (e.g. c(48.57, 2.24, 500))

geofilter.polygon

a data.frame with two columns named lat and lon

debug

a logical, if TRUE, prints the url sent to the portal

quiet

a logical, if FALSE, information will be printed when using the download API

Details

refine and exclude, if set, must be named lists where the names are the facets to use and the values of the list, the values to pick or exclude. For example, if a dataset has the type_dossier facet and you want to keep only the DP types, you should set refine = list(type_dossier = "DP").

sort takes a character in the sortables element of the dataset and sorts the results according to its value. Add a - in front in order to sort in descending order (e.g. sort = "-commune").

q is used to perform a full text-search in all elements of the dataset. To search for all records containing the word "Paris", use q = "Paris". See here for more information.

lang can be set to use language-specific functions on the elements passed to the q parameter but is not implemented yet.

geofilter.distance can be used to retrieve only the records that are within the specified distance from the specified point, if applicable.

geofilter.polygon can be used to retrieve only the records that are within the specified polygon, if applicable.

Examples

1
2
votes <- fodr_dataset("paris", "resultats-des-votes-budget-participatif-2016")
votes$get_records()

Tutuchan/fodr documentation built on May 9, 2019, 5:16 p.m.