Posts Tagged ‘ wrapr for sweet R ’

Using wrapr::let() with tidyeval

June 28, 2017
By

While going over some of the discussion related to my last post I came up with a really neat way to use wrapr::let() and rlang/tidyeval together. Please read on to see the situation and example.Suppose we want to parameterize over a couple of names, one denoting a variable coming from the current environment and one … Continue reading Using wrapr::let() with tidyeval

Read more »

Please Consider Using wrapr::let() for Replacement Tasks

June 26, 2017
By

From dplyr issue 2916. The following appears to work. suppressPackageStartupMessages(library("dplyr")) COL <- "homeworld" starwars %>% group_by(.data[[COL]]) %>% head(n=1) ## # A tibble: 1 x 14 ## # Groups: COL [1] ## name height mass hair_color skin_color eye_color birth_year ## <chr> <int> <dbl> <chr> <chr> <chr> <dbl> ## 1 Luke Skywalker 172 77 blond fair blue … Continue reading Please Consider Using wrapr::let() for Replacement Tasks

Read more »

Why to use wrapr::let()

May 2, 2017
By
Why to use wrapr::let()

I have written about referential transparency before. In this article I would like to discuss “leaky abstractions” and why wrapr::let() supplies a useful (but leaky) abstraction for R programmers. Abstractions A common definition of an abstraction is (from the OSX dictionary): the process of considering something independently of its associations, attributes, or concrete accompaniments. In … Continue reading Why to use wrapr::let()

Read more »

wrapr: for sweet R code

March 1, 2017
By
wrapr: for sweet R code

This article is on writing sweet R code using the wrapr package. The problem Consider the following R puzzle. You are given: a data.frame, the name of a column that you wish to find missing values (NA) in, and the name of a column to land the result. For instance: d <- data.frame(x = c(1, … Continue reading wrapr: for sweet R code

Read more »


Subscribe

Email:

  Subscribe