-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ggscatter cannot handle non-standard column names | Error in FUN(X[[i]], ...) : object 'B' not found #229
Comments
fixed now, thanks |
Awesome, thanks! |
Supporting non standard column breaks many other ggplot2 functionality. So, I think we should remove support to non-standard column names. |
Now # Data
data("mtcars")
df <- mtcars[, c("wt", "mpg")]
colnames(df) <- c("A-A", "B-B")
# Plotting after inactivating parsing
old_options <- options(ggpubr.parse_aes = FALSE)
p <- ggscatter(df, x = "A-A", y = "B-B" )
# restore back old settings
options(old_options) |
Preface
I am an r-newbie, so I'm not sure whether this is an issue or expected behavior and whether this is a
ggpubr
orggplot2
issue.Expected behavior
Given a
data.frame
with column names that are non-valid variable names, ggscatter produces a plot given the appropriate x and y column names.Observed behavior
Despite being able to access those columns from the
data.frame
in the console, ggscatter chokes if given a data.frame with non-valid column names and the corresponding x and y column names.MCVE
Let's make two
data.frames
, one withcheck.names = FALSE
(i.e. with non-valid variable name columns) and one withcheck.names = TRUE
. We can access columns with data from each of these frames without a problem:When we try to plot the columns using ggscatter, we get an error if we left check.names = TRUE:
If we use the frame with the checked names and the appropriate corrected column names, the function succeeds.
The text was updated successfully, but these errors were encountered: