Learn R Programming

⚠️There's a newer version (1.4.1) of this package.Take me there.
LicenseVersionBuild StatusRateZenodo
LicenseLatest CRAN versionBuild statusCRAN DownloadsIndependently-hosted Archive

SciencesPo is a facility package for the political science crowd. It provides a variety of functions for analyzing random and nonrandom data. The package lives on the R Foundation repository (CRAN), and its development version hosted on Github. To install it, you can use the following methods.

1 - From the CRAN repository (stable version):

install.packages('SciencesPo', dep=TRUE)

library(SciencesPo)

2 - You can install the latest development version using the nifty function from devtools package.

library(devtools)
install_github("danielmarcelino/SciencesPo")

3 - Or download the sources in a zip file and build manually. To do so, please unzip the file to an empty dir and run the following commands there:

R CMD build SciencesPo
R CMD INSTALL SciencesPo_*.tar.gz

Please note that the package contains some C code and thus you need a development environment to build the package. If you're running R on Windows, you need to install Rtools. Once you have installed Rtools, issue following command in command prompt:

R CMD build --binary <path to .tar.gz file>
R CMD INSTALL <path to .zip file>

Helping Out

SciencesPo is intended to be a useful project for the social sciences community. Contributions are welcome.

If you're familar with GitHub and R packages, feel free to submit a pull request. If you'd like to report a bug or make a suggestion, please create a GitHub issue; issues are a usually a good place to ask public questions too.

Usage

For a brief introduction to SciencesPo functionality, run:

demo(SciencesPo)

To see what functions are implemented in SciencesPo, run:

help(package=SciencesPo)

Vignettes

Copy Link

Version

Install

install.packages('SciencesPo')

Monthly Downloads

139

Version

1.4.0

License

GPL (>= 2)

Last Published

June 8th, 2016

Functions in SciencesPo (1.4.0)

CI

An S4 Class to Confidence Intervals
scale_color_party

Political Parties Color Palette (Discrete) and Scales
Anonymize

To Make Anonymous a Data Frame
Clear

Clear Memory of All Objects
Bartels

Bartels Rank Test of Randomness
Atkinson

Atkinson Index of Inequality
ddirichlet

Dirichlet Distribution
Crosstable

Cross-tabulation
Bootstrap

Method for Bootstrapping
scale_color_pub

Publication color scales.
scale_fill_party

Political Parties Color Palette (Discrete) and Scales
Footnote

Add Footnote to ggplot2 Objects
Flag

Add an "id" Variable to a Dataset
scale_fill_pub

Publication color scales.
Describe

Summary Description Table
Dummify

Generate Dummy Variables in a Data Frame
dHondt

The D'Hondt Method of Allocating Seats Proportionally
freq

Simple Frequency Table
Formatted

Some Formats for Nicer Display
Destring

Factors to numeric
Frequency

Frequency Table
Jackknife

Resamples Data Using the Jackknife Method
HighestAverages

Highest Averages Methods of Allocating Seats Proportionally
geom_dumbbell

Dumbell charts
Herfindahl

Herfindahl Index of Concentration
Hamilton

The Hamilton Method of Allocating Seats Proportionally
Gini

Gini Coefficient G
GiniSimpson

Gini-Simpson Index
geom_lollipop

Lollipop charts
GeomSpotlight

Automatically enclose points in a polygon
JamesStein

James-Stein Shrunken Estimates
MeanFromRange

Estimates Mean and Standard Deviation from Median and Range
Kurtosis

Compute the Kurtosis
LargestRemainders

Largest Remainders Methods of Allocating Seats Proportionally
%nin%

Not in (Find Matching or Non-Matching Elements)
Label

Get Variable Label
Label<-

Set Variable Label
Lorenz

The Lorenz Curve
Operations

Arithmetic and Statistiscal Functions but Dealing with Missing Data
Outlier

Detect Outliers
party_color_pal

Political Parties Color Palette (Discrete) and Scales
read.zTree

Reads zTree output files
Proportionality

Indexes of (Disproportionality) Proportionality
rdirichlet

Dirichlet Distribution
pub_shape_pal

Shape scales for theme_pub (discrete)
pub_color_pal

Color Palettes for Publication (discrete)
PreviewTheme

Preview ggplot2 themes
print.SciencesPo

Print method for objects of class SciencesPo.
Permutate

Create k random permutations of a vector
Palettes

Palette data for the themes used by package
Recode

Recode or Replace Values With New Values
TwoWay

Cross Tabulation
Untable

Untable an Aggregated Data Frame
Render

Render layer on top of a ggplot
Stratify

Stratified Sampling
Skewness

Compute the Skewness
summary.Crosstable

Print Crosstable style
theme_blank

Create a Completely Empty Theme
Winsorize

Winsorized Mean
WeightedVariance

Weighted Variance
Safechars

Convert All Factor Columns to Character Columns of a Data Frame
SciencesPo-deprecated

Deprecated functions in package ‘SciencesPo’
theme_pub

The Default Theme
theme_darkside

The Dark Side Theme
Rosenbluth

Rosenbluth Index of Concentration
runExample

Examples from the SciencesPo Package
%>%

Then Operator
theme_fte

Themes for ggplot2 Graphs
SciencesPo

A Tool Set for Analyzing Political Behavior Data
Voronoi

Voronoi tessellation diagram
scale_shape_pub

Shape scales for theme_pub (discrete)
WeightedCorrelation

Compute Weighted Correlations
WeightedMean

Computes Weighted Mean
WeightedStdz

Computes Weighted Standardized Values