This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#################### | |
# Create relogit predicted probabilities using Zelig and ggplot2 | |
# Two Sword Lengths: Losers' Consent and Violence in National Legislatures (Working Paper 2012) | |
# Christopher Gandrud | |
# Updated 26 April 2012 | |
################### | |
## Load required packages | |
library(RCurl) | |
library(Zelig) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add_check_digit(upc_str): | |
""" | |
Returns a 12 digit upc-a string from an 11-digit upc-a string by adding | |
a check digit | |
>>> add_check_digit('02345600007') | |
'023456000073' | |
>>> add_check_digit('21234567899') | |
'212345678992' | |
>>> add_check_digit('04210000526') |