library(tidyverse)
library(govtrackR)
library(asbmisc)
setwd("~")
df_scraped <-
"Desktop/r_packages/govtrackRdata/data/all_archives_2017_01_16.rda" %>% read_rda_file()
df_items <-
df_scraped %>%
distinct(descriptionSoloicitationGroup) %>%
arrange(desc(descriptionSoloicitationGroup))
df_groups <-
df_scraped %>% distinct(idSolicitationGroup, descriptionSoloicitationGroup) %>%
filter(!is.na(idSolicitationGroup))
df_groups %>%
arrange(idSolicitationGroup) %>%
formattable::formattable()
df_scraped %>%
filter(idSolicitationGroup == "11") %>%
sample_n(5) %>%
pull(urlSolicitationDetails) %>%
map(browseURL)
df_scraped %>% sample_n(1) %>% jsonview::json_tree_view()
df_scraped %>% filter(is.na(descriptionSoloicitationGroup)) %>% count()
df_scraped %>%
filter(datePosted >= "2003-01-01")
df_scraped %>%
filter(idSolicitation %>% str_detect("^BAA13")) %>% View()
df_scraped %>% distinct(statusBid)
df_scraped %>% distinct()
df_test <-
df_scraped %>%
filter(statusBid == "Award") %>%
filter(nameSolicition %>% str_detect("DRONE"))
solicitations <- df_test$idSolicitation
setwd("Desktop/fbo_data/completed/")
batches <- list.files()
df_matches <-
batches %>%
map(function(batch) {
glue::glue("Reading {batch}") %>% message()
data <-
batch %>% read_rda_file()
data <-
data %>% filter(idSolicitation %in% solicitations)
if (nrow(data) == 0) {
return(data_frame())
}
data
})
d <- df_matches[df_matches %>% map_dbl(nrow) > 0]
d <- seq_along(d) %>%
map_df(function(x){
x %>% message()
d[[x]]
})
d <- d %>%
mutate_if(is.numeric, list(
function(x){ifelse(is.na(x), 0, x)}
))
d$
d %>%
hc_xy(group = c("nameAgency", "nameOfficeAgency", "nameContractWinner"), size = "amountContract", type = "treemap")
d <-
d %>%
mutate(yearContract = dateContractAwarded %>% lubridate::year())
d$
d %>%
to_character_columns("yearContract") %>%
hc_xy(
group = c(
"nameAgency",
"nameContractWinner",
"yearContract",
"idSolicitation",
"nameSolicitation"
),
size = "amountContract",
type = "treemap"
)
d %>%
image_trelliscope(
image_url = "urlAgencyLogo",
id_columns = c(
"nameSolicitation",
"idSolicitation",
"nameAgency",
"nameContractWinner",
"descriptionProcurement",
"amountContract",
"urlSolicitationDetails"
),
sort_columns = "amountContract"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.