Backticks in R

The only times I used backticks in R was when a file was imported into R and the column names had spaces (as a side note, please don’t use spaces in your column or file names but use an underscore, i.e. _). For example, you can access col a by using backticks. my_df <- data.frame(…

Continue Reading

Wrapping R vectors with parentheses

In this vectors and lists tutorial, the example code wraps the R vector assignments with parentheses or round brackets. (v_log <- c(TRUE, FALSE, FALSE, TRUE)) #> [1] TRUE FALSE FALSE TRUE (v_int <- 1:4) #> [1] 1 2 3 4 (v_doub <- 1:4 * 1.2) #> [1] 1.2 2.4 3.6 4.8 (v_char <- letters[1:4]) #>…

Continue Reading

Split single column of key-value pairs into multiple columns

Two widely used file formats in bioinformatics, VCF and GTF, have single columns that are packed with annotation information. This makes them a bit inconvenient to work with in R when using data frames because the values need to be unpacked, i.e. split. In addition, this violates one of the conditions for tidy data, which…

Continue Reading