I saw this interesting post Reversing the technical interview by Kyle Kingsbury. For fun, I wrote the equivalent code in R, which looks like the following.
[Read More]Keep Source When Installing R Packages
If I can see the source code, why can't I see the comments?
When sourcing R functions from a file, the comments and indentation within the function body are kept and can be inspected in the console. Meanwhile, functions from installed packages, by default, are parsed to the standard format and all the comments are striped.
[Read More]Callable S3/S4 Object in R
A function in R, like any other objects in R, can have additional attributes (or slots in S4), that is to say, a S3 or S4 object can inherit “function” semantics and become callable.
The trick to enable the function to access its attributes or slots is to use sys.function function. Here is a simple example.
pow <- function(x) { p <- attr(sys.function(), "p") if (is.null(p)) p <- 2 x^p } attr(pow, "p") <- 3 pow(2) ## [1] 8 We can modify the function’s attributes, leading to a different behavior of the function.
[Read More]
TnT: GSoC 2017 Project Summary
Interactive genome browser in R
The aim of this project is to provide an interactive and convenient approach to visualize track-based genomic data in R, that is, to provide a simple genome browser within R environment to view objects in bioconductor like GRanges, GRangesList, TxDb, EnsDb.
[Read More]