knitr::opts_chunk$set(echo = TRUE) library(dashdash) library(readxl) library(readr) library(haven)
my_vars <- read_excel("mex_vars.xlsx") vars_used <- my_vars %>% filter(!is.na(variable)) %>% pull(variable) print(getwd()) my_data <- read_dta("mex_data.dta") n <- rownames(my_data) my_data <- cbind(n=n, my_data) # Light data cleaning my_data <- select(my_data, c(id=edo, date=fecha, "n", all_of(vars_used))) %>% mutate(date = as.Date(date, format = "%d%b%Y")) my_args <- read_excel("mex_args.xlsx")
# start <- Sys.time() wd <- getwd() dashdash::dashdash( output_file = paste0(wd, "/mexample.html"), map_path = paste0(wd, "/shapefiles"), map_layer = "gadm36_MEX_1", map_region = "NAME_1", add_maps = TRUE, my_data = my_data, my_vars = my_vars, my_args = my_args ) # end <- Sys.time() # duration <- end -start
wd <- getwd() dashdash::dashdash( output_file = paste0(wd, "/index.html"), my_data = my_data, my_vars = my_vars, my_args = my_args, title="Crime in Mexico", add_maps = TRUE, country_code = "MEX", level = 1, map_region = "NAME_1" )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.