laresbernardo / lares

Analytics & Machine Learning R Sidekick
https://laresbernardo.github.io/lares/
233 stars 49 forks source link

Error in `combine_vars()`: ! Faceting variables must have at least one value #52

Closed joaomaroco closed 8 months ago

joaomaroco commented 8 months ago

Hi there,

Thanks for the lares package.

I have this dataframe pisameans.zip

And I want to get a correlation plot with of one variable in the df vs all the others.

I am using

corr_cross(pmeans[,-c(1:2)], contains = c("BELONG"))

but I get this error:

Error in `combine_vars()`:
! Faceting variables must have at least one value
Run `rlang::last_trace()` to see where the error occurred.
Warning message:
Problem while computing `hjust = ifelse(.data$abs < max(.data$abs)/1.5, -0.1, 1.1)`.
ℹ no non-missing arguments to max; returning -Inf 

I don't use a facet (as in ggplot?) . Is this a bug?

Thanks!

laresbernardo commented 8 months ago

Hi @joaomaroco thanks for reporting this issue.

Not sure what went wrong on your side given I wasn't able to replicate the issue with the dataset and code you shared.

pmeans <- readRDS("/Users/bernardo/Desktop/pisameans.rds")
corr_cross(pmeans[,-c(1:2)], contains = c("BELONG"))

And returned:

image

What version are you currently using?

laresbernardo commented 8 months ago

Btw, if you're interested in only the correlation between a variable and the rest, is more straightforward to use corr_var:

corr_var(pmeans, BELONG)

Which will print you this:

image

joaomaroco commented 8 months ago

PERFECT!!! That is exactly what I wanted!. Thank you so much. Com os melhores cumprimentos, João


From: laresbernardo @.> Sent: Wednesday, February 7, 2024 3:41 PM To: laresbernardo/lares @.> Cc: João Marôco @.>; Mention @.> Subject: Re: [laresbernardo/lares] Error in combine_vars(): ! Faceting variables must have at least one value (Issue #52)

Btw, if you're interested in only the correlation between a variable and the rest, is more straightforward to use corr_var:

corr_var(pmeans, BELONG)

Which will print you this:

image.png (view on web)https://www.google.com/url?q=https://github.com/laresbernardo/lares/assets/25909073/b84f0fa5-e84b-434e-8781-ceab13e07374&source=gmail-imap&ust=1707925287000000&usg=AOvVaw3zwbKpIilGnb51NJ4HdbuE

— Reply to this email directly, view it on GitHubhttps://www.google.com/url?q=https://github.com/laresbernardo/lares/issues/52%23issuecomment-1932317236&source=gmail-imap&ust=1707925287000000&usg=AOvVaw036bDH_2KnbKpL26oUDMBG, or unsubscribehttps://www.google.com/url?q=https://github.com/notifications/unsubscribe-auth/BERQLLGN77T4M2SGE6HN2MLYSOOCJAVCNFSM6AAAAABC6A5Z3WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZSGMYTOMRTGY&source=gmail-imap&ust=1707925287000000&usg=AOvVaw0vETdFoHO--8tGDY79-snr. You are receiving this because you were mentioned.Message ID: @.***>

laresbernardo commented 8 months ago

Great. De nada ;)