Questions tagged [standard-evaluation]

24 questions
1
vote
1 answer

SE issue with conditional mutate

I'm trying to do a simple conditional with mutate. The code should create a new variable called "gender" based on two variables from same dataframe. sample <- data.frame( client = c("john", "peter", "hanna", "lisa"), id = c(100, 400, 650,…
Prometheus
  • 1,977
  • 3
  • 30
  • 57
1
vote
1 answer

How should I use the uq() function inside a package?

I'm puzzled by the behaviour of the uq() function. The behavior is not the same when I use uq() or lazyeval::uq(). Here is my reproducible example : First, I generate a fake dataset library(tibble) library(lazyeval) fruits <- c("apple", "banana",…
PAC
  • 5,178
  • 8
  • 38
  • 62
1
vote
1 answer

Standard evaluation with mutate_ to calculate percentages by group

I am trying to use standard evaluation with dplyr to calculate percents as a function of two grouping variables. The problem is in my mutate_ statement. Here is a dataset: structure(list( var1 = structure(c(2L, 1L, 1L, 2L, 1L, 2L, 1L, 2L,…
Chris
  • 51
  • 5
1
vote
1 answer

Why do i got different results using SE or NSE dplyr functions

Hi I got differents results from dplyr function when I use standard evaluation through lazyeval package. Here is how to reproduce something close to my real datas with 250k rows and about 230k groups. I would like to group by id1, id2 and subset the…
Julien Navarre
  • 7,653
  • 3
  • 42
  • 69
1
vote
1 answer

plyr functions and standard evaluation

I would like to wrap plyr functions in my own functions. I want to pass to the function an object and the variable (unquoted) on which apply a cut function. x <- data.frame(time = seq(Sys.Date() - 99, Sys.Date(), 1)) dlply(x, .(week = cut(time, "1…
Julien Navarre
  • 7,653
  • 3
  • 42
  • 69
0
votes
1 answer

R - Defining a function which recognises arguments not as objects, but as being part of the call

I'm trying to define a function which returns a graphical object in R. The idea is that I can then call this function with different arguments multiple times using an for loop or lapply function, then plotting the list of grobs in…
0
votes
0 answers

dplyr mutate use standard evaluation

I would like to reference in a dplyr mutate phrase to an object which includes the variable name in my data frame. How can I use standard evaluation in my case: Here is some dummy…
Fred
  • 35
  • 1
  • 3
0
votes
1 answer

R dplyr resolve variable in conditional filter

I am trying to filter based on a variable value, and have tried multiple combinations of filter_, dots and quotes to no avail. As an example, I have a runlist = c(1, 2, 3, 4, 5) and a dataframe boo run <- rep(seq(5), 3) edge1 <- sample(20,…
zazizoma
  • 437
  • 1
  • 7
  • 18
0
votes
0 answers

standard evaluation version of dplyr filter appears to be ignored

I'm trying to write a function in which a user will specify a dataframe and a column name (string) and have the string be passed to the dplyr filter function. I am confident that I am supposed to be using filter_, but I cannot seem to get it to…
joemienko
  • 2,220
  • 18
  • 27
1
2