knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
A personal R package of miscellaneous data science functions
Install from GitHub with:
# install.packages("remotes") remotes::install_github("ercbk/ebtools")
library(dplyr, warn.conflicts = FALSE) library(gt) dtw_html <- gt::html(as.character(htmltools::a(href = "https://dynamictimewarping.github.io/", "dtw"))) pkg_tbl <- tibble::tibble( Type = c("Geospatial", "Preprocessing", "Statistics", "Statistics", "Time Series", "Time Series", "Time Series", "Time Series", "Time Series", "Time Series", "Time Series", "Time Series", "Time Series"), Function = c("add_spatial_lags", "to_js_array", "cles", "get_boot_ci", "add_mase_scale_feat", "add_tsfeatures", "create_dtw_grids", "descale_by_mase", "dtw_dist_gridsearch", "prewhitened_ccf", "scale_by_mase", "test_fable_resids", "test_lm_resids"), Description = c("Adds spatial lags of a numeric variable to a dataframe", "Creates js array column.", "Calculates the Common Language Effect Size (CLES)", "Calculates bootstrapped confidence intervals for a statistic.", "Adds a scale feature by using a factor derived from the MASE error function", "Adds 20 time series features from the tsfeatures package", "Creates a nested, parameter grid list.", "Back-transforms a group time series that has been scaled by a factor derived from the MASE error function.", "Performs a grid search using a list of parameter grids and a list of distance functions", "Prewhitens time series, calculates cross-correlation coefficients, and returns statistically significant values.", "Scales a group time series by using a factor derived from the MASE error function.", "Checks residuals of multiple fable models for autocorrelation using the Ljung-Box test", "Checks residuals of multiple lm models for autocorrelation using Breusch-Godfrey and Durbin-Watson tests."), comp_pkgs = c("spdep", "dataui", "", "", "", "", "dtwclust", "", "dtwclust", "", "", "fable", ""), function_urls = c("https://ercbk.github.io/ebtools/reference/add_spatial_lags.html", "https://ercbk.github.io/ebtools/reference/to_js_array.html", "https://ercbk.github.io/ebtools/reference/cles.html", "https://ercbk.github.io/ebtools/reference/get_boot_ci.html", "https://ercbk.github.io/ebtools/reference/add_mase_scale_feat.html", "https://ercbk.github.io/ebtools/reference/add_tsfeatures.html", "https://ercbk.github.io/ebtools/reference/create_dtw_grids.html", "https://ercbk.github.io/ebtools/reference/descale_by_mase.html", "https://ercbk.github.io/ebtools/reference/dtw_dist_gridsearch.html", "https://ercbk.github.io/ebtools/reference/prewhitened_ccf.html", "https://ercbk.github.io/ebtools/reference/scale_by_mase.html", "https://ercbk.github.io/ebtools/reference/test_fable_resids.html", "https://ercbk.github.io/ebtools/reference/test_lm_resids.html"), package_urls = c("https://r-spatial.github.io/spdep/", "https://timelyportfolio.github.io/dataui/", NA, NA, NA, NA, "https://github.com/asardaes/dtwclust", NA, "https://github.com/asardaes/dtwclust", NA, NA, "https://fable.tidyverts.org/", NA) ) |> mutate(fun_html = purrr::map2(function_urls, Function, ~htmltools::a(href = .x, .y)), fun_url = purrr::map(fun_html, ~gt::html(as.character(.x))), pkg_html = purrr::map2(package_urls, comp_pkgs, ~htmltools::a(href = .x, .y)), pkg_url = purrr::map(pkg_html, ~gt::html(as.character(.x))), dtw_url = list("","","","","", "", dtw_html, "", dtw_html, "", "", "", "")) |> tidyr::unite("pkg_url", pkg_url, dtw_url, sep = " <br> ") |> # newly added b/c gt::col_merge error mutate(pkg_url = purrr::map(pkg_url, ~gt::html(.x))) |> # newly added b/c gt::col_merge error relocate(fun_url, .before = "Function") |> select(Type, Function = fun_url, Description, comp_pkgs = pkg_url) pkg_tbl %>% group_by(Type) |> gt() |> cols_label(comp_pkgs = "Complementary Packages") |> # errored because (I guess) target column was a list column. Think its a bug. Used new code above to do this manually. Might be fixed in the future. # cols_merge( # c(comp_pkgs, dtw_url), # hide_columns = c(dtw_url), # pattern = "{1}<br>{2}" # ) %>% as_raw_html()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.