Posts Tagged ‘ dplyr ’

R Tip: Think in Terms of Values

April 2, 2018
By

R tip: first organize your tasks in terms of data, values, and desired transformation of values, not initially in terms of concrete functions or code. I know I write a lot about coding in R. But it is in the service of supporting statistics, analysis, predictive analytics, and data science. R without data is like … Continue reading R Tip: Think in Terms of Values

Read more »

R Tip: Use let() to Re-Map Names

March 26, 2018
By
R Tip: Use let() to Re-Map Names

Another R tip. Need to replace a name in some R code or make R code re-usable? Use wrapr::let(). Here is an example involving dplyr. Let’s look at some example data: library("dplyr") library("wrapr") starwars %>% select(., name, homeworld, species) %>% head(.) # # A tibble: 6 x 3 # name homeworld species # <chr> <chr> … Continue reading R Tip: Use let() to Re-Map Names

Read more »

R Tip: Break up Function Nesting for Legibility

March 21, 2018
By
R Tip: Break up Function Nesting for Legibility

There are a number of easy ways to avoid illegible code nesting problems in R. In this R tip we will expand upon the above statement with a simple example. At some point it becomes illegible and undesirable to compose operations by nesting them, such as in the following code. head(mtcars[with(mtcars, cyl == 8), c("mpg", … Continue reading R Tip: Break up Function Nesting for Legibility

Read more »

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 »

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 »

Supercharge your R code with wrapr

January 27, 2018
By
Supercharge your R code with wrapr

I would like to demonstrate some helpful wrapr R notation tools that really neaten up your R code. Img: Christopher Ziemnowicz. Named Map Builder First I will demonstrate wrapr‘s "named map builder": :=. The named map builder adds names to vectors and lists by nice "names on the left and values on the right" notation. … Continue reading Supercharge your R code with wrapr

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 »

Getting started with seplyr

December 14, 2017
By
Getting started with seplyr

A big “thank you!!!” to Microsoft for hosting our new introduction to seplyr. If you are working R and big data I think the seplyr package can be a valuable tool. For how and why, please check out our new introductory article. Note: now that wrapr version 1.0.2 is up on CRAN all of the … Continue reading Getting started with seplyr

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 »

Please inspect your dplyr+database code

December 2, 2017
By

A note to dplyr with database users: you may benefit from inspecting/re-factoring your code to eliminate value re-use inside dplyr::mutate() statements. If you are using the R dplyr package with a database or with Apache Spark: I respectfully advise you inspect your code to ensure you are not using any values created inside a dplyr::mutate() … Continue reading Please inspect your dplyr+database code

Read more »


Subscribe

Email:

  Subscribe