View source: R/pp_convert_to_data_frame.R
pp_convert_to_data_frame | R Documentation |
The function attempts to convert the result of a ProPublica API call to a data.frame. If the result of the API call contains various parts, the which_part parameter can be used to specify for which of these the conversion is required. Typically the 'payload' resides in the 'results' field, which is the default, but occasionally the summary and meta fields might be of interest.
pp_convert_to_data_frame(what, which_part = c("result", "summary", "meta"))
what |
Return value from one of the get_ functions. |
which_part |
Which part are we converting. Defaults to 'results', but 'summary' and 'meta' may be useful in some cases. |
The function also replaces . (dot) with _ (underscore) in column names for compatibility with database inserts (e.g. DBI::dbWriteTable)
a data.frame
## Not run:
tmp <- get_candidates_in_race('MI','house',11)
pp_convert_to_data_frame(tmp)
pp_convert_to_data_frame(tmp,'summary')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.