All Posts

Drag and Drop in Shiny

Shiny application is a great way to deliver the result of statistical analysis, especially when it must be reproducible. I don’t know why, but people prefer to use graphic interface, rather than run scripts;) One of my clients recently requested to have an ability to move around elements in the dashboard. There are some R packages to attain such effect, and possibly it would be a bit easier to use them, but I had an unfinished project called dragulaR.

RNews - 2017-11-19

Here is a small pack of some engaging news from R’s world gathered from Twitter in the last week. R Tips http://www.storybench.org/convert-google-doc-rmarkdown-publish-github-pages/ - title speaks for itself - it shows how to convert GoogleDocs to Rmarkdown format. http://blog.jumpingrivers.com/posts/2017/speed_package_installation/ - in short - options(Ncpus = 6) - allows to use multicores in install.packages, which can significantly speed up the packages’ installation process. Packages https://www.tidyverse.org/articles/2017/11/withr-2.1.0/ - allows a user to call code in a special environment with some global variables alerted.

RNews - 2017-11-05

Here is a small pack of some engaging news from R’s world gathered from Twitter in the last week. Articles https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/ - minimal amount of knowledge about Unicode. The article is targeted to developers, but it might also be useful for Data Scientists. I highly recommend other posts on that blog - the host is one of the creators of VBA in Excel, Trello, and StackOverflow. https://imgur.com/gallery/GD5gi - visualization of the sorting algorithms.

Another note on memory management in R

In the last post where I described one issue related to usage of R’s data structures inside C++ code. The problem was caused by memory management system in R, which allows R to store two variables in the same place in the memory just after making an assignment. See the following snippet: #include <Rcpp.h> #include <vector> // [[Rcpp::plugins(cpp11)]] // [[Rcpp::export]] void change(Rcpp::NumericVector x) { // The C++ function does not return anything (it's void), // it only modifies the first element of the vector.

R's structures inside C++

Connecting R with C++ is very easy because near all work needed to glue the code together is done by Rcpp. However, there are some very dangerous traps. C++, when used improperly can mess up a lot of things in the R session. In this post, I want to show you how to write secure C++ code to reduce the chances of breaking anything in R. References. When working with R, we usually do not care if the object is copied or not.

The power of Progress Bar

In the last post, I wrote some notes about code optimization using Rcpp and C++. However, I forgot to add one main thought related to this topic: “The First Rule of Program Optimization: Don’t do it. The Second Rule of Program Optimization (for experts only!): Don’t do it yet.” I agree with that statement, and I made this mistake more than dozen times. I spent hours on optimizing the code, trying to get the results faster, and I most cases I succeed.