Learn R Programming

pscl (version 1.5.5.1)

dropRollCall: drop user-specified elements from a rollcall object

Description

Drop user-specified elements of rollcall object, returning a roll call object.

Usage

dropRollCall(object, dropList,debug=FALSE)

Value

An object of class rollcall with components modified/added by the subsetting indicated in the dropList.

Arguments

object

an object of class rollcall

dropList

a list (or alist) with some (or all) of the following components:

codes

character or numeric, possibly a vector. If character, it should match the names of object$codes, indicating the set of entries in object$votes to be set to NA. If numeric, then codes indicates the entries in object$votes that will be set to NA.

lop

numeric, non-negative integer, less than number of legislators represented in object. Roll calls with lop or fewer legislators voting in the minority are dropped.

legisMin

numeric, non-negative integer, less than number of roll calls represented in object. Legislators with legisMin or fewer votes are dropped.

dropLegis

an expression that evaluates to mode logical, vector of length equal to the number of legislators represented in object. The expression is evaluated in the legis.data component of the rollcall object. Legislators for whom the expression evaluates to TRUE are dropped.

dropVotes

an expression that evaluates to mode logical, vector of length equal to the number of rollcalls represented in object. The expression is evaluated in the vote.data component of the rollcall object. Rollcalls for which the expression evaluates to TRUE are dropped.

debug

logical, set to TRUE to see messages printed to the console as inspection and subsetting of the rollcall object takes place

Author

Simon Jackman simon.jackman@sydney.edu.au

Details

It is often desirable to restrict the analysis of roll call data in various ways. For one thing, unanimous votes provide no information discriminating among legislators: hence, summary and analysis should almost always use dropList=list(lop=0). See the examples for other possibilities, limited only by the information supplied in legis.data and votes.data.

See Also

dropUnanimous, summary.rollcall, ideal, alist.

Examples

Run this code
data(s109)
s109.working <- dropRollCall(s109,
                             dropList=list(lop=0))
summary(s109.working)

s109.working <- dropRollCall(s109,
                             dropList=list(lop=0,
                               code="notInLegis"))
summary(s109.working)

s109.working <- dropRollCall(s109,
                             dropList=list(lop=3,
                               code="notInLegis"))
summary(s109.working)

## note use of alist, since dropLegis is an expression
dropList <- alist(lop=3,
                 dropLegis=party!="D",
                 code="notInLegis")
s109.working <- dropRollCall(s109,dropList=dropList,debug=TRUE)
summary(s109.working)

s109.working <- dropRollCall(s109.working,dropList=list(legisMin=25))
summary(s109.working)


if (FALSE) {
## read 102nd House from Poole web site
h102 <- readKH("ftp://voteview.ucsd.edu/dtaord/hou102kh.ord")

## drop President from roll call matrix
h102 <- dropRollCall(h102,
                     dropList=alist(dropLegis=state=="USA"))
summary(h102)
}

Run the code above in your browser using DataLab