Error in `geom_histogram()`:
! Problem while computing stat.
ℹ Error occurred in the 1st layer.
Caused by error in `setup_params()`:
! `stat_bin()` requires a continuous x aesthetic.
✖ the x aesthetic is discrete.
ℹ Perhaps you want `stat="count"`?
2.2 Strategy 1: Use tidy pronouns
Tidyverse functions that feature tidy evaluation support the .data and .env pronouns
The .data pronoun is a representation of the original data which can be used in a masked environment
Sometimes, masked expressions can simply be constructed as strings
One example are formulas (e.g. in lm(y ~ x1 + x2))
The as.formula function can create formula objects manually
linreg <-function(df, y, x) { fm <-paste(y, "~", paste(x, collapse =" + ")) fm <-as.formula(fm)lm(fm, data = df)}linreg(ess, y ="trust_eu", x =c("age", "left_right"))
2.4 Strategy 3: Change names
In case of poorly implemented data masking, no tools are available to inject variables
One strategy to overcome such situations could be to simply change the object names