| dropRollCall {pscl} | R Documentation |
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)
Arguments
object |
an object of class |
dropList |
a
|
debug |
|
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.
Value
An object of class rollcall with components modified/added by
the subsetting indicated in the dropList.
Note
With the exception of codes, each component of
dropList generates a vector of mode logical,
either with respect to legislators or votes. These logical
vectors are then combined element-wise, such that if any one of
the subsetting restrictions is TRUE for a particular
legislator or vote, then that legislator or vote is dropped. Some
summaries are reported to the console along the way if debug=TRUE.
dropRollCall adds a component
named dropInfo to the rollcall object it returns. This
component is itself a list containing named components
- legislators
a vector of mode
logical, with each elementTRUEif the legislator is retained in the returnedrollcallobject.- votes
a vector of mode
logical, with each elementTRUEif the corresponding is retained in the returnedrollcallobject.- dropList
the
dropListsupplied as input todropRollCall.
If the input rollcall object is itself the product of a call to
dropRollCall, the dropInfo component on output is a list
with named components
- previous
the
dropInfocomponent of the inputrollcallobject.- new
the
dropInfolist created by the current call todropRollCall.
Functions like summary.rollcall try to handle this information
sensibly.
When dropList uses the dropLegis or dropVotes
components then dropList should be constructed via the
alist command; this ensures that the
dropLegis and dropVotes components of
dropList are objects of mode expression, and
evaluated to mode logical in the
legis.data and vote.data environments by
the function, if possible (rather than being evaluated immediately in
the environment calling dropRollCall or constructing
dropList). See the examples. This is not entirely
satisfactory, and behavior more like the subset argument in
function lm would be preferable.
Author(s)
Simon Jackman simon.jackman@sydney.edu.au
See Also
dropUnanimous, summary.rollcall,
ideal, alist.
Examples
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)
## Not run:
## 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)
## End(Not run)