-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
url <- "https://cdn.bancentral.gov.do/documents/estadisticas/sector-monetario-y-financiero/documents/operaciones_interb.xls"
file <- tempfile(fileext = ".xls")
download.file(url, file, mode = "wb")
readxl::read_xls(file, col_names = FALSE) |>
janitor::clean_names() |>
filter(!is.na(x2)) |>
mutate(
is_year = str_detect(x2, "^\\d{4}$"),
id = cumsum(is_year)
) |>
filter(id > 0) |>
select(date_pieces = x2, monto = x3, tasa = x4) |>
mutate(
year = str_extract(date_pieces, "^\\d{4}$")
) |>
fill(year) |>
filter(str_detect(date_pieces, "^[A-z]+$")) |>
mutate(
mes = databcrd::crear_mes(date_pieces, "text_to_number"),
date = lubridate::make_date(year, mes, 1)
) |>
select(date, year, mes, monto, tasa) |> View()
Metadata
Metadata
Assignees
Labels
No labels