Welcome to my blog
2025-05-19
2 / 3
Data Visualization
ggplot US state and China province heatmap
Yang Liu
/
2020-06-12
(Updated on 2020-06-12, First posted on 2019-04-17) It sounds easy but turned out not as straight-forward as I thought. I will show: […] 50-state (including Alaska and Hawaii) United States thematic map, with map scale and with state abbreviations […] China thematic map, with map scale, with names of provinces in either English or Chinese […] The dt1 below can be used by both…
Data Engineering
Working with 3D array as long-format data in R
Yang Liu
/
2020-01-11
check.and.install.pkgs <- function(pkgs){ new.packages <- pkgs[!pkgs %in% installed.packages()[,"Package"]] if(length(new.packages)) install.packages(new.packages, dependencies = TRUE) suppressPackageStartupMessages(invisible(lapply(pkgs, library, character.only = TRUE))) } check.and.install.pkgs(c("data.table", "reshape2", "scatterplot3d")) Happy New…
Reproducible Workflow
Drake: powerful tool for automatic reproducible workflow
Yang Liu
/
2019-09-15
drake is a powerful tool for automatic reproducible workflow. I found it a perfect match when used together with RMarkdown. There are great documentations online for drake thus here I only show a simple example working with RMarkdown. RMarkdown file could be very slow to generate if lots of calculations are involved. Any small revise makes you rerun everything. When we use drake we can do all the…
R package
Notes on writing an R package
Yang Liu
/
2019-07-28
Although ‘SHAPforxgboost’ is not a package too complicated, it took me some time to get the package pass all the cran check. Now (Aug.03,2019) it is available on cran. Install by either install.packages("SHAPforxgboost") or devtools::install_github("liuyanguu/SHAPforxgboost") Use the ‘usethis’ package https://usethis.r-lib.org/ to set up the structure of the package. […]…
R package
SHAP for XGBoost in R: SHAPforxgboost
Yang Liu
/
2019-07-18
I wrote the R package SHAPforxgboost to cover all the plotting functions illustrated in this post. This post serves as the vignette for the package. Please install from CRAN or Github. install.packages("SHAPforxgboost") # or devtools::install_github("liuyanguu/SHAPforxgboost") Why SHAP values SHAP’s main advantages are local explanation and consistency in global model…
Data Visualization
Shiny in Blogdown
Yang Liu
/
2019-02-24
Since Blogdown is for static websites, it cannot run Shiny in rmarkdown directly. According to discussion here and document here. The only way to do it is using iframe and write outside the chunk: <iframe src="https://liuyanguu.shinyapps.io/bcl_app/" width=1000 height=800"></iframe> There is also a built-in function in knitr to do the same thing and write in the chunk. The only…
««
«
1
2
3
»
»»