Please use this tag for questions about using tidy evaluation within the tidyverse framework. For more information please refer to this handbook: https://tidyeval.tidyverse.org/
Questions tagged [tidyeval]
473 questions
0
votes
0 answers
rlang: Input should be both a symbol and a string
So I need one of the arguments to be a symbol and the usual !!enquo(column) works, but I also need to make a dplyr join latter in the code using the same column.
Is there a problem with this? The code works I just want to know if it is correct.
f…

xhr489
- 1,957
- 13
- 39
0
votes
1 answer
Error getting column name using R tidyeval
I am writing a generalized lookup function to execute against a tibble. When I run the code below, I get "Error: object 'x' not found"
My real function returns a different error message, but I think some guidance on this will help.
See the code…

Charles Knell
- 117
- 1
- 9
0
votes
1 answer
How do I capture the argument to a function and apply them as is in another context/environment
I am pretty sure my language is imprecise, but I don't know the correct terms yet. This is what I wanted to achieve:
I have a function abc2. I want to obtain the arguments to them (without evaluating or changing the argument) provided by the user,…

xiaodai
- 14,889
- 18
- 76
- 140
0
votes
1 answer
Tidyeval in a function with dplyr and ggplot2
So I create the name with :=, but I want to use it in ggplot2 as y which does not seem to work.
library(tidyverse)
date_group_plot_line <- function(df, group_col, summarise_col) {
group_col <-enquo(group_col)
summarise_col <-…

xhr489
- 1,957
- 13
- 39
0
votes
1 answer
Using the pipe in selfmade function with tidyeval (quo_name)
I have two functions: date_diff and group_stat. So I have read this article tidyverse and I try so create simple functions and use the pipe.
The first function creates a difftime and names them timex_minus_timey but when I pipe this result into the…

xhr489
- 1,957
- 13
- 39
0
votes
1 answer
Set paramenter of a function using difftime and dplyr
How can I set the paramenter units ="mins" in the following function as a parameter?
This is just the data frame:
library(tidyverse)
u <- runif(10, 0, 60)
w <- runif(10, 0, 60)
df <- tibble(time_1 = as.POSIXct(u, origin = "2019-02-03…

xhr489
- 1,957
- 13
- 39
0
votes
1 answer
How can I use Quasiquotation in the context of tidyeval in tidyverse scoped verbs or a mapper?
I am having trouble using the special operator := (colon-equals) in a mapper function. I have found a workaround using a scoped-verb from the tidyverse but I would like to know in what way the special operator is implemented in a mapper…

mral
- 118
- 1
- 8
0
votes
1 answer
Parsing overloaded column in dataframe - creating multiple columns with one mutate statement
I have an overloaded column, overloadedin a dataframe containing values like 143 or 23 or 12789.
df <- data_frame(id = 1:3,
overloaded = c("145", "459", "2"))
I want to parse this column into 9 new boolean columns.
df %>%
…

Rickard
- 3,600
- 2
- 19
- 22
0
votes
1 answer
How to pass a list of of variables to a function but also considering quosures and quoting
I'd like to pass a list of variables to a function, but I'm confused by the quoting and quosures.
Normally, I want to return a df after some kind of data management has been done--after the function has been applied to several variables.
As it is…

23stacks1254
- 369
- 1
- 9
0
votes
1 answer
Downloading/installing package from github converting underlying R code
I have a private R package on github that I have made.
I make use of !!rlang::sym(function_argument) frequently to accept inputs from functions and use with tidyverse.
For example:
example_function = function(x){
new = mtcars %>%…

runningbirds
- 6,235
- 13
- 55
- 94
0
votes
1 answer
Function issue. Tidyeval filtering
What is wrong here? This works:
iris %>%
filter(Species == "setosa") %>%
summarise(msl = mean(Sepal.Length), msw = mean(Petal.Width))
and produces:
msl msw
1 5.006 0.246
But this function doesn't work:
means <- function(data, value){
…

william3031
- 1,653
- 1
- 18
- 39
0
votes
1 answer
Using tidy evaluation function inside mutate without explicit reference to original dataframe
I'd like to create a function that works inside of mutate. As a simple example, I can get this to work:
library(tidyverse)
# Toy Data
df <- tibble::tribble(
~id, ~first_name, ~gender, ~height,
1, "john", "m", 71,
2, "jane", …

Brad Cannell
- 3,020
- 2
- 23
- 39
0
votes
1 answer
Passing columns names to group_by and ggplot2 within a custom function
My data-frame has multiple categorical columns, I want to compare each column the with fixed column and generate the bar graph with facet_grid(). For that I want to write a function.
library(rlang)
library(tidyverse)
qw <- structure(list(weekday =…

dondapati
- 829
- 6
- 18
0
votes
2 answers
Filter Dataframe with Tidy Evaluation
I am handling a large dataset. First, for certain columns (X1, X2, ...), I am trying to identify a range of value (a, b) consists of repeated value (a > n, b > n). Next, I wish to filter row based on the condition which matches respective columns to…

ThomasJc
- 131
- 9
0
votes
0 answers
Color plotly with tidyeval
I'm trying to create a plotly barchart using some tidyeval functionality. I have succeeded in creating a simple barchart but can not seem to make a stacked barchart colored by an attribute. Have been stuck at this for a while and cannot seem to…

Mridul Garg
- 477
- 1
- 8
- 17