install_github("ropengov/rsunlight")
library(ropengov)
df <- os_billsearch(terms = "drone")
Some elements in the list are list()
, which makes it hard to combine to a data.frame
. Soon I'll fix these in the package itself.
df <- lapply(df, function(x){
x[sapply(x, length)==0] <- "none"
x
})
Using plyr
package. Removing first column for display here as it's a long character string.
library(plyr)
dat <- ldply(df, data.frame)
head(dat[,-1])
created_at updated_at id chamber state session type subjects bill_id
1 2014-01-21 19:22:39 2014-03-19 03:17:52 TNB00015037 upper tn 108 bill Agriculture and Food SB 1777
2 2014-01-21 19:22:39 2014-03-19 03:17:52 TNB00015037 upper tn 108 bill Animal Rights and Wildlife Issues SB 1777
3 2014-02-15 00:46:13 2014-03-14 23:56:26 AKB00001323 upper ak 28 bill Drugs SB 173
4 2014-02-15 00:46:13 2014-03-14 23:56:26 AKB00001323 upper ak 28 bill Public Services SB 173
5 2014-02-15 00:46:13 2014-03-14 23:56:26 AKB00001323 upper ak 28 bill Health SB 173
6 2014-02-15 00:46:13 2014-03-14 23:56:26 AKB00001323 upper ak 28 bill Social Issues SB 173