Description Usage Arguments Value Examples
This function
is similar to percseats
, but it calculates percentage of held seats by each party in each country by using the value from a "Total" column
that has the total number of seats available per country. As a result, this function works even if the sum of all columns do not equal the total value of seats.
1 | percchange(df, columns, keep = c("Country", "Total"))
|
df |
The |
columns |
The |
keep |
What |
Returns a dataframe
containing the rows from the inputted dataframe
listed in keep
and the
columns assigned to argument columns
and returns those values as percentages of total possible seats, rather than in absolute values.
1 2 3 4 5 6 7 8 | 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)
Total <- c(4,6,8)
df.data <- data.frame(Country, EPP, SD, Other, IN, Total)
percchange(df.data, columns = c("EPP", "SD", "Other", "IN"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.