newpoligroup: Function that sums several columns into a single one and then...

Description Usage Arguments Value Examples

View source: R/newpoligroup.R

Description

This function creates a new political group within EU Parliament that is a combination of other parties. This is done by summing the values in each line of several listed columns and then renames the column.

Usage

1
newpoligroup(df, chosenparties, poligroupname, keep = c("Country", "Year"))

Arguments

df

The dataframe with the data of the political parties to be joined.

chosenparties

The vector with the party names that will be joined together.

poligroupname

The string that will give a name to the new group.

keep

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

Value

Returns a dataframe with the columns inputted from argument keep and an extra column with the sum of the columns listed in chosenparties.

Examples

1
2
3
4
5
6
7
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)
newpoligroup(df.data, chosenparties = c("EPP", "SD"), "traditional", keep = "Country")

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