Regional Population Distribution of China, Just a Graph.

It’s very hard to get Chinese population at county level. So I just get this data for year 2004.

The shp data:, theme.R can be found in this article: Create Complete China Maps Using GGPLOT2 and SF, Population data set: 全国分县市人口统计资料2004.xlsx

Rsampling Fama French

This is my note for learning Rsampling Fama French. This article introduced how to conduct k-fold cross validation in R using rsample and yardstick packages. For more details, you can read the original article.

Launch and Interact with a STATA Session

Yesterday, I found a interesting R Package on GitHub - bubble. This package provides a REPL (交互解释器) between R and node. And its source codes are quiet simple, so I want to know if I can create a Stata REPL by imitating it. Then we have statarepl package which provides a REPL interface between R and Stata, it’s different from RStata, which I have introduced before.

Portfolio Backtesting

This is my note for learning Portfolio Backtesting

Momentum Investing with R

This is my note for learning Momentum Investing with R.

In practice, momentum entails a look back into the past to determine whether an asset has exceed some benchmark, and if it has, buy and hold that asset for some benchmark, and if it has, buy and hold that asset for some time into the future. That’s completely flying in the face of the efficient market hypothesis because it’s positing that the past is somehow giving us information that has not been reflected in the current price of the asset.

Introduction to Fama French

This is my note for learning Introduction to Fama French.

Today, we will be workding with our usual portfolio consisting of:

  • SPY (S&P500 fund) weighted 25%
  • EFA (a small-cap value fund) weighted 25%
  • IJS (a small-cap value fund) weighted 20%
  • EEM (a emerging-mkts fund) weighted 20%
  • AGG (a bond fund) weighted 10%

A quick tour of GA

This is my note for learning A quick tour of GA.

Genetic algorithms(GAs) are stochastic search algorithms inspired by the basic principles of biological evolution and natural selection. GAs simulate the evolution of living organisms, where the fittest individuals dominate over the weaker ones, by mimicking the biological mechanisms of evolution, such as selection, crossover and mutation.

Themes for base plotting system in R

This is my note for learning Themes for base plotting system in R.

basetheme package is a magic package, which let you love R’s base plotting system again!

Visualizing Natural Disaster Cost

This is my note for learning Visualizing Natural Disaster Cost.

If you cannot download data-2.tsv from the provided URL, you can download it from data-2.tsv.

ggrapid: Create neat & complete ggplot visualizations with as little code as possible

This is my note for learning {ggrapid}: Create neat & complete ggplot visualizations with as little code as possible. ggrapid offers a couple wrappers around the most commonly used ggplot functions in the course of doing an EDA or building a report:

  • plot_density
  • plot_boxplot
  • plot_deciles (with calculate_decile_table)
  • plot_correlation
  • plot_bars
  • plot_line

Using gghalves

This is my learning note for Using gghalves, ‘gghalves’ is a R package which provides some geoms that are half of ggplot2’s geoms.

A New Shiny Application: Show My Other Packages Which Have Conflicts with `bs4Dash`

When I develop the ‘package’ application, I found that the ‘bs4Dash’ package has some conflicts with sankeywheel and hpackedbubble, which results in a problem that these two packages cann’t be used in bs4Dash framework. So I write another shiny application named ‘otherpackages’ to show these packages’ demo.

Plot XKCD Graphs

XKCD is a popular figure web comic with themes in mathematics, science, language, and romance created by Randall Munroe. The xkcd package provides a simple method to plot xkcd graphs. The tweet is my learning notes for xkcd: Plotting XKCD graphs.

Exploring the Wechat Friends Data Again!

About one week ago, I added a new functions to hchinamap package, that is chinamappoint() and provincepoint(). these two functions can map points on chinese map and it province map. The tweets indtroduce a method to display the geographical distribution of your wechat friends on chinese map, and also some other methods to plot wechat friends’s geographical distribution.

Spelunking macOS 'ScreenTime' App Usage & Visualizing macOS App Usage With R

This is my learning notes for Spelunking macOS ‘ScreenTime’ App Usage with R | and Visualizing macOS App Usage with a Little Help from osqueryr & mactheknife | These two tweets introduced some methods about how to spelunk macOS screentime app usage and visualize macOS app usage with R. Following the author’s guide, I reproduced the results of my own macOS.

Geographical Distribution of Students' Hometown in Ji'nan University

This tweet demonstrates a simple application of ‘hchinamap’ package. The data was collect from Ji’nan University’s library websit and sport website. Considering that this is a data set with private information, I can’t make this data public. If you want a copy, you can add my wechat to ask for it.

Welcome to My Shiny Server!

Inspired by daattali/shiny-server, I decided to build my own shiny server. Finally, I made it! Now you can access it by Since I haven’t get this server recorded (In China, all websites should be recorded at MIIT, a.k.a, Ministry of industry and information technology of China). After I get it recorded, you can access it by domain name, as is, but this domain name now is point to my blog deployed at GitHub.

Anouncement for My New R Package——sankeywheel!

Dependency wheels and sankey diagrams can be drawn by many R Packages, such as circlize, networkD3, and ggalluvial. These packages are very powerful and easy to use, so why bother to write another duplicate package? As we can see, there are some relationships exist between dependency wheels and sankey diagrams. So why not combined these two types of charts into one R function. At the same time, it would be great to add a little interactivity to the graph. ‘Highcharts’, a commercial javascript charting library, can help me realize these ideas. By binding R functions and the ‘Highcharts’ charting library, ‘sankeywheel’ package provides a simple way to draw dependency wheels and sankey diagrams.

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now