newgroupby: Function that creates a data frame with political groups...

Description Usage Arguments Value Examples

View source: R/newgroupby.R

Description

This function creates new dataframe with political groups as a result of aggregating selected parties.

Usage

1
newgroupby(df, groups, keep)

Arguments

df

The dataframe with the data of the political parties.

groups

List with the desired groups with the dataframe columns for performing the groupings.

keep

What columns of the inputted dataframe will be kept. By default, it will be "Country" and "Year".

Value

Returns a dataframe containing the rows from the inputted dataframe listed in keep and the columns in the list inputted under groups.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
Country <- c("Austria", "Belgium", "Bulgaria")
EPP <- c(1,2,3)
SD <- c(1,2,3)
Other <- c(1,1,1)
IN <- c(1,1,1)
df.data <- data.frame(Country, EPP, SD, Other, IN)
groups <- groups <- list(
  "traditional" = c("EPP", "SD"),
  "non_attached" = c("IN", "Other"))

newgroupby(df.data, groups, "Country")

bclroger/euparliament documentation built on Jan. 26, 2020, 12:56 a.m.