R

Notes on Bioconductor packages

This is not intended to be a comprehensive review of Bioconductor packages - there are too many of them. These are my personal notes. First of all, I must declare a love-hate relationship with many Bioconductor packages. On one hand, they are very useful for specific purposes. On the other hand, there is often less underlying logic for these packages as compared to the tidyverse ecosystem. Even the authors admit that sometimes they forget what functions are there in their packages (I should link here to a Bioconductor support page, but not in the mood to do so).

How to split a string column by length

Intro This is a documentation of how I split a string type column by its length, and combine them together in a directory format (which was a necessary step for me to check whether each directory existed in my analysis). library(tidyverse) data <- tibble(string = c("123456", "987654")) print(data) ## # A tibble: 2 x 1 ## string ## <chr> ## 1 123456 ## 2 987654 Step 1 strsplit splits the string into a list of strings, and in tibble it will show up as a column of list type.

Tips for publishing your first document with bookdown and RStudio

I have just published my first document with bookdown and I am feeling euphoric at the moment. Somehow this gives me a very different satisfaction as compared to creating just a google document. Yes, they serve almost the same function, but the presentation of a bookdown document is much better. It also provides more functionalities and flexibilities than a google doc. Here are the minimal steps needed to customize a document from Yihui’s guide.

A R package that creates blank Rmd files

I have created this package to create a blank Rmd file by saving a nearly blank Rmd template to the menu when you create Rmd files. I think it at least follows the first half of the UNIX orthodox: programs that do one thing and do it well. 😂 Reflection: the main purpose for me to create this package, other than making life easier, is to practise how to publish a R package onto github and to install it from there.

How to plot a bar plot with bars and labels between tick marks

I had this quesition when preparing my manuscript and a quick search brings me to this stackoverflow question by Johanna. I find the answer by Henrick to be highly effective, but can be further elaborated so that readers can be clearer about the functions of each line. Thus, I will base my post largely on Henrick’s answer but at the same time add my explanation to the rationale behind the lines.