You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When answering this question on SO I stumbled over an issue with ggcorr when column names are not syntactically valid variable names. In that case the column names are converted to syntactically valid names and all "special" symbols are replaced by dots.
A "hacky" workaround would be to manipulate the ggplot object returned by ggcorr and to replace the diagLabel column containing the labels with the original column names.
Note: This requires to identify the correct geom_text layer which adds the labels stored in the diagLabel column, i.e. the one with mapping: label = ~diagLabel .
p<- ggcorr(ex_db)
p$layers[[2]]$data[c("diagLabel")] <- names(ex_db)
p
Haha. Not a fan of hacky approaches either. Was just meant as a workaround for people who can't wait until the issue is fixed.
From my understanding it would probably be safe to simply set check.names=FALSE when converting the correlation matrix to a data.frame. But I haven't checked whether this causes some issues downstream.
When answering this question on SO I stumbled over an issue with
ggcorr
when column names are not syntactically valid variable names. In that case the column names are converted to syntactically valid names and all "special" symbols are replaced by dots.A minimal reproducible example of the issue:
Created on 2023-05-11 with reprex v2.0.2
IMHO the issue is that when converting the correlation matrix to a dataframe using
data.frame()
the defaultcheck.names=TRUE
is used:ggally/R/ggcorr.R
Line 220 in 4d8fa81
A "hacky" workaround would be to manipulate the
ggplot
object returned byggcorr
and to replace thediagLabel
column containing the labels with the original column names.Note: This requires to identify the correct
geom_text
layer which adds the labels stored in thediagLabel
column, i.e. the one withmapping: label = ~diagLabel
.Created on 2023-05-11 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: