get_mp_pic: Retrieve picture of specific MPs

View source: R/get_mp_pic.R

get_mp_picR Documentation

Retrieve picture of specific MPs

Description

A function for retrieving Norwegian MP pictures by id.

Usage

get_mp_pic(mpid = NA, size = "middels", 
           destfile = NA, show_plot = FALSE, 
           good_manners = 0)

Arguments

mpid

Character string indicating the id of the MP to retrieve.

size

Character string size of the picture. Accepts values "lite" (small), "middels" (medium – default), and "stort" (big).

destfile

Character string specifying where to save the picture

show_plot

Logical. FALSE (default) if no plot should be produced and TRUE if plot should be produced. Requires the "imager" package.

good_manners

Integer. Seconds delay between calls when making multiple calls to the same function

Value

Picture of the requested MP in the preferred size.

See Also

get_mp get_parlperiod_mps get_mp_bio

Examples

## Not run: 
# Request one MP by id
get_mp_pic(mpid = "AAMH", destfile = "~/Pictures/AAMH.jpeg", show_plot = TRUE, size = "stort")

# With good manners for multiple calls
lapply(c("AAMH", "CIH", "TKF"), function(x){
  get_mp_pic(mpid = x, destfile = paste0("~/Pictures/", x), 
  show_plot = TRUE, size = "stort", good_manners = 2)
  })

## End(Not run)


stortingscrape documentation built on March 31, 2023, 10:30 p.m.