Posts Tagged ‘ coding ’

R Tip: Make Arguments Explicit in magrittr/dplyr Pipelines

March 1, 2018
By

I think this is the R Tip that is going to be the most controversial yet. Its potential pitfalls include: it is a style prescription (which makes it different than and less immediately useful than something of the nature of R Tip: Force Named Arguments), and it is heterodox (this is not how magrittr/dplyr is … Continue reading R Tip: Make Arguments Explicit in magrittr/dplyr Pipelines

Read more »

Wanted: cdata Test Pilots

February 25, 2018
By
Wanted: cdata Test Pilots

I need a few volunteers to please “test pilot” the development version of the R package cdata, please. Jacqueline Cochran: at the time of her death, no other pilot held more speed, distance, or altitude records in aviation history than Cochran. Our cdata package is using an upcoming new feature called “build_frame()” that allows for … Continue reading Wanted: cdata Test Pilots

Read more »

Is R base::subset() really that bad?

February 23, 2018
By
Is R base::subset() really that bad?

Is R base::subset() really that bad? Notes discussing subset() often refer to the following text (from help(subset), referred to in examples: 1, 2): Warning This is a convenience function intended for use interactively. For programming it is better to use the standard sub-setting functions like [, and in particular the non-standard evaluation of argument subset … Continue reading Is R base::subset() really that bad?

Read more »

R Tip: Force Named Arguments

February 22, 2018
By

R tip: force the use of named arguments when designing function signatures. R’s named function argument binding is a great aid in writing correct programs. It is a good idea, if practical, to force optional arguments to only be usable by name. To do this declare the additional arguments after “...” and enforce that none … Continue reading R Tip: Force Named Arguments

Read more »

R Tip: Use [[ ]] Wherever You Can

February 21, 2018
By

R tip: use [[ ]] wherever you can. In R the [[ ]] is the operator that (when supplied a simple scalar argument) pulls a single element out of lists (and the [ ] operator pulls out sub-lists). For vectors [[ ]] and [ ] appear to be synonyms (modulo the issue of names). However, … Continue reading R Tip: Use [[ ]] Wherever You Can

Read more »

R Tip: Use qc() For Fast Legible Quoting

February 17, 2018
By

Here is an R tip. Need to quote a lot of names at once? Use qc(). This is particularly useful in selecting columns from data.frames: library("wrapr") # get qc() definition head(mtcars[, qc(mpg, cyl, wt)]) # mpg cyl wt # Mazda RX4 21.0 6 2.620 # Mazda RX4 Wag 21.0 6 2.875 # Datsun 710 22.8 … Continue reading R Tip: Use qc() For Fast Legible Quoting

Read more »

Is 10,000 Cells Big?

February 13, 2018
By
Is 10,000 Cells Big?

Trick question: is a 10,000 cell numeric data.frame big or small? In the era of "big data" 10,000 cells is minuscule. Such data could be fit on fewer than 1,000 punched cards (or less than half a box). The joking answer is: it is small when they are selling you the system, but can be … Continue reading Is 10,000 Cells Big?

Read more »

Base R can be Fast

January 15, 2018
By
Base R can be Fast

“Base R” (call it “Pure R”, “Good Old R”, just don’t call it “Old R” or late for dinner) can be fast for in-memory tasks. This is despite the commonly repeated claim that: “packages written in C/C++ are (edit: “always”) faster than R code.” The benchmark results of “rquery: Fast Data Manipulation in R” really … Continue reading Base R can be Fast

Read more »

How to Avoid the dplyr Dependency Driven Result Corruption

December 6, 2017
By

In our last article we pointed out a dangerous silent result corruption we have seen when using the R dplyr package with databases. To systematically avoid this result corruption we suggest breaking up your dplyr::mutate() statements to be dependency-free (not assigning the same value twice, and not using any value in the same mutate it … Continue reading How to Avoid the dplyr Dependency Driven Result Corruption

Read more »

Win-Vector LLC announces new “big data in R” tools

November 29, 2017
By
Win-Vector LLC announces new “big data in R” tools

Win-Vector LLC is proud to introduce two important new tool families (with documentation) in the 0.5.0 version of seplyr (also now available on CRAN): partition_mutate_se() / partition_mutate_qt(): these are query planners/optimizers that work over dplyr::mutate() assignments. When using big-data systems through R (such as PostgreSQL or Apache Spark) these planners can make your code faster … Continue reading Win-Vector LLC announces new “big data in R” tools

Read more »


Subscribe

Email:

  Subscribe