Learn R Programming

coalitions (version 0.6.24)

collapse_parties: Transform surveys in long format

Description

Given a data frame containing multiple surveys (one row per survey), transforms the data into long format with one row per party.

Usage

collapse_parties(
  surveys,
  parties = c("cdu", "spd", "greens", "fdp", "left", "pirates", "fw", "afd", "others")
)

Value

Data frame in long format

Arguments

surveys

A data frame with one survey per row.

parties

A character vector containing names of parties to collapse.

Examples

Run this code
if (FALSE) {
emnid <- scrape_wahlrecht()
emnid.long <- collapse_parties(emnid)
}

Run the code above in your browser using DataLab