rlang Questions
4
Solved
aes_string had some convenient behaviours that I made use of when programming with ggplot2. But aes_string has been deprecated (noticeably since ggplot2 version 3.4.0 I believe). I am struggling wi...
Limburg asked 12/11, 2022 at 15:39
1
Solved
I have a function that generates an unwanted warning, but keeps the value.
f <- function(a) {
if (a > 1) {
warning("an uninformative warning")
}
a
}
g1 <- function(b) {
...
Freidafreight asked 12/12, 2023 at 15:16
5
Solved
I'm trying to install the 'lifecycle' package but rlangs is required.
Upon typing install.packages('lifecyle') I get the error that I'm importing a rlangs package which is newer than required ('rla...
Phonetics asked 24/3, 2021 at 14:3
2
As part of a pipeline, I'd like to take a data frame or tibble and rename a subset of columns, specified by a vector of position indices, with the new column names as a function of their index rath...
3
Solved
I noticed this behavior below when
I used dplyr::case_when instead of if in reference to this article.
If the output of the second branch is an explicit string, it works as intended, but if the x i...
1
I'm currently co-developing an R package using devtools. We use the
tidyverse %>% and associated purrr and dplyr packages within our
functions.
One of our functions is as follows (edited for cla...
4
Solved
I have been having some issues accessing an updated version of a package in R.
On running a workflow for data analysis I got this error message:
library(dplyr)
Error: package or namespace load...
2
I'm struggling to understand how to use the {{ }} operator to pass bare variable names in custom functions. I get an error when I use the operator in conjunction with an if clause.
This function wo...
2
Solved
I am using !!! (splice operator/big bang operator) for ggplot2::geom_point() function, and it fails. Could someone point out what is wrong with this code? The following code tries to execute ggplot...
5
This is the error message:
Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
namespace ‘rlang’ 0.3.4 is already loaded,...
2
Solved
Can anybody explain, please, what for do we need !!, !!! or {{}} operators from rlang? I tried to learn more about quasiquotation but did not get anything.
I've reached several posts on curly-curly...
Breastplate asked 30/8, 2021 at 12:44
2
Solved
I'm writing a function where I supply a variable name as a symbol. At a different step in the function, I want to use the variable name as a string. Per the documentation, rlang::as_string "co...
6
Solved
Is there a way to dynamically/programmatically generate case_when conditions in dplyr with different column names and/or different numbers of conditions? I have an interactive script that I'm tryin...
5
Solved
I am once again confused about how to achieve this:
Given this data frame:
df <- tibble(
foo = c(1,0,1),
bar = c(1,1,1),
foobar = c(0,1,1)
)
And this vector:
to_sum <- c("foo", ...
3
Solved
I've been trying for awhile to combine mutate_at with coalesce in case in which names of columns are generated dynamically.
In my example there are only five columns, but in the real data there are...
4
Solved
With dplyr starting version 0.7 the methods ending with underscore such as summarize_ group_by_ are deprecated since we are supposed to use quosures.
See:
https://cran.r-project.org/web/packages/d...
2
Solved
Is it possible to use the rlang tidy evaluation operator {{ within an lm formula?
I know that you can use the double curly braces to define a general function such as this:
my_scatter <- functio...
9
I want to use variable names as strings in functions of dplyr. See the example below:
df <- data.frame(
color = c("blue", "black", "blue", "blue", "black"),
value = 1:5)
filter(df, color ==...
3
Solved
dplyr/rlang: parse_expr with multiple expressions
For example if i want to parse some string to mutate i can
e1 = "vs + am"
mtcars %>% mutate(!!parse_expr(e1))
But when i want to parse any t...
3
Solved
I want to have a flexible function using summarize in which:
the aggregation function is given by user
the aggregation function might use further arguments which refer to variables within the data...
3
Solved
I'm trying to write a function that takes as one of its arguments a vector of column names from user. The column names will be used to specify what columns of the dataframe will be pasted together ...
1
Solved
I saw Hadley's talk at RConf and he mentioned using double brackets for calling variables in tidy evals.
I searched Google but I couldn't find anything talking about when to use them.
What's the us...
Wizardry asked 25/9, 2020 at 13:21
3
Solved
My question is similar to this question but I need to apply a more complex function across columns and I can't figure out how to apply Lionel's suggested solution to a custom function with a scoped...
Sergo asked 5/8, 2020 at 2:37
2
Solved
I'm trying to install the dev version of tidyr. When I try devtools::install_github("tidyverse/tidyr") or remotes::install_github("tidyverse/tidyr"), I get the following error:
> devtools::inst...
Brownlee asked 23/4, 2019 at 1:18
1
Solved
I just came across the "embracing operator" {{ }} in section 2.2.3 of the tidyverse style guide.
What does the embracing operator {{ }} do in R?
1 Next >
© 2022 - 2024 — McMap. All rights reserved.