All Posts

Scala in knitr

I use blogdown to write my blog posts. It allows me to create a Rmarkdown file, and then execute all the code and format the output. It has great support for R (it’s R native) and Python. Some other languages are also supported, but the functionality is pretty limited. For example, each code chunk is evaluated in a separate session (I’m not sure if it’s the case for all engines, I read about this in https://yihui.


One of the most important things in software development and data analysis is to manage your dependencies, to make sure that your work can be easily replicated or deployed to the production. In R’s ecosystem, there are plenty of tools and materials on this topic. There’s a short list: However, I’m starting to spend a bit more time in the Python world, where I don’t have a lot of experience.

ggplot2 with 2 y-axes

On one of my R workshops, someone asked me about creating a ggplot2 with two Y-axes. I do not use such types of plots, because I read somewhere that they have some problems with perception. However, I committed myself to check if it’s possible to create such visualizations using ggplot2. Without a lot of digging, I found this answer from the author of the ggplot2 package on StackOverflow - He thinks that those types of plots are bad, fundamentally flawed, and you shouldn’t use them, and ggplot2 does not allow to create them.

Create pptx in R using officer package

When you need to create a pptx file in R, the best way is to use an officer package. officer is quite easy to use and the documentation is quite extensive so that I won’t describe the basics ( - link to the officer‘s docs). However, I always have some problems with specifying the proper parameters for the ph_with_* functions, especially the type and index parameters. Of course one can use the ph_with_*_at versions, but it requires to manually adjust all the coordinates, which might be even more problematic.

Type-S Errors.

I’m a big fan of Andrew’s Gelman blog ( I think that my statistical intuition is way much better after reading it. For example, there’s a post about different types of errors in NHST, not limited to the widely known Type I and Type II errors - You should read this before continuing because the rest of this post will be based on it, and the article which is linked in that post (http://www.

Calculate the font size for the R's flextable package.

The flextable table is an excellent package for creating beautiful tables, especially if you want to export them to the pptx file. However, it might be a bit problematic to set the proper font size for the given size of the table. E.g., I have a table with five rows (+ 1 header row), and I want to create a table which height is 2 inches. What’s the best font size for this setting?


In one of my projects, I had to choose which language I would use to write some small module - C, C++ or Lua. I didn’t want to use C, because the module required a lot of string handling. Another option was C++, but some other parts of the system were written in Lua, so I thought it would be much easier to integrate everything without switching languages, and I had heard some good things about Lua, so in the end, I decided to give it a shot.

Some materials for learning a Deep learning and NLP

Here is my short list of materials related to Deep Learning and NLP that I found useful during my exploration of this topics. I don’t think that this list is exhaustive, but maybe you will find something useful;) Videos: General introduction: - an introduction to Deep Learning focused on examples. There are a lot of Jupyter notebooks supplementing the course - - Deep Learning specialization from Andrew Ng.

Deploying Shiny Apps

Shiny apps are a very convenient way of sharing your work with others, especially with non-technical co-workers. The best way is to deploy your app somewhere on the internet (or intranet), so the user won’t need to install R, packages, and other stuff, let alone the need for easy updates. There’re a few ways to host your applications, and all of them comes with some pros and cons: Shinyapps The most natural solution is to put your app on the shinyapps.

Dynamic modules in shiny - Part II

In the previous post about shiny modules, I described how to dynamically add new modules, or even select a module type from a few possibilities. The main problem was that the new module is added inside an observer function, so we cannot directly get the returned value of the new modules. However, we can solve this problem quite easily using reactiveValues. We just add a parameter to the module’s server function in which we will send the reactive value used to communicate between the main application and the module.