# NOT RUN {
tst <- data.frame(Office=factor(
c("House", "Senate", "Senate", 'Senate')),
state=factor(c('SC', 'SC', 'SC', 'NY')),
surname=c("Jones", "DeMint", "Graham", 'Smith'),
district=c("9", NA, NA, NA),
stringsAsFactors=FALSE)
if(!fda::CRAN()){
tst. <- USsenateClass(tst)
chk <- data.frame(incumbent=c(NA, FALSE, TRUE, FALSE),
district=c("9", "3", "2", "1 or 3"),
stringsAsFactors=FALSE)
# }
# NOT RUN {
all.equal(tst., chk)
# }
# NOT RUN {
##
## test with names different from the default
##
tst2 <- tst
names(tst2) <- letters[1:4]
tst2. <- USsenateClass(tst2, Office='a',
state='b', surname='c', district='d')
# }
# NOT RUN {
all.equal(tst., tst2.)
# }
# NOT RUN {
}
# }
Run the code above in your browser using DataLab