R Tip: Use seqi() For Indexes
R Tip: use seqi() for indexing. R‘s “1:0 trap” is a mal-feature that confuses newcomers and is a reliable source of bugs. This note will show how to use seqi() to write more reliable code and document intent.
R Tip: use seqi() for indexing. R‘s “1:0 trap” is a mal-feature that confuses newcomers and is a reliable source of bugs. This note will show how to use seqi() to write more reliable code and document intent.
If your R or dplyr work is taking what you consider to be a too long (seconds instead of instant, or minutes instead of seconds, or hours instead of minutes, or a day instead of an hour) then try data.table. For some tasks data.table is routinely faster than alternatives at […]
Today’s R tip is: put your values in columns.
R tip: consider using radix sort.
Introduction In this note we will show how to speed up work in R by partitioning data and process-level parallelization. We will show the technique with three different R packages: rqdatatable, data.table, and dplyr. The methods shown will also work with base-R and other packages. For each of the above […]
We are pleased to announce that seplyr version 0.5.8 is now available on CRAN. seplyr is an R package that provides a thin wrapper around elements of the dplyr package and (now with version 0.5.8) the tidyr package. The intent is to give the part time R user the ability […]
R Tip: be wary of “…“. The following code example contains an easy error in using the R function unique(). vec1 <- c("a", "b", "c") vec2 <- c("c", "d") unique(vec1, vec2) # [1] "a" "b" "c" Notice none of the novel values from vec2 are present in the result. Our […]
R Tip: use isTRUE(). A lot of R functions are type unstable, which means they return different types or classes depending on details of their values. For example consider all.equal(), it returns the logical value TRUE when the items being compared are equal: all.equal(1:3, c(1, 2, 3)) # [1] TRUE […]
R tip: use slices. R has a very powerful array slicing ability that allows for some very slick data processing.
R has a lot of under-appreciated super powerful functions. I list a few of our favorites below. Atlas, carrying the sky. Royal Palace (Paleis op de Dam), Amsterdam. Photo: Dominik Bartsch, CC some rights reserved.