Articles by January

Colorful tables in a terminal

July 20, 2020 | January

It all started when I wanted to have significant p-values shown on the terminal colored in red. The R terminal is capable of showing colors, simple formatting (like italics or bold) and Unicode characters, thanks to the actual terminal that does the job of displaying R output – whether it is ... [Read more...]

rmd syntax highlighting in vim

September 19, 2019 | January

Quick and dirty Rmarkdown syntax highlighting for vim, when you don’t have time install bundles, plugins or dependencies: go to this github repository, download the file rmd.vim from the syntax/ directory and copy it to ~/.vim/syntax/. This should work in 99,99% of the cases. [Read more...]

Custom comparison function for sorting data in R

April 11, 2017 | January

Many languages allow you to use a custom comparison function in sorting. R is not an exception, but it is not entirely straightforward – it requires you to define a new class and overload certain operators. Here is how to do it. Consider the following example. You have a certain number ...
[Read more...]

R-devel in parallel to regular R installation

July 1, 2015 | January

Unfortunately, you need both: R-devel (development version of R) if you want to submit your packages to CRAN, and regular R for your research (you don’t want the unstable release for that). Fortunately, installing R-devel in parallel is less trouble than one might think. Say, we want to install ... [Read more...]

Presentations in (R)markdown

June 24, 2015 | January

There are many ways to turn a markdown or Rmarkdown document into a presentation. Way too many, and none of them is perfect. I made my first presentation with knitr / Rmarkdown for the tmod package. After trying various options in knitr, I decided on an approach in which the Rmarkdown ...
[Read more...]

Kneat tricks

June 18, 2015 | January

So I have finally switched to knitr for doing my vignettes. The result is satisfactory, but the process was not entirely painless. The command to run instead of “R CMD Sweave foo.Rnw” is Rscript -e 'rmarkdown::render("foo.rmd")' I think that the concept of writing a package ... [Read more...]

pandoc, markdown and pander

April 23, 2015 | January

Pandoc + markdown seem to be a great way of documenting my work. Markdown syntax is very simple and allows to add basic formatting and figures to an otherwise simple text document, without obfuscating the actual text. Then I simply compile the document using the pandoc command: There are some more ... [Read more...]

Creating a graph with variable edge width in Rgraphviz

March 26, 2015 | January

This was waaaaay more complicated than necessary. Figuring it out took me almost a whole day. In essence, there is the graph package in R, which provides graph objects and methods, and there is the Rgraphviz package, which allows you to plot the graphs on the screen. They work well. ...
[Read more...]

Adding authentication to a shiny server

December 5, 2014 | January

Umph, that was a tough one. I spent ages figuring out how to do it correctly. I have a server running apache (on port 80) and shiny on port (say) 11111. Shiny has its own document root, and within this root, we have a shiny app, say, “example”. So to view this ... [Read more...]

tagcloud: creating tag / word clouds

November 5, 2014 | January

May I present my new package: tagcloud. Tag clouds is for creating, um, tag clouds (aka word clouds). It is based on the code from the wordcloud package, but (i) has no tools for analysing word frequencies, instead (ii) focuses on doing better tag clouds. As to (ii), it adapts ...
[Read more...]

Troubles with sapply

October 2, 2014 | January

Say your function in sapply returns a matrix with a variable number of rows. For example sapply is too stupid to see the pattern here (or maybe I don’t know how to cast the return value into an appropriate shape…). The result of the above is a list: [[1]] [,1] [,2] [,3] [1,] 1 1 […] [Read more...]

The biomaRt package

October 2, 2014 | January

The biomaRt package allows to query the gigantic ensembl data base directly from R. Since it happens only once in a while, I find myself reading the biomaRt vignette every time I’m using it. Here are the crucial points for the most common application. The data frames f and ... [Read more...]

Pathway analysis in R and BioConductor.

August 28, 2014 | January

There are many options to do pathway analysis with R and BioConductor. First, it is useful to get the KEGG pathways: Of course, “hsa” stands for Homo sapiens, “mmu” would stand for Mus musuculus etc. Incidentally, we can immediately make an analysis using gage. However, gage is tricky; note that ... [Read more...]

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)