[R] Setting Up an Interactive R Shiny Plotting App
I have an ieda of creating a shiny app to create all kinds of plots interactively, so that users can choose their color, symbols, etc, which is very useful for data exploration and make a publication-quality figure. Today, I make it and published it at https://fortune9.shinyapps.io/interactive_plot/. The source code is at github https://github.com/fortune9/interactive_plot. This guide focuses on the infrastructure setup for creating and deploying an interactive plotting application using R Shiny.
2025-10-08   schedule 1 min 58 s  
[Python] How to install pyenv-win?
If you have used pyenv on Linux or Mac, you may want to use pyenv-win on Windows. Basically, these tools allow one to easily switch between multiple versions of Python. There is already a good document for how to install pyenv-win in windows at https://github.com/pyenv-win/pyenv-win?tab=readme-ov-file#installation. In this post, I would like to share my experience and share some tips/tricks you may need in your setup. Installation I started with the git method, so what I did were as follows:
2025-09-25   schedule 2 min 27 s  
[R] Use new_scale_xxx() function to add the same scale type in different ggplot layers
In one ggplot figure, normally you can only use one scale for each aesthetic mapping. For example, if you use scale_color_manual() to set the color scale for a layer, you cannot use another scale_color_manual() for another layer, or set the color scale more then once in the function aes(). However, you can use the new_scale_color() function from the ggnewscale package to add a new scale for the same aesthetic mapping in different layers.
2025-05-10   schedule 1 min 31 s  
[Linux] How to escape single quote in 'sh -c'
Sometimes, you need to run a command in ‘sh -c’ and to avoid its subshell expression is evaluated in parent shell, you need to put the command string into a single quote, like: 1 sh -c 'a="hello world"; echo $a' However, for some commands in the command string, you need to use single quote such as awk, and how do you escape the single quote in the command string?
2025-05-04   schedule 50 s  
[R] How to create errorbars with overlaid points using ggplot
library(ggplot2) library(dplyr) Sometimes you may want to create a plot with the following features: a point to indicate the mean of a group error bars to indicate the standard deviation of the group and each group may have subgroups, which are represented by different colors. In this post, I will show you how to create such a plot using the ggplot2 package in R. We will use the builtin mtcars dataset as an example.
2025-04-26   schedule 2 min 30 s  
[git] Exclude a path when staging files
Occasionally, you may want to exclude a specific path when staging files in Git. This can be useful when you have a directory with many files, but you only want to stage some of them. Today I will show how to do it. Preparation First, let’s clone a git repository and create some files to demonstrate the process. The repository used here is one of my own, which contains some bioinformatics tools.
2025-04-19   schedule 1 min 43 s  
[Linux] How to set limit on memory usage in a shell?
Occasionally, my computer crashed when I ran a program which ate up all the memory. To prevent this from happening again, I want to set a limit on the memory usage in a shell, so any command run in that shell will be limited to set memory usage. My system OS: Ubuntu 22.04 Solution not working I searched Google and many suggested to use 1 ulimit -m <value> to set memory usage, but it did not work – no restriction on memory at all.
2025-04-12   schedule 52 s  
[R] data.table's frank()
knitr::opts_chunk$set(echo = TRUE, message = FALSE, warning = FALSE) library(knitr) library(data.table) One can use data.table::frank() to rank the rows of a data.table or simply a vector. Compared to the base R function rank(), frank() is faster. Today I will show how to use this function. First, let’s generate a example data.table with 10 rows and 3 columns, for simplicity, we will make first 2 columns are integer and the last one is a character.
2025-04-12   schedule 3 min 10 s  
[LibreOffice] How to shrink print an excel sheet
I have been using opensource LibreOffice to handle my office documents, which is convenient and free. Today, I found one trick for shrinking documents when printing in order to print it in one page. More specifically, I was working on an excel sheet, which is opened with the Calc app of LibreOffice. To do so, one just need to open the excel file, and then choose File -> Print Preview, and can see the menu in the following screenshot.
2025-01-17   schedule 38 s  
[Linux] "NO EFI System Partition was found" when installing Ubuntu 22.04
Background I have an old Lenovo Ideapad U410 machine, which has an updated Windows 10 system (original was Windows 7). Given that the system is so slow after a decade, I decide to install Ubuntu onto it and make it dual-boot. So I created a bootable USB disk with Ubuntu 22.04 installation media on it and start to install it by following the tutorial. The problem When I chose a free disk partition to install Ubuntu, it first popped a message No root file system defined.
2024-12-29   schedule 1 min 1 second